pub struct Plane {
pub normal: Vec3,
pub distance: Real,
}Expand description
A plane defined by a normal and signed distance from origin.
Fields§
§normal: Vec3Outward-facing normal (should be normalized).
distance: RealSigned distance from the origin along the normal.
Implementations§
Source§impl Plane
impl Plane
Sourcepub fn signed_distance(&self, point: &Vec3) -> Real
pub fn signed_distance(&self, point: &Vec3) -> Real
Signed distance from a point to this plane.
Sourcepub fn from_points(a: &Vec3, b: &Vec3, c: &Vec3) -> Option<Self>
pub fn from_points(a: &Vec3, b: &Vec3, c: &Vec3) -> Option<Self>
Create a plane from three non-collinear points.
The normal is computed as (b - a).cross(c - a) normalized.
Returns None if points are collinear.
Sourcepub fn project_point(&self, point: &Vec3) -> Vec3
pub fn project_point(&self, point: &Vec3) -> Vec3
Project a point onto this plane.
Sourcepub fn reflect_point(&self, point: &Vec3) -> Vec3
pub fn reflect_point(&self, point: &Vec3) -> Vec3
Reflect a point across this plane.
Sourcepub fn classify_point(&self, point: &Vec3, tolerance: Real) -> i32
pub fn classify_point(&self, point: &Vec3, tolerance: Real) -> i32
Classify a point relative to this plane.
Returns positive if the point is on the front side, negative on the back side, or zero if it lies on the plane (within tolerance).
Source§impl Plane
impl Plane
Sourcepub fn intersect_ray(&self, ray: &Ray) -> Option<Real>
pub fn intersect_ray(&self, ray: &Ray) -> Option<Real>
Ray–plane intersection returning the hit t parameter.
Identical to Ray::intersect_plane but callable directly on a Plane.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Plane
impl RefUnwindSafe for Plane
impl Send for Plane
impl Sync for Plane
impl Unpin for Plane
impl UnsafeUnpin for Plane
impl UnwindSafe for Plane
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
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
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.