Struct oxygengine_physics_2d::prelude::ncollide2d::bounding_volume::AABB
source · pub struct AABB<N>where
N: RealField + Copy,{
pub mins: OPoint<N, Const<2>>,
pub maxs: OPoint<N, Const<2>>,
}
Expand description
An Axis Aligned Bounding Box.
Fields§
§mins: OPoint<N, Const<2>>
§maxs: OPoint<N, Const<2>>
Implementations§
source§impl<N> AABB<N>where
N: RealField + Copy,
impl<N> AABB<N>where N: RealField + Copy,
sourcepub fn new(mins: OPoint<N, Const<2>>, maxs: OPoint<N, Const<2>>) -> AABB<N>
pub fn new(mins: OPoint<N, Const<2>>, maxs: OPoint<N, Const<2>>) -> AABB<N>
Creates a new AABB.
Arguments:
mins
- position of the point with the smallest coordinates.maxs
- position of the point with the highest coordinates. Each component ofmins
must be smaller than the related components ofmaxs
.
sourcepub fn new_invalid() -> AABB<N>
pub fn new_invalid() -> AABB<N>
Creates an invalid AABB with mins
components set to N::max_values
and maxs
components set to -N::max_values
.
This is often used as the initial values of some AABB merging algorithms.
sourcepub fn from_half_extents(
center: OPoint<N, Const<2>>,
half_extents: Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>
) -> AABB<N>
pub fn from_half_extents( center: OPoint<N, Const<2>>, half_extents: Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>> ) -> AABB<N>
Creates a new AABB from its center and its half-extents.
sourcepub fn from_points<'a, I>(pts: I) -> AABB<N>where
I: IntoIterator<Item = &'a OPoint<N, Const<2>>>,
pub fn from_points<'a, I>(pts: I) -> AABB<N>where I: IntoIterator<Item = &'a OPoint<N, Const<2>>>,
Creates a new AABB from a set of points.
sourcepub fn mins(&self) -> &OPoint<N, Const<2>>
👎Deprecated: use the .mins
public field instead.
pub fn mins(&self) -> &OPoint<N, Const<2>>
.mins
public field instead.Reference to the AABB point with the smallest components along each axis.
sourcepub fn maxs(&self) -> &OPoint<N, Const<2>>
👎Deprecated: use the .maxs
public field instead.
pub fn maxs(&self) -> &OPoint<N, Const<2>>
.maxs
public field instead.Reference to the AABB point with the biggest components along each axis.
sourcepub fn half_extents(
&self
) -> Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>
pub fn half_extents( &self ) -> Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>
The half extents of this AABB.
sourcepub fn extents(
&self
) -> Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>
pub fn extents( &self ) -> Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>
The extents of this AABB.
sourcepub fn take_point(&mut self, pt: OPoint<N, Const<2>>)
pub fn take_point(&mut self, pt: OPoint<N, Const<2>>)
Enlarges this AABB so it also contains the point pt
.
sourcepub fn transform_by(&self, m: &Isometry<N, Unit<Complex<N>>, 2>) -> AABB<N>
pub fn transform_by(&self, m: &Isometry<N, Unit<Complex<N>>, 2>) -> AABB<N>
Computes the AABB bounding self
transformed by m
.
sourcepub fn bounding_sphere(&self) -> BoundingSphere<N>
pub fn bounding_sphere(&self) -> BoundingSphere<N>
The smallest bounding sphere containing this AABB.
pub fn contains_local_point(&self, point: &OPoint<N, Const<2>>) -> bool
source§impl<N> AABB<N>where
N: RealField + Copy,
impl<N> AABB<N>where N: RealField + Copy,
sourcepub fn clip_line_parameters(
&self,
orig: &OPoint<N, Const<2>>,
dir: &Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>
) -> Option<(N, N)>
pub fn clip_line_parameters( &self, orig: &OPoint<N, Const<2>>, dir: &Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>> ) -> Option<(N, N)>
Computes the parameters of the two intersection points between a line and this AABB.
The parameters are such that the point are given by orig + dir * parameter
.
Returns None
if there is no intersection.
sourcepub fn clip_line(
&self,
orig: &OPoint<N, Const<2>>,
dir: &Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>
) -> Option<Segment<N>>
pub fn clip_line( &self, orig: &OPoint<N, Const<2>>, dir: &Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>> ) -> Option<Segment<N>>
Computes the intersection segment between a line and this AABB.
Returns None
if there is no intersection.
sourcepub fn clip_ray_parameters(&self, ray: &Ray<N>) -> Option<(N, N)>
pub fn clip_ray_parameters(&self, ray: &Ray<N>) -> Option<(N, N)>
Computes the parameters of the two intersection points between a ray and this AABB.
The parameters are such that the point are given by ray.orig + ray.dir * parameter
.
Returns None
if there is no intersection.
Trait Implementations§
source§impl<'a, N, S> BestFirstVisitor<N, usize, AABB<N>> for CompositeClosestPointVisitor<'a, N, S>where
N: RealField + Copy,
S: CompositeShape<N> + PointQuery<N>,
impl<'a, N, S> BestFirstVisitor<N, usize, AABB<N>> for CompositeClosestPointVisitor<'a, N, S>where N: RealField + Copy, S: CompositeShape<N> + PointQuery<N>,
§type Result = PointProjection<N>
type Result = PointProjection<N>
source§fn visit(
&mut self,
best: N,
aabb: &AABB<N>,
data: Option<&usize>
) -> BestFirstVisitStatus<N, <CompositeClosestPointVisitor<'a, N, S> as BestFirstVisitor<N, usize, AABB<N>>>::Result>
fn visit( &mut self, best: N, aabb: &AABB<N>, data: Option<&usize> ) -> BestFirstVisitStatus<N, <CompositeClosestPointVisitor<'a, N, S> as BestFirstVisitor<N, usize, AABB<N>>>::Result>
source§impl<N> BoundingVolume<N> for AABB<N>where
N: RealField + Copy,
impl<N> BoundingVolume<N> for AABB<N>where N: RealField + Copy,
source§fn center(&self) -> OPoint<N, Const<2>>
fn center(&self) -> OPoint<N, Const<2>>
source§fn intersects(&self, other: &AABB<N>) -> bool
fn intersects(&self, other: &AABB<N>) -> bool
source§fn contains(&self, other: &AABB<N>) -> bool
fn contains(&self, other: &AABB<N>) -> bool
source§fn merge(&mut self, other: &AABB<N>)
fn merge(&mut self, other: &AABB<N>)
source§impl<'de, N> Deserialize<'de> for AABB<N>where
N: RealField + Copy + Deserialize<'de>,
impl<'de, N> Deserialize<'de> for AABB<N>where N: RealField + Copy + Deserialize<'de>,
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<AABB<N>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<AABB<N>, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
source§impl<N> HasBoundingVolume<N, AABB<N>> for ConvexPolygon<N>where
N: RealField + Copy,
impl<N> HasBoundingVolume<N, AABB<N>> for ConvexPolygon<N>where N: RealField + Copy,
source§impl<N> HasBoundingVolume<N, AABB<N>> for HeightField<N>where
N: RealField + Copy,
impl<N> HasBoundingVolume<N, AABB<N>> for HeightField<N>where N: RealField + Copy,
source§impl<N> PartialEq<AABB<N>> for AABB<N>where
N: PartialEq<N> + RealField + Copy,
impl<N> PartialEq<AABB<N>> for AABB<N>where N: PartialEq<N> + RealField + Copy,
source§impl<N> PointQuery<N> for AABB<N>where
N: RealField + Copy,
impl<N> PointQuery<N> for AABB<N>where N: RealField + Copy,
source§fn project_point(
&self,
m: &Isometry<N, Unit<Complex<N>>, 2>,
pt: &OPoint<N, Const<2>>,
solid: bool
) -> PointProjection<N>
fn project_point( &self, m: &Isometry<N, Unit<Complex<N>>, 2>, pt: &OPoint<N, Const<2>>, solid: bool ) -> PointProjection<N>
self
transformed by m
.source§fn project_point_with_feature(
&self,
m: &Isometry<N, Unit<Complex<N>>, 2>,
pt: &OPoint<N, Const<2>>
) -> (PointProjection<N>, FeatureId)
fn project_point_with_feature( &self, m: &Isometry<N, Unit<Complex<N>>, 2>, pt: &OPoint<N, Const<2>> ) -> (PointProjection<N>, FeatureId)
self
transformed by m
and retuns the id of the
feature the point was projected on.source§impl<N> RayCast<N> for AABB<N>where
N: RealField + Copy,
impl<N> RayCast<N> for AABB<N>where N: RealField + Copy,
source§fn toi_with_ray(
&self,
m: &Isometry<N, Unit<Complex<N>>, 2>,
ray: &Ray<N>,
max_toi: N,
solid: bool
) -> Option<N>
fn toi_with_ray( &self, m: &Isometry<N, Unit<Complex<N>>, 2>, ray: &Ray<N>, max_toi: N, solid: bool ) -> Option<N>
source§fn toi_and_normal_with_ray(
&self,
m: &Isometry<N, Unit<Complex<N>>, 2>,
ray: &Ray<N>,
max_toi: N,
solid: bool
) -> Option<RayIntersection<N>>
fn toi_and_normal_with_ray( &self, m: &Isometry<N, Unit<Complex<N>>, 2>, ray: &Ray<N>, max_toi: N, solid: bool ) -> Option<RayIntersection<N>>
source§impl<N> Serialize for AABB<N>where
N: RealField + Copy + Serialize,
impl<N> Serialize for AABB<N>where N: RealField + Copy + Serialize,
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,
source§impl<'a, N, T> SimultaneousVisitor<T, AABB<N>> for AABBSetsInterferencesCollector<'a, N, T>where
N: RealField + Copy,
T: Clone,
impl<'a, N, T> SimultaneousVisitor<T, AABB<N>> for AABBSetsInterferencesCollector<'a, N, T>where N: RealField + Copy, T: Clone,
impl<N> Copy for AABB<N>where N: Copy + RealField,
impl<N> StructuralPartialEq for AABB<N>where N: RealField + Copy,
Auto Trait Implementations§
impl<N> RefUnwindSafe for AABB<N>where N: RefUnwindSafe,
impl<N> Send for AABB<N>
impl<N> Sync for AABB<N>
impl<N> Unpin for AABB<N>where N: Unpin,
impl<N> UnwindSafe for AABB<N>where N: 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, Global>) -> Box<dyn Any, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any, 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
.§fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.