pub struct Plane<S> {
pub n: Vector3<S>,
pub d: S,
}Expand description
A 3-dimensional plane formed from the equation: A*x + B*y + C*z - D = 0.
Fields
n: a unit vector representing the normal of the plane where:n.x: corresponds toAin the plane equationn.y: corresponds toBin the plane equationn.z: corresponds toCin the plane equation
d: the distance value, corresponding toDin the plane equation
Notes
The A*x + B*y + C*z - D = 0 form is preferred over the other common
alternative, A*x + B*y + C*z + D = 0, because it tends to avoid
superfluous negations (see Real Time Collision Detection, p. 55).
Copied from: https://github.com/rustgd/collision-rs
Fields
n: Vector3<S>Plane normal
d: SPlane distance value
Implementations
sourceimpl<S: BaseFloat> Plane<S>
impl<S: BaseFloat> Plane<S>
sourcepub fn new(n: Vector3<S>, d: S) -> Plane<S>
pub fn new(n: Vector3<S>, d: S) -> Plane<S>
Construct a plane from a normal vector and a scalar distance. The
plane will be perpendicular to n, and d units offset from the
origin.
sourcepub fn from_points(a: Point3<S>, b: Point3<S>, c: Point3<S>) -> Option<Plane<S>>
pub fn from_points(a: Point3<S>, b: Point3<S>, c: Point3<S>) -> Option<Plane<S>>
Constructs a plane that passes through the the three points a, b and c
sourcepub fn from_point_normal(p: Point3<S>, n: Vector3<S>) -> Plane<S>
pub fn from_point_normal(p: Point3<S>, n: Vector3<S>) -> Plane<S>
Construct a plane from a point and a normal vector.
The plane will contain the point p and be perpendicular to n.
fn intersection_distance_ray(
&self,
ray_origin: &Vector3<S>,
ray_direction: &Vector3<S>
) -> Option<S>
sourcepub fn intersection_points_aabb3(&self, aabb: &Aabb3<S>) -> Vec<Vector3<S>>
pub fn intersection_points_aabb3(&self, aabb: &Aabb3<S>) -> Vec<Vector3<S>>
Returns unsorted intersection points with an Aabb3 Adopted from: https://www.asawicki.info/news_1428_finding_polygon_of_plane-aabb_intersection Inspired by: https://godotengine.org/qa/54688/camera-frustum-intersection-with-plane
pub fn intersection_polygon_aabb3(&self, aabb: &Aabb3<S>) -> Vec<Vector3<S>>
Trait Implementations
Auto Trait Implementations
impl<S> RefUnwindSafe for Plane<S>where
S: RefUnwindSafe,
impl<S> Send for Plane<S>where
S: Send,
impl<S> Sync for Plane<S>where
S: Sync,
impl<S> Unpin for Plane<S>where
S: Unpin,
impl<S> UnwindSafe for Plane<S>where
S: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read morefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read morefn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s. Read morefn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s. Read more