2017-09-12 22:42:36 +02:00
<?xml version="1.0" encoding="UTF-8" ?>
2023-03-01 01:44:37 +01:00
<class name= "Plane" version= "4.1" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2017-09-12 22:42:36 +02:00
<brief_description >
2023-04-28 01:35:33 +02:00
A plane in Hessian normal form.
2017-09-12 22:42:36 +02:00
</brief_description>
<description >
2023-04-28 01:35:33 +02:00
Represents a normalized plane equation. [member normal] is the normal of the plane (a, b, c normalized), and [member 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.
2017-09-12 22:42:36 +02:00
</description>
<tutorials >
2021-11-15 10:43:07 +01:00
<link title= "Math documentation index" > $DOCS_URL/tutorials/math/index.html</link>
2017-09-12 22:42:36 +02:00
</tutorials>
2021-09-21 04:49:02 +02:00
<constructors >
<constructor name= "Plane" >
2021-07-30 15:28:05 +02:00
<return type= "Plane" />
2020-11-09 17:46:03 +01:00
<description >
Constructs a default-initialized [Plane] with all components set to [code]0[/code].
</description>
2021-09-21 04:49:02 +02:00
</constructor>
<constructor name= "Plane" >
2021-07-30 15:28:05 +02:00
<return type= "Plane" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "from" type= "Plane" />
2020-11-09 17:46:03 +01:00
<description >
Constructs a [Plane] as a copy of the given [Plane].
</description>
2021-09-21 04:49:02 +02:00
</constructor>
<constructor name= "Plane" >
2021-07-30 15:28:05 +02:00
<return type= "Plane" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "a" type= "float" />
<param index= "1" name= "b" type= "float" />
<param index= "2" name= "c" type= "float" />
<param index= "3" name= "d" type= "float" />
2017-09-12 22:42:36 +02:00
<description >
2022-08-11 19:52:19 +02:00
Creates a plane from the four parameters. The three components of the resulting plane's [member normal] are [param a], [param b] and [param c], and the plane has a distance of [param d] from the origin.
2017-09-12 22:42:36 +02:00
</description>
2021-09-21 04:49:02 +02:00
</constructor>
<constructor name= "Plane" >
2021-04-08 16:26:14 +02:00
<return type= "Plane" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "normal" type= "Vector3" />
2021-04-08 16:26:14 +02:00
<description >
2021-09-21 04:49:02 +02:00
Creates a plane from the normal vector. The plane will intersect the origin.
2023-01-15 05:35:09 +01:00
The [param normal] of the plane must be a unit vector.
2021-04-08 16:26:14 +02:00
</description>
2021-09-21 04:49:02 +02:00
</constructor>
<constructor name= "Plane" >
2021-07-30 15:28:05 +02:00
<return type= "Plane" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "normal" type= "Vector3" />
<param index= "1" name= "d" type= "float" />
2020-11-09 17:46:03 +01:00
<description >
2021-09-21 04:49:02 +02:00
Creates a plane from the normal vector and the plane's distance from the origin.
2023-01-15 05:35:09 +01:00
The [param normal] of the plane must be a unit vector.
2020-11-09 17:46:03 +01:00
</description>
2021-09-21 04:49:02 +02:00
</constructor>
<constructor name= "Plane" >
2021-07-30 15:28:05 +02:00
<return type= "Plane" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "normal" type= "Vector3" />
<param index= "1" name= "point" type= "Vector3" />
2017-09-12 22:42:36 +02:00
<description >
2021-09-21 04:49:02 +02:00
Creates a plane from the normal vector and a point on the plane.
2023-01-15 05:35:09 +01:00
The [param normal] of the plane must be a unit vector.
2017-09-12 22:42:36 +02:00
</description>
2021-09-21 04:49:02 +02:00
</constructor>
<constructor name= "Plane" >
2021-07-30 15:28:05 +02:00
<return type= "Plane" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "point1" type= "Vector3" />
<param index= "1" name= "point2" type= "Vector3" />
<param index= "2" name= "point3" type= "Vector3" />
2017-09-12 22:42:36 +02:00
<description >
2020-11-09 17:46:03 +01:00
Creates a plane from the three points, given in clockwise order.
2017-09-12 22:42:36 +02:00
</description>
2021-09-21 04:49:02 +02:00
</constructor>
</constructors>
<methods >
2021-03-18 14:44:42 +01:00
<method name= "distance_to" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "float" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "point" type= "Vector3" />
2017-09-12 22:42:36 +02:00
<description >
2022-08-11 19:52:19 +02:00
Returns the shortest distance from the plane to the position [param point]. If the point is above the plane, the distance will be positive. If below, the distance will be negative.
2017-09-12 22:42:36 +02:00
</description>
</method>
2023-01-15 16:51:43 +01:00
<method name= "get_center" qualifiers= "const" >
<return type= "Vector3" />
<description >
Returns the center of the plane.
</description>
</method>
2021-03-18 14:44:42 +01:00
<method name= "has_point" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "bool" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "point" type= "Vector3" />
<param index= "1" name= "tolerance" type= "float" default= "1e-05" />
2017-09-12 22:42:36 +02:00
<description >
2022-08-11 19:52:19 +02:00
Returns [code]true[/code] if [param point] is inside the plane. Comparison uses a custom minimum [param tolerance] threshold.
2017-09-12 22:42:36 +02:00
</description>
</method>
2021-03-18 14:44:42 +01:00
<method name= "intersect_3" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "Variant" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "b" type= "Plane" />
<param index= "1" name= "c" type= "Plane" />
2017-09-12 22:42:36 +02:00
<description >
2022-08-11 19:52:19 +02:00
Returns the intersection point of the three planes [param b], [param c] and this plane. If no intersection is found, [code]null[/code] is returned.
2017-09-12 22:42:36 +02:00
</description>
</method>
2021-03-18 14:44:42 +01:00
<method name= "intersects_ray" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "Variant" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "from" type= "Vector3" />
<param index= "1" name= "dir" type= "Vector3" />
2017-09-12 22:42:36 +02:00
<description >
2022-08-11 19:52:19 +02:00
Returns the intersection point of a ray consisting of the position [param from] and the direction normal [param dir] with this plane. If no intersection is found, [code]null[/code] is returned.
2017-09-12 22:42:36 +02:00
</description>
</method>
2021-03-18 14:44:42 +01:00
<method name= "intersects_segment" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "Variant" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "from" type= "Vector3" />
<param index= "1" name= "to" type= "Vector3" />
2017-09-12 22:42:36 +02:00
<description >
2022-08-11 19:52:19 +02:00
Returns the intersection point of a segment from position [param from] to position [param to] with this plane. If no intersection is found, [code]null[/code] is returned.
2017-09-12 22:42:36 +02:00
</description>
</method>
2021-03-18 14:44:42 +01:00
<method name= "is_equal_approx" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "bool" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "to_plane" type= "Plane" />
2019-11-08 08:33:48 +01:00
<description >
2022-08-11 19:52:19 +02:00
Returns [code]true[/code] if this plane and [param to_plane] are approximately equal, by running [method @GlobalScope.is_equal_approx] on each component.
2019-11-08 08:33:48 +01:00
</description>
</method>
2022-08-11 10:12:27 +02:00
<method name= "is_finite" qualifiers= "const" >
<return type= "bool" />
<description >
Returns [code]true[/code] if this plane is finite, by calling [method @GlobalScope.is_finite] on each component.
</description>
</method>
2021-03-18 14:44:42 +01:00
<method name= "is_point_over" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "bool" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "point" type= "Vector3" />
2017-09-12 22:42:36 +02:00
<description >
2022-08-11 19:52:19 +02:00
Returns [code]true[/code] if [param point] is located above the plane.
2017-09-12 22:42:36 +02:00
</description>
</method>
2021-03-18 14:44:42 +01:00
<method name= "normalized" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "Plane" />
2017-09-12 22:42:36 +02:00
<description >
2023-05-19 13:28:50 +02:00
Returns a copy of the plane, with normalized [member normal] (so it's a unit vector). Returns [code]Plane(0, 0, 0, 0)[/code] if [member normal] can't be normalized (it has zero length).
2017-09-12 22:42:36 +02:00
</description>
</method>
2021-03-18 14:44:42 +01:00
<method name= "project" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "Vector3" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "point" type= "Vector3" />
2017-09-12 22:42:36 +02:00
<description >
2022-08-11 19:52:19 +02:00
Returns the orthogonal projection of [param point] into a point in the plane.
2017-09-12 22:42:36 +02:00
</description>
</method>
</methods>
<members >
2019-06-29 12:38:01 +02:00
<member name= "d" type= "float" setter= "" getter= "" default= "0.0" >
2023-05-19 13:28:50 +02:00
The distance from the origin to the plane, expressed in terms of [member normal] (according to its direction and magnitude). Actual absolute distance from the origin to the plane can be calculated as [code]abs(d) / normal.length()[/code] (if [member normal] has zero length then this [Plane] does not represent a valid plane).
2020-07-21 20:07:00 +02:00
In the scalar equation of the plane [code]ax + by + cz = d[/code], this is [code]d[/code], while the [code](a, b, c)[/code] coordinates are represented by the [member normal] property.
2017-09-12 22:42:36 +02:00
</member>
2019-09-24 19:45:03 +02:00
<member name= "normal" type= "Vector3" setter= "" getter= "" default= "Vector3(0, 0, 0)" >
2023-05-19 13:28:50 +02:00
The normal of the plane, typically a unit vector. Shouldn't be a zero vector as [Plane] with such [member normal] does not represent a valid plane.
2020-07-21 20:07:00 +02:00
In the scalar equation of the plane [code]ax + by + cz = d[/code], this is the vector [code](a, b, c)[/code], where [code]d[/code] is the [member d] property.
2017-09-12 22:42:36 +02:00
</member>
2019-06-29 12:38:01 +02:00
<member name= "x" type= "float" setter= "" getter= "" default= "0.0" >
2020-07-21 20:07:00 +02:00
The X component of the plane's [member normal] vector.
2017-09-12 22:42:36 +02:00
</member>
2019-06-29 12:38:01 +02:00
<member name= "y" type= "float" setter= "" getter= "" default= "0.0" >
2020-07-21 20:07:00 +02:00
The Y component of the plane's [member normal] vector.
2017-09-12 22:42:36 +02:00
</member>
2019-06-29 12:38:01 +02:00
<member name= "z" type= "float" setter= "" getter= "" default= "0.0" >
2020-07-21 20:07:00 +02:00
The Z component of the plane's [member normal] vector.
2017-09-12 22:42:36 +02:00
</member>
</members>
<constants >
2019-09-24 19:45:03 +02:00
<constant name= "PLANE_YZ" value= "Plane(1, 0, 0, 0)" >
2020-07-21 20:07:00 +02:00
A plane that extends in the Y and Z axes (normal vector points +X).
2018-08-21 00:35:30 +02:00
</constant>
2019-09-24 19:45:03 +02:00
<constant name= "PLANE_XZ" value= "Plane(0, 1, 0, 0)" >
2020-07-21 20:07:00 +02:00
A plane that extends in the X and Z axes (normal vector points +Y).
2018-08-21 00:35:30 +02:00
</constant>
2019-09-24 19:45:03 +02:00
<constant name= "PLANE_XY" value= "Plane(0, 0, 1, 0)" >
2020-07-21 20:07:00 +02:00
A plane that extends in the X and Y axes (normal vector points +Z).
2018-08-21 00:35:30 +02:00
</constant>
2017-09-12 22:42:36 +02:00
</constants>
2021-09-21 04:49:02 +02:00
<operators >
<operator name= "operator !=" >
<return type= "bool" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "right" type= "Plane" />
2021-09-21 04:49:02 +02:00
<description >
2021-11-04 16:58:20 +01:00
Returns [code]true[/code] if the planes are not equal.
[b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
2021-09-21 04:49:02 +02:00
</description>
</operator>
2022-07-31 00:32:03 +02:00
<operator name= "operator *" >
<return type= "Plane" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "right" type= "Transform3D" />
2022-07-31 00:32:03 +02:00
<description >
Inversely transforms (multiplies) the [Plane] by the given [Transform3D] transformation matrix.
</description>
</operator>
2021-09-21 04:49:02 +02:00
<operator name= "operator ==" >
<return type= "bool" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "right" type= "Plane" />
2021-09-21 04:49:02 +02:00
<description >
2021-11-04 16:58:20 +01:00
Returns [code]true[/code] if the planes are exactly equal.
[b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
2021-09-21 04:49:02 +02:00
</description>
</operator>
<operator name= "operator unary+" >
<return type= "Plane" />
<description >
2021-11-04 16:58:20 +01:00
Returns the same value as if the [code]+[/code] was not there. Unary [code]+[/code] does nothing, but sometimes it can make your code more readable.
2021-09-21 04:49:02 +02:00
</description>
</operator>
<operator name= "operator unary-" >
<return type= "Plane" />
<description >
2021-11-04 16:58:20 +01:00
Returns the negative value of the [Plane]. This is the same as writing [code]Plane(-p.normal, -p.d)[/code]. 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.
2021-09-21 04:49:02 +02:00
</description>
</operator>
</operators>
2017-09-12 22:42:36 +02:00
</class>