123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526 |
- :github_url: hide
- .. DO NOT EDIT THIS FILE!!!
- .. Generated automatically from Godot engine sources.
- .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
- .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/Plane.xml.
- .. _class_Plane:
- Plane
- =====
- A plane in Hessian normal form.
- .. rst-class:: classref-introduction-group
- Description
- -----------
- Represents a normalized plane equation. :ref:`normal<class_Plane_property_normal>` is the normal of the plane (a, b, c normalized), and :ref:`d<class_Plane_property_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.
- .. rst-class:: classref-introduction-group
- Tutorials
- ---------
- - :doc:`Math documentation index <../tutorials/math/index>`
- .. rst-class:: classref-reftable-group
- Properties
- ----------
- .. table::
- :widths: auto
- +-------------------------------+--------------------------------------------+----------------------+
- | :ref:`float<class_float>` | :ref:`d<class_Plane_property_d>` | ``0.0`` |
- +-------------------------------+--------------------------------------------+----------------------+
- | :ref:`Vector3<class_Vector3>` | :ref:`normal<class_Plane_property_normal>` | ``Vector3(0, 0, 0)`` |
- +-------------------------------+--------------------------------------------+----------------------+
- | :ref:`float<class_float>` | :ref:`x<class_Plane_property_x>` | ``0.0`` |
- +-------------------------------+--------------------------------------------+----------------------+
- | :ref:`float<class_float>` | :ref:`y<class_Plane_property_y>` | ``0.0`` |
- +-------------------------------+--------------------------------------------+----------------------+
- | :ref:`float<class_float>` | :ref:`z<class_Plane_property_z>` | ``0.0`` |
- +-------------------------------+--------------------------------------------+----------------------+
- .. rst-class:: classref-reftable-group
- Constructors
- ------------
- .. table::
- :widths: auto
- +---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Plane<class_Plane>` | :ref:`Plane<class_Plane_constructor_Plane>`\ (\ ) |
- +---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Plane<class_Plane>` | :ref:`Plane<class_Plane_constructor_Plane>`\ (\ from\: :ref:`Plane<class_Plane>`\ ) |
- +---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Plane<class_Plane>` | :ref:`Plane<class_Plane_constructor_Plane>`\ (\ a\: :ref:`float<class_float>`, b\: :ref:`float<class_float>`, c\: :ref:`float<class_float>`, d\: :ref:`float<class_float>`\ ) |
- +---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Plane<class_Plane>` | :ref:`Plane<class_Plane_constructor_Plane>`\ (\ normal\: :ref:`Vector3<class_Vector3>`\ ) |
- +---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Plane<class_Plane>` | :ref:`Plane<class_Plane_constructor_Plane>`\ (\ normal\: :ref:`Vector3<class_Vector3>`, d\: :ref:`float<class_float>`\ ) |
- +---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Plane<class_Plane>` | :ref:`Plane<class_Plane_constructor_Plane>`\ (\ normal\: :ref:`Vector3<class_Vector3>`, point\: :ref:`Vector3<class_Vector3>`\ ) |
- +---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Plane<class_Plane>` | :ref:`Plane<class_Plane_constructor_Plane>`\ (\ point1\: :ref:`Vector3<class_Vector3>`, point2\: :ref:`Vector3<class_Vector3>`, point3\: :ref:`Vector3<class_Vector3>`\ ) |
- +---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- .. rst-class:: classref-reftable-group
- Methods
- -------
- .. table::
- :widths: auto
- +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`distance_to<class_Plane_method_distance_to>`\ (\ point\: :ref:`Vector3<class_Vector3>`\ ) |const| |
- +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Vector3<class_Vector3>` | :ref:`get_center<class_Plane_method_get_center>`\ (\ ) |const| |
- +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`has_point<class_Plane_method_has_point>`\ (\ point\: :ref:`Vector3<class_Vector3>`, tolerance\: :ref:`float<class_float>` = 1e-05\ ) |const| |
- +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Variant<class_Variant>` | :ref:`intersect_3<class_Plane_method_intersect_3>`\ (\ b\: :ref:`Plane<class_Plane>`, c\: :ref:`Plane<class_Plane>`\ ) |const| |
- +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Variant<class_Variant>` | :ref:`intersects_ray<class_Plane_method_intersects_ray>`\ (\ from\: :ref:`Vector3<class_Vector3>`, dir\: :ref:`Vector3<class_Vector3>`\ ) |const| |
- +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Variant<class_Variant>` | :ref:`intersects_segment<class_Plane_method_intersects_segment>`\ (\ from\: :ref:`Vector3<class_Vector3>`, to\: :ref:`Vector3<class_Vector3>`\ ) |const| |
- +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_equal_approx<class_Plane_method_is_equal_approx>`\ (\ to_plane\: :ref:`Plane<class_Plane>`\ ) |const| |
- +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_finite<class_Plane_method_is_finite>`\ (\ ) |const| |
- +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_point_over<class_Plane_method_is_point_over>`\ (\ point\: :ref:`Vector3<class_Vector3>`\ ) |const| |
- +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Plane<class_Plane>` | :ref:`normalized<class_Plane_method_normalized>`\ (\ ) |const| |
- +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Vector3<class_Vector3>` | :ref:`project<class_Plane_method_project>`\ (\ point\: :ref:`Vector3<class_Vector3>`\ ) |const| |
- +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
- .. rst-class:: classref-reftable-group
- Operators
- ---------
- .. table::
- :widths: auto
- +---------------------------+--------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`operator !=<class_Plane_operator_neq_Plane>`\ (\ right\: :ref:`Plane<class_Plane>`\ ) |
- +---------------------------+--------------------------------------------------------------------------------------------------------------+
- | :ref:`Plane<class_Plane>` | :ref:`operator *<class_Plane_operator_mul_Transform3D>`\ (\ right\: :ref:`Transform3D<class_Transform3D>`\ ) |
- +---------------------------+--------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`operator ==<class_Plane_operator_eq_Plane>`\ (\ right\: :ref:`Plane<class_Plane>`\ ) |
- +---------------------------+--------------------------------------------------------------------------------------------------------------+
- | :ref:`Plane<class_Plane>` | :ref:`operator unary+<class_Plane_operator_unplus>`\ (\ ) |
- +---------------------------+--------------------------------------------------------------------------------------------------------------+
- | :ref:`Plane<class_Plane>` | :ref:`operator unary-<class_Plane_operator_unminus>`\ (\ ) |
- +---------------------------+--------------------------------------------------------------------------------------------------------------+
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Constants
- ---------
- .. _class_Plane_constant_PLANE_YZ:
- .. rst-class:: classref-constant
- **PLANE_YZ** = ``Plane(1, 0, 0, 0)`` :ref:`🔗<class_Plane_constant_PLANE_YZ>`
- A plane that extends in the Y and Z axes (normal vector points +X).
- .. _class_Plane_constant_PLANE_XZ:
- .. rst-class:: classref-constant
- **PLANE_XZ** = ``Plane(0, 1, 0, 0)`` :ref:`🔗<class_Plane_constant_PLANE_XZ>`
- A plane that extends in the X and Z axes (normal vector points +Y).
- .. _class_Plane_constant_PLANE_XY:
- .. rst-class:: classref-constant
- **PLANE_XY** = ``Plane(0, 0, 1, 0)`` :ref:`🔗<class_Plane_constant_PLANE_XY>`
- A plane that extends in the X and Y axes (normal vector points +Z).
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Property Descriptions
- ---------------------
- .. _class_Plane_property_d:
- .. rst-class:: classref-property
- :ref:`float<class_float>` **d** = ``0.0`` :ref:`🔗<class_Plane_property_d>`
- The distance from the origin to the plane, expressed in terms of :ref:`normal<class_Plane_property_normal>` (according to its direction and magnitude). Actual absolute distance from the origin to the plane can be calculated as ``abs(d) / normal.length()`` (if :ref:`normal<class_Plane_property_normal>` has zero length then this **Plane** does not represent a valid plane).
- 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.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Plane_property_normal:
- .. rst-class:: classref-property
- :ref:`Vector3<class_Vector3>` **normal** = ``Vector3(0, 0, 0)`` :ref:`🔗<class_Plane_property_normal>`
- The normal of the plane, typically a unit vector. Shouldn't be a zero vector as **Plane** with such :ref:`normal<class_Plane_property_normal>` does not represent a valid plane.
- 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.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Plane_property_x:
- .. rst-class:: classref-property
- :ref:`float<class_float>` **x** = ``0.0`` :ref:`🔗<class_Plane_property_x>`
- The X component of the plane's :ref:`normal<class_Plane_property_normal>` vector.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Plane_property_y:
- .. rst-class:: classref-property
- :ref:`float<class_float>` **y** = ``0.0`` :ref:`🔗<class_Plane_property_y>`
- The Y component of the plane's :ref:`normal<class_Plane_property_normal>` vector.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Plane_property_z:
- .. rst-class:: classref-property
- :ref:`float<class_float>` **z** = ``0.0`` :ref:`🔗<class_Plane_property_z>`
- The Z component of the plane's :ref:`normal<class_Plane_property_normal>` vector.
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Constructor Descriptions
- ------------------------
- .. _class_Plane_constructor_Plane:
- .. rst-class:: classref-constructor
- :ref:`Plane<class_Plane>` **Plane**\ (\ ) :ref:`🔗<class_Plane_constructor_Plane>`
- Constructs a default-initialized **Plane** with all components set to ``0``.
- .. rst-class:: classref-item-separator
- ----
- .. rst-class:: classref-constructor
- :ref:`Plane<class_Plane>` **Plane**\ (\ from\: :ref:`Plane<class_Plane>`\ )
- Constructs a **Plane** as a copy of the given **Plane**.
- .. rst-class:: classref-item-separator
- ----
- .. rst-class:: classref-constructor
- :ref:`Plane<class_Plane>` **Plane**\ (\ a\: :ref:`float<class_float>`, b\: :ref:`float<class_float>`, c\: :ref:`float<class_float>`, d\: :ref:`float<class_float>`\ )
- 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.
- .. rst-class:: classref-item-separator
- ----
- .. rst-class:: classref-constructor
- :ref:`Plane<class_Plane>` **Plane**\ (\ normal\: :ref:`Vector3<class_Vector3>`\ )
- Creates a plane from the normal vector. The plane will intersect the origin.
- The ``normal`` of the plane must be a unit vector.
- .. rst-class:: classref-item-separator
- ----
- .. rst-class:: classref-constructor
- :ref:`Plane<class_Plane>` **Plane**\ (\ normal\: :ref:`Vector3<class_Vector3>`, d\: :ref:`float<class_float>`\ )
- Creates a plane from the normal vector and the plane's distance from the origin.
- The ``normal`` of the plane must be a unit vector.
- .. rst-class:: classref-item-separator
- ----
- .. rst-class:: classref-constructor
- :ref:`Plane<class_Plane>` **Plane**\ (\ normal\: :ref:`Vector3<class_Vector3>`, point\: :ref:`Vector3<class_Vector3>`\ )
- Creates a plane from the normal vector and a point on the plane.
- The ``normal`` of the plane must be a unit vector.
- .. rst-class:: classref-item-separator
- ----
- .. rst-class:: classref-constructor
- :ref:`Plane<class_Plane>` **Plane**\ (\ point1\: :ref:`Vector3<class_Vector3>`, point2\: :ref:`Vector3<class_Vector3>`, point3\: :ref:`Vector3<class_Vector3>`\ )
- Creates a plane from the three points, given in clockwise order.
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Method Descriptions
- -------------------
- .. _class_Plane_method_distance_to:
- .. rst-class:: classref-method
- :ref:`float<class_float>` **distance_to**\ (\ point\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_Plane_method_distance_to>`
- Returns the shortest distance from the plane to the position ``point``. If the point is above the plane, the distance will be positive. If below, the distance will be negative.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Plane_method_get_center:
- .. rst-class:: classref-method
- :ref:`Vector3<class_Vector3>` **get_center**\ (\ ) |const| :ref:`🔗<class_Plane_method_get_center>`
- Returns the center of the plane.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Plane_method_has_point:
- .. rst-class:: classref-method
- :ref:`bool<class_bool>` **has_point**\ (\ point\: :ref:`Vector3<class_Vector3>`, tolerance\: :ref:`float<class_float>` = 1e-05\ ) |const| :ref:`🔗<class_Plane_method_has_point>`
- Returns ``true`` if ``point`` is inside the plane. Comparison uses a custom minimum ``tolerance`` threshold.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Plane_method_intersect_3:
- .. rst-class:: classref-method
- :ref:`Variant<class_Variant>` **intersect_3**\ (\ b\: :ref:`Plane<class_Plane>`, c\: :ref:`Plane<class_Plane>`\ ) |const| :ref:`🔗<class_Plane_method_intersect_3>`
- Returns the intersection point of the three planes ``b``, ``c`` and this plane. If no intersection is found, ``null`` is returned.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Plane_method_intersects_ray:
- .. rst-class:: classref-method
- :ref:`Variant<class_Variant>` **intersects_ray**\ (\ from\: :ref:`Vector3<class_Vector3>`, dir\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_Plane_method_intersects_ray>`
- 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.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Plane_method_intersects_segment:
- .. rst-class:: classref-method
- :ref:`Variant<class_Variant>` **intersects_segment**\ (\ from\: :ref:`Vector3<class_Vector3>`, to\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_Plane_method_intersects_segment>`
- Returns the intersection point of a segment from position ``from`` to position ``to`` with this plane. If no intersection is found, ``null`` is returned.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Plane_method_is_equal_approx:
- .. rst-class:: classref-method
- :ref:`bool<class_bool>` **is_equal_approx**\ (\ to_plane\: :ref:`Plane<class_Plane>`\ ) |const| :ref:`🔗<class_Plane_method_is_equal_approx>`
- Returns ``true`` if this plane and ``to_plane`` are approximately equal, by running :ref:`@GlobalScope.is_equal_approx<class_@GlobalScope_method_is_equal_approx>` on each component.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Plane_method_is_finite:
- .. rst-class:: classref-method
- :ref:`bool<class_bool>` **is_finite**\ (\ ) |const| :ref:`🔗<class_Plane_method_is_finite>`
- Returns ``true`` if this plane is finite, by calling :ref:`@GlobalScope.is_finite<class_@GlobalScope_method_is_finite>` on each component.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Plane_method_is_point_over:
- .. rst-class:: classref-method
- :ref:`bool<class_bool>` **is_point_over**\ (\ point\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_Plane_method_is_point_over>`
- Returns ``true`` if ``point`` is located above the plane.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Plane_method_normalized:
- .. rst-class:: classref-method
- :ref:`Plane<class_Plane>` **normalized**\ (\ ) |const| :ref:`🔗<class_Plane_method_normalized>`
- Returns a copy of the plane, with normalized :ref:`normal<class_Plane_property_normal>` (so it's a unit vector). Returns ``Plane(0, 0, 0, 0)`` if :ref:`normal<class_Plane_property_normal>` can't be normalized (it has zero length).
- .. rst-class:: classref-item-separator
- ----
- .. _class_Plane_method_project:
- .. rst-class:: classref-method
- :ref:`Vector3<class_Vector3>` **project**\ (\ point\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_Plane_method_project>`
- Returns the orthogonal projection of ``point`` into a point in the plane.
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Operator Descriptions
- ---------------------
- .. _class_Plane_operator_neq_Plane:
- .. rst-class:: classref-operator
- :ref:`bool<class_bool>` **operator !=**\ (\ right\: :ref:`Plane<class_Plane>`\ ) :ref:`🔗<class_Plane_operator_neq_Plane>`
- Returns ``true`` if the planes are not equal.
- \ **Note:** Due to floating-point precision errors, consider using :ref:`is_equal_approx<class_Plane_method_is_equal_approx>` instead, which is more reliable.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Plane_operator_mul_Transform3D:
- .. rst-class:: classref-operator
- :ref:`Plane<class_Plane>` **operator ***\ (\ right\: :ref:`Transform3D<class_Transform3D>`\ ) :ref:`🔗<class_Plane_operator_mul_Transform3D>`
- Inversely transforms (multiplies) the **Plane** by the given :ref:`Transform3D<class_Transform3D>` transformation matrix.
- \ ``plane * transform`` is equivalent to ``transform.affine_inverse() * plane``. See :ref:`Transform3D.affine_inverse<class_Transform3D_method_affine_inverse>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Plane_operator_eq_Plane:
- .. rst-class:: classref-operator
- :ref:`bool<class_bool>` **operator ==**\ (\ right\: :ref:`Plane<class_Plane>`\ ) :ref:`🔗<class_Plane_operator_eq_Plane>`
- Returns ``true`` if the planes are exactly equal.
- \ **Note:** Due to floating-point precision errors, consider using :ref:`is_equal_approx<class_Plane_method_is_equal_approx>` instead, which is more reliable.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Plane_operator_unplus:
- .. rst-class:: classref-operator
- :ref:`Plane<class_Plane>` **operator unary+**\ (\ ) :ref:`🔗<class_Plane_operator_unplus>`
- Returns the same value as if the ``+`` was not there. Unary ``+`` does nothing, but sometimes it can make your code more readable.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Plane_operator_unminus:
- .. rst-class:: classref-operator
- :ref:`Plane<class_Plane>` **operator unary-**\ (\ ) :ref:`🔗<class_Plane_operator_unminus>`
- Returns the negative value of the **Plane**. This is the same as writing ``Plane(-p.normal, -p.d)``. This operation flips the direction of the normal vector and also flips the distance value, resulting in a Plane that is in the same place, but facing the opposite direction.
- .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
- .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
- .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
- .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
- .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
- .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
- .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
- .. |void| replace:: :abbr:`void (No return value.)`
|