pub struct Plane {
pub normal: Vec3f,
pub distance: f32,
}Expand description
The Plane struct provides a plane for 3D distance and half-space tests.
The plane uses the equation N.x*x + N.y*y + N.z*z + D = 0. The normal
field stores N, and distance stores D. Use a unit normal when results
must use world-space distance units.
Fields§
§normal: Vec3f§distance: f32Implementations§
Source§impl Plane
impl Plane
Sourcepub fn new(normal: Vec3f, distance: f32) -> Self
pub fn new(normal: Vec3f, distance: f32) -> Self
Creates a plane from a normal vector and the equation constant D.
Sourcepub fn from_points(p1: Vec3f, p2: Vec3f, p3: Vec3f) -> Self
pub fn from_points(p1: Vec3f, p2: Vec3f, p3: Vec3f) -> Self
Creates a plane through three noncollinear points.
The returned plane has a unit normal and contains each input point.
Sourcepub fn signed_distance_to_point(&self, point: Vec3f) -> f32
pub fn signed_distance_to_point(&self, point: Vec3f) -> f32
Returns the signed distance from a point to this plane.
A positive value is on the normal side, a negative value is on the opposite side, and zero is on the plane. The result uses world-space distance units when the plane has a unit normal.
Sourcepub fn is_sphere_in_half_space(&self, sphere: &Sphere) -> bool
pub fn is_sphere_in_half_space(&self, sphere: &Sphere) -> bool
Returns whether any part of a sphere is in this plane’s positive half-space.
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