Plane¶
Plane in hessian form.
Description¶
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.
Tutorials¶
Properties¶
|
||
|
||
|
||
|
||
|
Constructors¶
Plane ( ) |
|
Methods¶
center ( ) const |
|
distance_to ( Vector3 point ) const |
|
intersect_3 ( Plane b, Plane c ) const |
|
intersects_ray ( Vector3 from, Vector3 dir ) const |
|
intersects_segment ( Vector3 from, Vector3 to ) const |
|
is_equal_approx ( Plane to_plane ) const |
|
is_point_over ( Vector3 plane ) const |
|
normalized ( ) const |
|
Operators¶
operator != ( Plane right ) |
|
operator == ( Plane right ) |
|
operator unary+ ( ) |
|
operator unary- ( ) |
Constants¶
PLANE_YZ = Plane(1, 0, 0, 0) --- A plane that extends in the Y and Z axes (normal vector points +X).
PLANE_XZ = Plane(0, 1, 0, 0) --- A plane that extends in the X and Z axes (normal vector points +Y).
PLANE_XY = Plane(0, 0, 1, 0) --- A plane that extends in the X and Y axes (normal vector points +Z).
Property Descriptions¶
float d
Default |
|
The distance from the origin to the plane, in the direction of normal. This value is typically non-negative.
In the scalar equation of the plane ax + by + cz = d
, this is d
, while the (a, b, c)
coordinates are represented by the normal property.
Vector3 normal
Default |
|
The normal of the plane, which must be normalized.
In the scalar equation of the plane ax + by + cz = d
, this is the vector (a, b, c)
, where d
is the d property.
float x
Default |
|
The X component of the plane's normal vector.
float y
Default |
|
The Y component of the plane's normal vector.
float z
Default |
|
The Z component of the plane's normal vector.
Constructor Descriptions¶
Plane Plane ( )
Constructs a default-initialized Plane
with all components set to 0
.
Constructs a Plane
as a copy of the given Plane
.
Creates a plane from the four parameters. The three components of the resulting plane's normal are a
, b
and c
, and the plane has a distance of d
from the origin.
Creates a plane from the normal vector. The plane will intersect the origin.
Creates a plane from the normal vector and the plane's distance from the origin.
Creates a plane from the normal vector and a point on the plane.
Creates a plane from the three points, given in clockwise order.
Method Descriptions¶
Vector3 center ( ) const
Returns the center of the plane.
Returns the shortest distance from the plane to the position point
.
Returns true
if point
is inside the plane. Comparison uses a custom minimum epsilon
threshold.
Returns the intersection point of the three planes b
, c
and this plane. If no intersection is found, null
is returned.
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.
Returns the intersection point of a segment from position begin
to position end
with this plane. If no intersection is found, null
is returned.
Returns true
if this plane and plane
are approximately equal, by running @GlobalScope.is_equal_approx on each component.
Returns true
if point
is located above the plane.
Plane normalized ( ) const
Returns a copy of the plane, normalized.
Returns the orthogonal projection of point
into a point in the plane.
Operator Descriptions¶
Returns true
if the planes are not equal.
Note: Due to floating-point precision errors, consider using is_equal_approx instead, which is more reliable.
Returns true
if the planes are exactly equal.
Note: Due to floating-point precision errors, consider using is_equal_approx instead, which is more reliable.
Plane operator unary+ ( )
Returns the same value as if the +
was not there. Unary +
does nothing, but sometimes it can make your code more readable.
Plane operator unary- ( )
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.