pub struct Plane3D { /* private fields */ }Expand description
A plane in 3D space, represented as normal · point = offset.
Implementations§
Source§impl Plane3D
impl Plane3D
Sourcepub fn new(normal: Vector3<f32>, offset: f32) -> Self
pub fn new(normal: Vector3<f32>, offset: f32) -> Self
Creates a new plane from a normal vector and offset. The normal will be normalized automatically.
§Panics
Panics if the normal vector has zero length.
Sourcepub fn from_point_and_normal(point: Point3<f32>, normal: Vector3<f32>) -> Self
pub fn from_point_and_normal(point: Point3<f32>, normal: Vector3<f32>) -> Self
Creates a plane from a point on the plane and a normal vector. The normal will be normalized automatically.
§Panics
Panics if the normal vector has zero length.
Sourcepub fn from_three_points(a: Point3<f32>, b: Point3<f32>, c: Point3<f32>) -> Self
pub fn from_three_points(a: Point3<f32>, b: Point3<f32>, c: Point3<f32>) -> Self
Creates a plane from three non-collinear points. The normal direction follows the right-hand rule: (b - a) × (c - a).
§Panics
Panics if the points are collinear (or nearly so).
Sourcepub fn offset(&self) -> f32
pub fn offset(&self) -> f32
Returns the signed distance from the origin to the plane along the normal.
Sourcepub fn signed_distance(&self, point: Point3<f32>) -> f32
pub fn signed_distance(&self, point: Point3<f32>) -> f32
Computes the signed distance from a point to the plane.
- Positive: point is in front (same side as normal)
- Negative: point is behind (opposite side from normal)
- Zero: point is on the plane
Sourcepub fn classify_point(&self, point: Point3<f32>) -> PlaneSide
pub fn classify_point(&self, point: Point3<f32>) -> PlaneSide
Classifies which side of the plane a point lies on.
Uses the default PLANE_EPSILON tolerance.
Sourcepub fn classify_point_with_epsilon(
&self,
point: Point3<f32>,
epsilon: f32,
) -> PlaneSide
pub fn classify_point_with_epsilon( &self, point: Point3<f32>, epsilon: f32, ) -> PlaneSide
Classifies which side of the plane a point lies on, with a custom epsilon.
Sourcepub fn flipped(&self) -> Self
pub fn flipped(&self) -> Self
Returns a new plane with the normal flipped (facing the opposite direction).
Sourcepub fn project_point(&self, point: Point3<f32>) -> Point3<f32>
pub fn project_point(&self, point: Point3<f32>) -> Point3<f32>
Projects a point onto the plane (finds the closest point on the plane).
Sourcepub fn intersect_segment(
&self,
start: Point3<f32>,
end: Point3<f32>,
) -> Option<(f32, Point3<f32>)>
pub fn intersect_segment( &self, start: Point3<f32>, end: Point3<f32>, ) -> Option<(f32, Point3<f32>)>
Computes the intersection of a line segment with the plane.
Returns Some((t, point)) where:
tis the interpolation parameter (0.0 = start, 1.0 = end)pointis the intersection point
Returns None if the segment is parallel to the plane or doesn’t intersect.
Trait Implementations§
impl StructuralPartialEq for Plane3D
Auto Trait Implementations§
impl Freeze for Plane3D
impl RefUnwindSafe for Plane3D
impl Send for Plane3D
impl Sync for Plane3D
impl Unpin for Plane3D
impl UnsafeUnpin for Plane3D
impl UnwindSafe for Plane3D
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.