pub struct AABB<N: RealField + Copy> {
pub mins: Point<N>,
pub maxs: Point<N>,
}
Expand description
An Axis Aligned Bounding Box.
Fields§
§mins: Point<N>
§maxs: Point<N>
Implementations§
Source§impl<N: RealField + Copy> AABB<N>
impl<N: RealField + Copy> AABB<N>
Sourcepub fn new(mins: Point<N>, maxs: Point<N>) -> AABB<N>
pub fn new(mins: Point<N>, maxs: Point<N>) -> 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() -> Self
pub fn new_invalid() -> Self
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: Point<N>, half_extents: Vector<N>) -> Self
pub fn from_half_extents(center: Point<N>, half_extents: Vector<N>) -> Self
Creates a new AABB from its center and its half-extents.
Sourcepub fn from_points<'a, I>(pts: I) -> Selfwhere
I: IntoIterator<Item = &'a Point<N>>,
pub fn from_points<'a, I>(pts: I) -> Selfwhere
I: IntoIterator<Item = &'a Point<N>>,
Creates a new AABB from a set of points.
Sourcepub fn mins(&self) -> &Point<N>
👎Deprecated: use the .mins
public field instead.
pub fn mins(&self) -> &Point<N>
.mins
public field instead.Reference to the AABB point with the smallest components along each axis.
Sourcepub fn maxs(&self) -> &Point<N>
👎Deprecated: use the .maxs
public field instead.
pub fn maxs(&self) -> &Point<N>
.maxs
public field instead.Reference to the AABB point with the biggest components along each axis.
Sourcepub fn half_extents(&self) -> Vector<N>
pub fn half_extents(&self) -> Vector<N>
The half extents of this AABB.
Sourcepub fn take_point(&mut self, pt: Point<N>)
pub fn take_point(&mut self, pt: Point<N>)
Enlarges this AABB so it also contains the point pt
.
Sourcepub fn transform_by(&self, m: &Isometry<N>) -> Self
pub fn transform_by(&self, m: &Isometry<N>) -> Self
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: &Point<N>) -> bool
Source§impl<N: RealField + Copy> AABB<N>
impl<N: RealField + Copy> AABB<N>
Sourcepub fn clip_line_parameters(
&self,
orig: &Point<N>,
dir: &Vector<N>,
) -> Option<(N, N)>
pub fn clip_line_parameters( &self, orig: &Point<N>, dir: &Vector<N>, ) -> 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: &Point<N>, dir: &Vector<N>) -> Option<Segment<N>>
pub fn clip_line(&self, orig: &Point<N>, dir: &Vector<N>) -> 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: RealField + Copy, S: CompositeShape<N> + PointQuery<N>> BestFirstVisitor<N, usize, AABB<N>> for CompositeClosestPointVisitor<'a, N, S>
impl<'a, N: RealField + Copy, S: CompositeShape<N> + PointQuery<N>> BestFirstVisitor<N, usize, AABB<N>> for CompositeClosestPointVisitor<'a, N, S>
Source§type Result = PointProjection<N>
type Result = PointProjection<N>
Source§impl<N: RealField + Copy> BoundingVolume<N> for AABB<N>
impl<N: RealField + Copy> BoundingVolume<N> for AABB<N>
Source§fn center(&self) -> Point<N>
fn center(&self) -> Point<N>
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<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for Ball<N>
impl<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for Ball<N>
Source§fn bounding_volume(&self, m: &Isometry<N>) -> AABB<N>
fn bounding_volume(&self, m: &Isometry<N>) -> AABB<N>
self
transformed by m
.Source§fn local_bounding_volume(&self) -> AABB<N>
fn local_bounding_volume(&self) -> AABB<N>
self
.Source§impl<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for Capsule<N>
impl<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for Capsule<N>
Source§fn bounding_volume(&self, m: &Isometry<N>) -> AABB<N>
fn bounding_volume(&self, m: &Isometry<N>) -> AABB<N>
self
transformed by m
.Source§fn local_bounding_volume(&self) -> AABB<N>
fn local_bounding_volume(&self) -> AABB<N>
self
.Source§impl<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for Compound<N>
impl<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for Compound<N>
Source§fn bounding_volume(&self, m: &Isometry<N>) -> AABB<N>
fn bounding_volume(&self, m: &Isometry<N>) -> AABB<N>
self
transformed by m
.Source§fn local_bounding_volume(&self) -> AABB<N>
fn local_bounding_volume(&self) -> AABB<N>
self
.Source§impl<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for Cone<N>
impl<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for Cone<N>
Source§fn bounding_volume(&self, m: &Isometry<N>) -> AABB<N>
fn bounding_volume(&self, m: &Isometry<N>) -> AABB<N>
self
transformed by m
.Source§fn local_bounding_volume(&self) -> AABB<N>
fn local_bounding_volume(&self) -> AABB<N>
self
.Source§impl<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for ConvexHull<N>
impl<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for ConvexHull<N>
Source§fn bounding_volume(&self, m: &Isometry<N>) -> AABB<N>
fn bounding_volume(&self, m: &Isometry<N>) -> AABB<N>
self
transformed by m
.Source§fn local_bounding_volume(&self) -> AABB<N>
fn local_bounding_volume(&self) -> AABB<N>
self
.Source§impl<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for Cuboid<N>
impl<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for Cuboid<N>
Source§fn bounding_volume(&self, m: &Isometry<N>) -> AABB<N>
fn bounding_volume(&self, m: &Isometry<N>) -> AABB<N>
self
transformed by m
.Source§fn local_bounding_volume(&self) -> AABB<N>
fn local_bounding_volume(&self) -> AABB<N>
self
.Source§impl<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for Cylinder<N>
impl<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for Cylinder<N>
Source§fn bounding_volume(&self, m: &Isometry<N>) -> AABB<N>
fn bounding_volume(&self, m: &Isometry<N>) -> AABB<N>
self
transformed by m
.Source§fn local_bounding_volume(&self) -> AABB<N>
fn local_bounding_volume(&self) -> AABB<N>
self
.Source§impl<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for HeightField<N>
impl<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for HeightField<N>
Source§fn bounding_volume(&self, m: &Isometry<N>) -> AABB<N>
fn bounding_volume(&self, m: &Isometry<N>) -> AABB<N>
self
transformed by m
.Source§fn local_bounding_volume(&self) -> AABB<N>
fn local_bounding_volume(&self) -> AABB<N>
self
.Source§impl<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for Plane<N>
impl<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for Plane<N>
Source§fn bounding_volume(&self, _: &Isometry<N>) -> AABB<N>
fn bounding_volume(&self, _: &Isometry<N>) -> AABB<N>
self
transformed by m
.Source§fn local_bounding_volume(&self) -> AABB<N>
fn local_bounding_volume(&self) -> AABB<N>
self
.Source§impl<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for Polyline<N>
impl<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for Polyline<N>
Source§fn bounding_volume(&self, m: &Isometry<N>) -> AABB<N>
fn bounding_volume(&self, m: &Isometry<N>) -> AABB<N>
self
transformed by m
.Source§fn local_bounding_volume(&self) -> AABB<N>
fn local_bounding_volume(&self) -> AABB<N>
self
.Source§impl<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for Segment<N>
impl<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for Segment<N>
Source§fn bounding_volume(&self, m: &Isometry<N>) -> AABB<N>
fn bounding_volume(&self, m: &Isometry<N>) -> AABB<N>
self
transformed by m
.Source§fn local_bounding_volume(&self) -> AABB<N>
fn local_bounding_volume(&self) -> AABB<N>
self
.Source§impl<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for TriMesh<N>
impl<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for TriMesh<N>
Source§fn bounding_volume(&self, m: &Isometry<N>) -> AABB<N>
fn bounding_volume(&self, m: &Isometry<N>) -> AABB<N>
self
transformed by m
.Source§fn local_bounding_volume(&self) -> AABB<N>
fn local_bounding_volume(&self) -> AABB<N>
self
.Source§impl<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for Triangle<N>
impl<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for Triangle<N>
Source§fn bounding_volume(&self, m: &Isometry<N>) -> AABB<N>
fn bounding_volume(&self, m: &Isometry<N>) -> AABB<N>
self
transformed by m
.Source§fn local_bounding_volume(&self) -> AABB<N>
fn local_bounding_volume(&self) -> AABB<N>
self
.Source§impl<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for dyn Shape<N>
impl<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for dyn Shape<N>
Source§fn bounding_volume(&self, m: &Isometry<N>) -> AABB<N>
fn bounding_volume(&self, m: &Isometry<N>) -> AABB<N>
self
transformed by m
.Source§fn local_bounding_volume(&self) -> AABB<N>
fn local_bounding_volume(&self) -> AABB<N>
self
.Source§impl<N: RealField + Copy> PointQuery<N> for AABB<N>
impl<N: RealField + Copy> PointQuery<N> for AABB<N>
Source§fn project_point(
&self,
m: &Isometry<N>,
pt: &Point<N>,
solid: bool,
) -> PointProjection<N>
fn project_point( &self, m: &Isometry<N>, pt: &Point<N>, solid: bool, ) -> PointProjection<N>
self
transformed by m
.Source§fn project_point_with_feature(
&self,
m: &Isometry<N>,
pt: &Point<N>,
) -> (PointProjection<N>, FeatureId)
fn project_point_with_feature( &self, m: &Isometry<N>, pt: &Point<N>, ) -> (PointProjection<N>, FeatureId)
self
transformed by m
and retuns the id of the
feature the point was projected on.Source§impl<N: RealField + Copy> RayCast<N> for AABB<N>
impl<N: RealField + Copy> RayCast<N> for AABB<N>
Source§fn toi_with_ray(
&self,
m: &Isometry<N>,
ray: &Ray<N>,
max_toi: N,
solid: bool,
) -> Option<N>
fn toi_with_ray( &self, m: &Isometry<N>, ray: &Ray<N>, max_toi: N, solid: bool, ) -> Option<N>
Source§fn toi_and_normal_with_ray(
&self,
m: &Isometry<N>,
ray: &Ray<N>,
max_toi: N,
solid: bool,
) -> Option<RayIntersection<N>>
fn toi_and_normal_with_ray( &self, m: &Isometry<N>, ray: &Ray<N>, max_toi: N, solid: bool, ) -> Option<RayIntersection<N>>
Source§fn toi_and_normal_and_uv_with_ray(
&self,
m: &Isometry<N>,
ray: &Ray<N>,
max_toi: N,
solid: bool,
) -> Option<RayIntersection<N>>
fn toi_and_normal_and_uv_with_ray( &self, m: &Isometry<N>, ray: &Ray<N>, max_toi: N, solid: bool, ) -> Option<RayIntersection<N>>
Source§impl<'a, N: RealField + Copy, T: Clone> SimultaneousVisitor<T, AABB<N>> for AABBSetsInterferencesCollector<'a, N, T>
impl<'a, N: RealField + Copy, T: Clone> SimultaneousVisitor<T, AABB<N>> for AABBSetsInterferencesCollector<'a, N, T>
impl<N: Copy + RealField + Copy> Copy for AABB<N>
impl<N: RealField + Copy> StructuralPartialEq for AABB<N>
Auto Trait Implementations§
impl<N> Freeze for AABB<N>where
N: Freeze,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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
.Source§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
.Source§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.Source§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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moreSource§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).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.