pub struct Plane<T: Scalar> { /* private fields */ }Expand description
A plane defined by ax + by + cz + d = 0.
Implementations§
Source§impl<T: FloatScalar> Plane<T>
impl<T: FloatScalar> Plane<T>
Sourcepub fn new(n: &Vector3<T>, p: &Vector3<T>) -> Self
pub fn new(n: &Vector3<T>, p: &Vector3<T>) -> Self
Creates a plane from a normal and a point on the plane.
§Panics
Panics if n is too small to normalize. Use Plane::try_new when the
input may be degenerate.
Sourcepub fn try_new(n: &Vector3<T>, p: &Vector3<T>, epsilon: T) -> Option<Self>
pub fn try_new(n: &Vector3<T>, p: &Vector3<T>, epsilon: T) -> Option<Self>
Creates a plane from a normal and a point on the plane.
Returns None if n is too small to normalize.
Sourcepub fn from_tri(v0: &Vector3<T>, v1: &Vector3<T>, v2: &Vector3<T>) -> Self
pub fn from_tri(v0: &Vector3<T>, v1: &Vector3<T>, v2: &Vector3<T>) -> Self
Creates a plane from triangle vertices.
§Panics
Panics if the triangle is degenerate. Use Plane::try_from_tri when
the input may be degenerate.
Sourcepub fn try_from_tri(
v0: &Vector3<T>,
v1: &Vector3<T>,
v2: &Vector3<T>,
epsilon: T,
) -> Option<Self>
pub fn try_from_tri( v0: &Vector3<T>, v1: &Vector3<T>, v2: &Vector3<T>, epsilon: T, ) -> Option<Self>
Creates a plane from triangle vertices.
Returns None if the triangle is degenerate.
Sourcepub fn from_quad(
v0: &Vector3<T>,
v1: &Vector3<T>,
v2: &Vector3<T>,
v3: &Vector3<T>,
) -> Self
pub fn from_quad( v0: &Vector3<T>, v1: &Vector3<T>, v2: &Vector3<T>, v3: &Vector3<T>, ) -> Self
Creates a plane from quad vertices.
§Panics
Panics if the quad diagonals do not define a plane. Use
Plane::try_from_quad when the input may be degenerate.
This routine does not validate that the four vertices are coplanar.
For non-coplanar quads it returns the diagonal-derived representative
plane described by Plane::try_from_quad.
Sourcepub fn try_from_quad(
v0: &Vector3<T>,
v1: &Vector3<T>,
v2: &Vector3<T>,
v3: &Vector3<T>,
epsilon: T,
) -> Option<Self>
pub fn try_from_quad( v0: &Vector3<T>, v1: &Vector3<T>, v2: &Vector3<T>, v3: &Vector3<T>, epsilon: T, ) -> Option<Self>
Creates a plane from quad vertices.
Returns None if the quad diagonals do not define a plane.
The plane normal is computed from the quad diagonals and anchored at the vertex centroid. This is a representative plane for the quad and does not validate coplanarity. For non-coplanar input, the returned plane is not guaranteed to pass through any of the vertices.