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 T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert 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 more
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more
pub fn as_any(&self) -> &(dyn Any + 'static)
pub fn as_any(&self) -> &(dyn Any + 'static)
Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s. Read more
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more