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 toA
in the plane equationn.y
: corresponds toB
in the plane equationn.z
: corresponds toC
in the plane equation
d
: the distance value, corresponding toD
in 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: S
Plane distance value
Implementations§
source§impl<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> Freeze for Plane<S>where
S: Freeze,
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§
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn 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.§fn 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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more