W3cubDocs

/Godot 3.2

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

float d 0.0
Vector3 normal Vector3( 0, 0, 0 )
float x 0.0
float y 0.0
float z 0.0

Methods

Plane Plane ( float a, float b, float c, float d )
Plane Plane ( Vector3 v1, Vector3 v2, Vector3 v3 )
Plane Plane ( Vector3 normal, float d )
Vector3 center ( )
float distance_to ( Vector3 point )
Vector3 get_any_point ( )
bool has_point ( Vector3 point, float epsilon=1e-05 )
Vector3 intersect_3 ( Plane b, Plane c )
Vector3 intersects_ray ( Vector3 from, Vector3 dir )
Vector3 intersects_segment ( Vector3 begin, Vector3 end )
bool is_equal_approx ( Plane plane )
bool is_point_over ( Vector3 point )
Plane normalized ( )
Vector3 project ( Vector3 point )

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 0.0

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 Vector3( 0, 0, 0 )

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 0.0

The X component of the plane's normal vector.

float y

Default 0.0

The Y component of the plane's normal vector.

float z

Default 0.0

The Z component of the plane's normal vector.

Method Descriptions

Plane Plane ( float a, float b, float c, float d )

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 three points, given in clockwise order.

Creates a plane from the normal and the plane's distance to the origin.

Vector3 center ( )

Returns the center of the plane.

float distance_to ( Vector3 point )

Returns the shortest distance from the plane to the position point.

Vector3 get_any_point ( )

Returns the center of the plane.

This method is deprecated, please use center instead.

bool has_point ( Vector3 point, float epsilon=1e-05 )

Returns true if point is inside the plane. Comparison uses a custom minimum epsilon threshold.

Vector3 intersect_3 ( Plane b, Plane c )

Returns the intersection point of the three planes b, c and this plane. If no intersection is found, null is returned.

Vector3 intersects_ray ( Vector3 from, Vector3 dir )

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.

Vector3 intersects_segment ( Vector3 begin, Vector3 end )

Returns the intersection point of a segment from position begin to position end with this plane. If no intersection is found, null is returned.

bool is_equal_approx ( Plane plane )

Returns true if this plane and plane are approximately equal, by running @GDScript.is_equal_approx on each component.

bool is_point_over ( Vector3 point )

Returns true if point is located above the plane.

Plane normalized ( )

Returns a copy of the plane, normalized.

Vector3 project ( Vector3 point )

Returns the orthogonal projection of point into a point in the plane.

© 2014–2020 Juan Linietsky, Ariel Manzur, Godot Engine contributors
Licensed under the MIT License.
https://docs.godotengine.org/en/3.2/classes/class_plane.html