#[repr(C)]pub struct Plane<T> {
pub normal: Vec3<T>,
pub distance: T,
}
Expand description
Plane structure.
Fields§
§normal: Vec3<T>
The normal of the plane.
distance: T
The distance from the origin.
Implementations§
Source§impl<T> Plane<T>
impl<T> Plane<T>
Sourcepub fn from_point(normal: Vec3<T>, pt: Point3<T>) -> Plane<T>where
T: Float,
pub fn from_point(normal: Vec3<T>, pt: Point3<T>) -> Plane<T>where
T: Float,
Constructs a new plane from a normal and a point.
Source§impl<T: Float> Plane<T>
impl<T: Float> Plane<T>
Sourcepub fn project_point(&self, pt: Point3<T>) -> Point3<T>
pub fn project_point(&self, pt: Point3<T>) -> Point3<T>
Returns the projection of a point onto the plane.
use cvmath::{Plane, Point3, Vec3};
let plane = Plane(Vec3(0.0, 0.0, 1.0), 0.0);
let pt = Point3(20.0, 10.0, 4.0);
assert_eq!(plane.project_point(pt), Point3(20.0, 10.0, 0.0));
Sourcepub fn distance_to_point(&self, pt: Point3<T>) -> T
pub fn distance_to_point(&self, pt: Point3<T>) -> T
Returns the distance from the plane to a point.
use cvmath::{Plane, Point3, Vec3};
let plane = Plane(Vec3(0.0, 0.0, 1.0), 0.0);
let pt = Point3(20.0, 10.0, 4.0);
assert_eq!(plane.distance_to_point(pt), 4.0);
Trait Implementations§
impl<T: Copy> Copy for Plane<T>
impl<T: Eq> Eq for Plane<T>
impl<T> StructuralPartialEq for Plane<T>
Auto Trait Implementations§
impl<T> Freeze for Plane<T>where
T: Freeze,
impl<T> RefUnwindSafe for Plane<T>where
T: RefUnwindSafe,
impl<T> Send for Plane<T>where
T: Send,
impl<T> Sync for Plane<T>where
T: Sync,
impl<T> Unpin for Plane<T>where
T: Unpin,
impl<T> UnwindSafe for Plane<T>where
T: UnwindSafe,
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