pub struct Plane {
pub normal: Vec3,
pub offset: Real,
}Expand description
An infinite plane defined by normal and offset.
Fields§
§normal: Vec3Outward-facing unit normal.
offset: RealSigned distance from the origin to the plane (along the normal).
Implementations§
Source§impl Plane
impl Plane
Sourcepub fn new(normal: Vec3, offset: Real) -> Self
pub fn new(normal: Vec3, offset: Real) -> Self
Create a plane from normal and offset. Normal is normalised internally.
Sourcepub fn from_point_normal(point: Vec3, normal: Vec3) -> Self
pub fn from_point_normal(point: Vec3, normal: Vec3) -> Self
Create a plane passing through point with the given normal.
Sourcepub fn signed_distance(&self, point: &Vec3) -> Real
pub fn signed_distance(&self, point: &Vec3) -> Real
Signed distance from point to the plane.
Sourcepub fn project_point(&self, point: &Vec3) -> Vec3
pub fn project_point(&self, point: &Vec3) -> Vec3
Project a point onto the plane (closest point on the plane).
Sourcepub fn ray_intersect(&self, ray: &Ray) -> Option<Real>
pub fn ray_intersect(&self, ray: &Ray) -> Option<Real>
Ray–plane intersection. Returns the t-value or None if parallel.
Sourcepub fn sphere_straddles(&self, sphere: &Sphere) -> bool
pub fn sphere_straddles(&self, sphere: &Sphere) -> bool
Test whether two spheres straddle the 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.