#[repr(C)]
pub struct Plane { pub normal: Vector3, pub d: f32, }
Expand description

3D plane in Hessian form: a*b + b*y + c*z + d = 0

Note: almost all methods on Plane require that the normal vector have unit length and will panic if this invariant is violated. This is not separately annotated for each method.

Fields

normal: Vector3

Normal vector, perpendicular to the plane.

Most Plane methods expect this vector to be normalized and may panic if this is not the case.

d: f32

Distance from the coordinate system origin (in the direction of normal).

This value is typically non-negative. It can however be negative, which behaves as if normal changed direction.

Implementations

Creates a new Plane from the normal and the distance from the origin d.

Panics

In contrast to construction via Plane { normal, d }, this verifies that normal has unit length, and will panic if this is not the case.

Creates a new Plane from normal and origin distance.

a, b, c are used for the normal vector. d is the distance from the origin.

Panics

See Self::new().

Creates a new Plane from three Vector3, given in clockwise order.

If all three points are collinear, returns None.

Returns the point on the Plane, which is closest to the origin.

This is equivalent to self.project(Vector3::ZERO).

Returns the orthogonal projection of point onto a point in the Plane.

The projection is a point, which lies on the plane and is closest to point.

Returns the signed distance from the Plane to point.

This value is negative, if self.is_point_over(point) is false.

Returns true if point is inside the Plane.

Uses a default epsilon for the boundary check. Use Self::contains_point_eps() for more control.

Returns true if point is inside the Plane.

epsilon specifies the minimum distance, at and below which a point is considered inside the Plane.

Returns the intersection point of the three planes self, b and c.

Returns None if the planes don’t intersect.

Returns the intersection point of a ray consisting of the position from and the direction vector dir with this plane.

Returns None if the ray doesn’t intersect.

Returns the intersection point of a segment from begin to end with this Plane.

Returns None if the the segment doesn’t intersect.

Returns true if this Plane and other are approximately equal.

Returns true if point is on the side of the Plane, into which normal points.

Points that lie exactly on the plane will be returned as false.

Returns the Plane normalized.

Panics

If self.normal is a zero vector. All other vectors are explicitly allowed.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more
A type-specific hint type that is valid for the type being exported. Read more
Returns ExportInfo given an optional typed hint.
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.