class_plane.rst 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the Plane.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_Plane:
  6. Plane
  7. =====
  8. Plane in hessian form.
  9. Description
  10. -----------
  11. Plane represents a normalized plane equation. Basically, "normal" is the normal of the plane (a,b,c normalized), and "d" is the distance from the origin to the plane (in the direction of "normal"). "Over" or "Above" the plane is considered the side of the plane towards where the normal is pointing.
  12. Tutorials
  13. ---------
  14. - :doc:`../tutorials/math/index`
  15. Properties
  16. ----------
  17. +-------------------------------+--------------------------------------------+------------------------+
  18. | :ref:`float<class_float>` | :ref:`d<class_Plane_property_d>` | ``0.0`` |
  19. +-------------------------------+--------------------------------------------+------------------------+
  20. | :ref:`Vector3<class_Vector3>` | :ref:`normal<class_Plane_property_normal>` | ``Vector3( 0, 0, 0 )`` |
  21. +-------------------------------+--------------------------------------------+------------------------+
  22. | :ref:`float<class_float>` | :ref:`x<class_Plane_property_x>` | ``0.0`` |
  23. +-------------------------------+--------------------------------------------+------------------------+
  24. | :ref:`float<class_float>` | :ref:`y<class_Plane_property_y>` | ``0.0`` |
  25. +-------------------------------+--------------------------------------------+------------------------+
  26. | :ref:`float<class_float>` | :ref:`z<class_Plane_property_z>` | ``0.0`` |
  27. +-------------------------------+--------------------------------------------+------------------------+
  28. Methods
  29. -------
  30. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`Plane<class_Plane>` | :ref:`Plane<class_Plane_method_Plane>` **(** :ref:`float<class_float>` a, :ref:`float<class_float>` b, :ref:`float<class_float>` c, :ref:`float<class_float>` d **)** |
  32. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`Plane<class_Plane>` | :ref:`Plane<class_Plane_method_Plane>` **(** :ref:`Vector3<class_Vector3>` v1, :ref:`Vector3<class_Vector3>` v2, :ref:`Vector3<class_Vector3>` v3 **)** |
  34. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`Plane<class_Plane>` | :ref:`Plane<class_Plane_method_Plane>` **(** :ref:`Vector3<class_Vector3>` normal, :ref:`float<class_float>` d **)** |
  36. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`Vector3<class_Vector3>` | :ref:`center<class_Plane_method_center>` **(** **)** |
  38. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`float<class_float>` | :ref:`distance_to<class_Plane_method_distance_to>` **(** :ref:`Vector3<class_Vector3>` point **)** |
  40. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`Vector3<class_Vector3>` | :ref:`get_any_point<class_Plane_method_get_any_point>` **(** **)** |
  42. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`bool<class_bool>` | :ref:`has_point<class_Plane_method_has_point>` **(** :ref:`Vector3<class_Vector3>` point, :ref:`float<class_float>` epsilon=1e-05 **)** |
  44. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`Vector3<class_Vector3>` | :ref:`intersect_3<class_Plane_method_intersect_3>` **(** :ref:`Plane<class_Plane>` b, :ref:`Plane<class_Plane>` c **)** |
  46. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`Vector3<class_Vector3>` | :ref:`intersects_ray<class_Plane_method_intersects_ray>` **(** :ref:`Vector3<class_Vector3>` from, :ref:`Vector3<class_Vector3>` dir **)** |
  48. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`Vector3<class_Vector3>` | :ref:`intersects_segment<class_Plane_method_intersects_segment>` **(** :ref:`Vector3<class_Vector3>` begin, :ref:`Vector3<class_Vector3>` end **)** |
  50. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`bool<class_bool>` | :ref:`is_equal_approx<class_Plane_method_is_equal_approx>` **(** :ref:`Plane<class_Plane>` plane **)** |
  52. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`bool<class_bool>` | :ref:`is_point_over<class_Plane_method_is_point_over>` **(** :ref:`Vector3<class_Vector3>` point **)** |
  54. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | :ref:`Plane<class_Plane>` | :ref:`normalized<class_Plane_method_normalized>` **(** **)** |
  56. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | :ref:`Vector3<class_Vector3>` | :ref:`project<class_Plane_method_project>` **(** :ref:`Vector3<class_Vector3>` point **)** |
  58. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. Constants
  60. ---------
  61. .. _class_Plane_constant_PLANE_YZ:
  62. .. _class_Plane_constant_PLANE_XZ:
  63. .. _class_Plane_constant_PLANE_XY:
  64. - **PLANE_YZ** = **Plane( 1, 0, 0, 0 )** --- A plane that extends in the Y and Z axes (normal vector points +X).
  65. - **PLANE_XZ** = **Plane( 0, 1, 0, 0 )** --- A plane that extends in the X and Z axes (normal vector points +Y).
  66. - **PLANE_XY** = **Plane( 0, 0, 1, 0 )** --- A plane that extends in the X and Y axes (normal vector points +Z).
  67. Property Descriptions
  68. ---------------------
  69. .. _class_Plane_property_d:
  70. - :ref:`float<class_float>` **d**
  71. +-----------+---------+
  72. | *Default* | ``0.0`` |
  73. +-----------+---------+
  74. The distance from the origin to the plane, in the direction of :ref:`normal<class_Plane_property_normal>`. This value is typically non-negative.
  75. In the scalar equation of the plane ``ax + by + cz = d``, this is ``d``, while the ``(a, b, c)`` coordinates are represented by the :ref:`normal<class_Plane_property_normal>` property.
  76. ----
  77. .. _class_Plane_property_normal:
  78. - :ref:`Vector3<class_Vector3>` **normal**
  79. +-----------+------------------------+
  80. | *Default* | ``Vector3( 0, 0, 0 )`` |
  81. +-----------+------------------------+
  82. The normal of the plane, which must be normalized.
  83. In the scalar equation of the plane ``ax + by + cz = d``, this is the vector ``(a, b, c)``, where ``d`` is the :ref:`d<class_Plane_property_d>` property.
  84. ----
  85. .. _class_Plane_property_x:
  86. - :ref:`float<class_float>` **x**
  87. +-----------+---------+
  88. | *Default* | ``0.0`` |
  89. +-----------+---------+
  90. The X component of the plane's :ref:`normal<class_Plane_property_normal>` vector.
  91. ----
  92. .. _class_Plane_property_y:
  93. - :ref:`float<class_float>` **y**
  94. +-----------+---------+
  95. | *Default* | ``0.0`` |
  96. +-----------+---------+
  97. The Y component of the plane's :ref:`normal<class_Plane_property_normal>` vector.
  98. ----
  99. .. _class_Plane_property_z:
  100. - :ref:`float<class_float>` **z**
  101. +-----------+---------+
  102. | *Default* | ``0.0`` |
  103. +-----------+---------+
  104. The Z component of the plane's :ref:`normal<class_Plane_property_normal>` vector.
  105. Method Descriptions
  106. -------------------
  107. .. _class_Plane_method_Plane:
  108. - :ref:`Plane<class_Plane>` **Plane** **(** :ref:`float<class_float>` a, :ref:`float<class_float>` b, :ref:`float<class_float>` c, :ref:`float<class_float>` d **)**
  109. Creates a plane from the four parameters. The three components of the resulting plane's :ref:`normal<class_Plane_property_normal>` are ``a``, ``b`` and ``c``, and the plane has a distance of ``d`` from the origin.
  110. ----
  111. - :ref:`Plane<class_Plane>` **Plane** **(** :ref:`Vector3<class_Vector3>` v1, :ref:`Vector3<class_Vector3>` v2, :ref:`Vector3<class_Vector3>` v3 **)**
  112. Creates a plane from the three points, given in clockwise order.
  113. ----
  114. - :ref:`Plane<class_Plane>` **Plane** **(** :ref:`Vector3<class_Vector3>` normal, :ref:`float<class_float>` d **)**
  115. Creates a plane from the normal and the plane's distance to the origin.
  116. ----
  117. .. _class_Plane_method_center:
  118. - :ref:`Vector3<class_Vector3>` **center** **(** **)**
  119. Returns the center of the plane.
  120. ----
  121. .. _class_Plane_method_distance_to:
  122. - :ref:`float<class_float>` **distance_to** **(** :ref:`Vector3<class_Vector3>` point **)**
  123. Returns the shortest distance from the plane to the position ``point``.
  124. ----
  125. .. _class_Plane_method_get_any_point:
  126. - :ref:`Vector3<class_Vector3>` **get_any_point** **(** **)**
  127. Returns the center of the plane.
  128. This method is deprecated, please use :ref:`center<class_Plane_method_center>` instead.
  129. ----
  130. .. _class_Plane_method_has_point:
  131. - :ref:`bool<class_bool>` **has_point** **(** :ref:`Vector3<class_Vector3>` point, :ref:`float<class_float>` epsilon=1e-05 **)**
  132. Returns ``true`` if ``point`` is inside the plane. Comparison uses a custom minimum ``epsilon`` threshold.
  133. ----
  134. .. _class_Plane_method_intersect_3:
  135. - :ref:`Vector3<class_Vector3>` **intersect_3** **(** :ref:`Plane<class_Plane>` b, :ref:`Plane<class_Plane>` c **)**
  136. Returns the intersection point of the three planes ``b``, ``c`` and this plane. If no intersection is found, ``null`` is returned.
  137. ----
  138. .. _class_Plane_method_intersects_ray:
  139. - :ref:`Vector3<class_Vector3>` **intersects_ray** **(** :ref:`Vector3<class_Vector3>` from, :ref:`Vector3<class_Vector3>` dir **)**
  140. Returns the intersection point of a ray consisting of the position ``from`` and the direction normal ``dir`` with this plane. If no intersection is found, ``null`` is returned.
  141. ----
  142. .. _class_Plane_method_intersects_segment:
  143. - :ref:`Vector3<class_Vector3>` **intersects_segment** **(** :ref:`Vector3<class_Vector3>` begin, :ref:`Vector3<class_Vector3>` end **)**
  144. Returns the intersection point of a segment from position ``begin`` to position ``end`` with this plane. If no intersection is found, ``null`` is returned.
  145. ----
  146. .. _class_Plane_method_is_equal_approx:
  147. - :ref:`bool<class_bool>` **is_equal_approx** **(** :ref:`Plane<class_Plane>` plane **)**
  148. Returns ``true`` if this plane and ``plane`` are approximately equal, by running :ref:`@GDScript.is_equal_approx<class_@GDScript_method_is_equal_approx>` on each component.
  149. ----
  150. .. _class_Plane_method_is_point_over:
  151. - :ref:`bool<class_bool>` **is_point_over** **(** :ref:`Vector3<class_Vector3>` point **)**
  152. Returns ``true`` if ``point`` is located above the plane.
  153. ----
  154. .. _class_Plane_method_normalized:
  155. - :ref:`Plane<class_Plane>` **normalized** **(** **)**
  156. Returns a copy of the plane, normalized.
  157. ----
  158. .. _class_Plane_method_project:
  159. - :ref:`Vector3<class_Vector3>` **project** **(** :ref:`Vector3<class_Vector3>` point **)**
  160. Returns the orthogonal projection of ``point`` into a point in the plane.
  161. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  162. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  163. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`