Struct plane_split::Plane
source · Expand description
An infinite plane in 3D space, defined by equation: dot(v, normal) + offset = 0 When used for plane splitting, it’s defining a hemisphere with equation “dot(v, normal) + offset > 0”.
Fields
normal: Vector3D<f64>
Normalized vector perpendicular to the plane.
offset: f64
Constant offset from the normal plane, specified in the direction opposite to the normal.
Implementations
sourceimpl Plane
impl Plane
sourcepub fn from_unnormalized(
normal: Vector3D<f64>,
offset: f64
) -> Result<Option<Self>, NegativeHemisphereError>
pub fn from_unnormalized(
normal: Vector3D<f64>,
offset: f64
) -> Result<Option<Self>, NegativeHemisphereError>
Construct a new plane from unnormalized equation.
sourcepub fn signed_distance_to(&self, point: &Point3D<f64>) -> f64
pub fn signed_distance_to(&self, point: &Point3D<f64>) -> f64
Return the signed distance from this plane to a point. The distance is negative if the point is on the other side of the plane from the direction of the normal.
sourcepub fn distance_to_line(&self, line: &Line) -> f64
pub fn distance_to_line(&self, line: &Line) -> f64
Compute the distance across the line to the plane plane, starting from the line origin.
sourcepub fn signed_distance_sum_to<A>(&self, poly: &Polygon<A>) -> f64
pub fn signed_distance_sum_to<A>(&self, poly: &Polygon<A>) -> f64
Compute the sum of signed distances to each of the points
of another plane. Useful to know the relation of a plane that
is a product of a split, and we know it doesn’t intersect self
.
sourcepub fn are_outside(&self, points: &[Point3D<f64>]) -> bool
pub fn are_outside(&self, points: &[Point3D<f64>]) -> bool
Check if a convex shape defined by a set of points is completely outside of this plane. Merely touching the surface is not considered an intersection.