pub struct Plane {
pub normal: Vec3,
pub distance: f32,
}Expand description
A plane defined by a unit normal and signed distance from the origin.
Fields§
§normal: Vec3Unit normal.
distance: f32Signed distance term in normal.dot(point) + distance = 0.
Implementations§
Source§impl Plane
impl Plane
Sourcepub fn new(normal: Vec3, distance: f32) -> Self
pub fn new(normal: Vec3, distance: f32) -> Self
Creates a plane from a normal and signed distance.
Sourcepub fn from_normal_and_point(normal: Vec3, point: Vec3) -> Self
pub fn from_normal_and_point(normal: Vec3, point: Vec3) -> Self
Creates a plane through a point with the given normal.
Sourcepub fn from_three_points(a: Vec3, b: Vec3, c: Vec3) -> Self
pub fn from_three_points(a: Vec3, b: Vec3, c: Vec3) -> Self
Creates a plane from three points.
Sourcepub fn signed_distance(self, point: Vec3) -> f32
pub fn signed_distance(self, point: Vec3) -> f32
Returns the signed distance from a point to the plane.
Sourcepub fn project_point(self, point: Vec3) -> Vec3
pub fn project_point(self, point: Vec3) -> Vec3
Projects a point onto the plane.
Sourcepub fn intersect_ray(self, ray: Ray3) -> Option<f32>
pub fn intersect_ray(self, ray: Ray3) -> Option<f32>
Intersects a ray with the plane and returns non-negative t.
Trait Implementations§
impl Copy for Plane
impl StructuralPartialEq for Plane
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