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,

source

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 of mins must be smaller than the related components of maxs.
source

pub fn new_invalid() -> AABB<N>

Creates an invalid AABB with mins components set to N::max_values and maxscomponents set to -N::max_values.

This is often used as the initial values of some AABB merging algorithms.

source

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.

source

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.

source

pub fn mins(&self) -> &OPoint<N, Const<2>>

👎Deprecated: use the .mins public field instead.

Reference to the AABB point with the smallest components along each axis.

source

pub fn maxs(&self) -> &OPoint<N, Const<2>>

👎Deprecated: use the .maxs public field instead.

Reference to the AABB point with the biggest components along each axis.

source

pub fn center(&self) -> OPoint<N, Const<2>>

The center of this AABB.

source

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.

source

pub fn extents( &self ) -> Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>

The extents of this AABB.

source

pub fn take_point(&mut self, pt: OPoint<N, Const<2>>)

Enlarges this AABB so it also contains the point pt.

source

pub fn transform_by(&self, m: &Isometry<N, Unit<Complex<N>>, 2>) -> AABB<N>

Computes the AABB bounding self transformed by m.

source

pub fn bounding_sphere(&self) -> BoundingSphere<N>

The smallest bounding sphere containing this AABB.

source

pub fn contains_local_point(&self, point: &OPoint<N, Const<2>>) -> bool

source§

impl<N> AABB<N>where N: RealField + Copy,

source

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.

source

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.

source

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.

source

pub fn clip_ray(&self, ray: &Ray<N>) -> Option<Segment<N>>

Computes the intersection segment between a ray and this AABB.

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>,

§

type Result = PointProjection<N>

The result of a best-first traversal.
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>

Compute the next action to be taken by the best-first-search after visiting a node containing the given bounding volume.
source§

impl<N> BoundingVolume<N> for AABB<N>where N: RealField + Copy,

source§

fn center(&self) -> OPoint<N, Const<2>>

Returns a point inside of this bounding volume. This is ideally its center.
source§

fn intersects(&self, other: &AABB<N>) -> bool

Checks if this bounding volume intersect with another one.
source§

fn contains(&self, other: &AABB<N>) -> bool

Checks if this bounding volume contains another one.
source§

fn merge(&mut self, other: &AABB<N>)

Merges this bounding volume with another one. The merge is done in-place.
source§

fn merged(&self, other: &AABB<N>) -> AABB<N>

Merges this bounding volume with another one.
source§

fn loosen(&mut self, amount: N)

Enlarges this bounding volume.
source§

fn loosened(&self, amount: N) -> AABB<N>

Creates a new, enlarged version, of this bounding volume.
source§

fn tighten(&mut self, amount: N)

Tighten this bounding volume.
source§

fn tightened(&self, amount: N) -> AABB<N>

Creates a new, tightened version, of this bounding volume.
source§

impl<N> Clone for AABB<N>where N: Clone + RealField + Copy,

source§

fn clone(&self) -> AABB<N>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<N> Debug for AABB<N>where N: Debug + RealField + Copy,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

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>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<N> HasBoundingVolume<N, AABB<N>> for Ball<N>where N: RealField + Copy,

source§

fn bounding_volume(&self, m: &Isometry<N, Unit<Complex<N>>, 2>) -> AABB<N>

The bounding volume of self transformed by m.
source§

fn local_bounding_volume(&self) -> AABB<N>

The bounding volume of self.
source§

impl<N> HasBoundingVolume<N, AABB<N>> for Capsule<N>where N: RealField + Copy,

source§

fn bounding_volume(&self, m: &Isometry<N, Unit<Complex<N>>, 2>) -> AABB<N>

The bounding volume of self transformed by m.
source§

fn local_bounding_volume(&self) -> AABB<N>

The bounding volume of self.
source§

impl<N> HasBoundingVolume<N, AABB<N>> for Compound<N>where N: RealField + Copy,

source§

fn bounding_volume(&self, m: &Isometry<N, Unit<Complex<N>>, 2>) -> AABB<N>

The bounding volume of self transformed by m.
source§

fn local_bounding_volume(&self) -> AABB<N>

The bounding volume of self.
source§

impl<N> HasBoundingVolume<N, AABB<N>> for ConvexPolygon<N>where N: RealField + Copy,

source§

fn bounding_volume(&self, m: &Isometry<N, Unit<Complex<N>>, 2>) -> AABB<N>

The bounding volume of self transformed by m.
source§

fn local_bounding_volume(&self) -> AABB<N>

The bounding volume of self.
source§

impl<N> HasBoundingVolume<N, AABB<N>> for Cuboid<N>where N: RealField + Copy,

source§

fn bounding_volume(&self, m: &Isometry<N, Unit<Complex<N>>, 2>) -> AABB<N>

The bounding volume of self transformed by m.
source§

fn local_bounding_volume(&self) -> AABB<N>

The bounding volume of self.
source§

impl<N> HasBoundingVolume<N, AABB<N>> for HeightField<N>where N: RealField + Copy,

source§

fn bounding_volume(&self, m: &Isometry<N, Unit<Complex<N>>, 2>) -> AABB<N>

The bounding volume of self transformed by m.
source§

fn local_bounding_volume(&self) -> AABB<N>

The bounding volume of self.
source§

impl<N> HasBoundingVolume<N, AABB<N>> for Plane<N>where N: RealField + Copy,

source§

fn bounding_volume(&self, _: &Isometry<N, Unit<Complex<N>>, 2>) -> AABB<N>

The bounding volume of self transformed by m.
source§

fn local_bounding_volume(&self) -> AABB<N>

The bounding volume of self.
source§

impl<N> HasBoundingVolume<N, AABB<N>> for Polyline<N>where N: RealField + Copy,

source§

fn bounding_volume(&self, m: &Isometry<N, Unit<Complex<N>>, 2>) -> AABB<N>

The bounding volume of self transformed by m.
source§

fn local_bounding_volume(&self) -> AABB<N>

The bounding volume of self.
source§

impl<N> HasBoundingVolume<N, AABB<N>> for Segment<N>where N: RealField + Copy,

source§

fn bounding_volume(&self, m: &Isometry<N, Unit<Complex<N>>, 2>) -> AABB<N>

The bounding volume of self transformed by m.
source§

fn local_bounding_volume(&self) -> AABB<N>

The bounding volume of self.
source§

impl<N> HasBoundingVolume<N, AABB<N>> for Triangle<N>where N: RealField + Copy,

source§

fn bounding_volume(&self, m: &Isometry<N, Unit<Complex<N>>, 2>) -> AABB<N>

The bounding volume of self transformed by m.
source§

fn local_bounding_volume(&self) -> AABB<N>

The bounding volume of self.
source§

impl<N> HasBoundingVolume<N, AABB<N>> for dyn Shape<N>where N: RealField + Copy,

source§

fn bounding_volume(&self, m: &Isometry<N, Unit<Complex<N>>, 2>) -> AABB<N>

The bounding volume of self transformed by m.
source§

fn local_bounding_volume(&self) -> AABB<N>

The bounding volume of self.
source§

impl<N> PartialEq<AABB<N>> for AABB<N>where N: PartialEq<N> + RealField + Copy,

source§

fn eq(&self, other: &AABB<N>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

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>

Projects a point on 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)

Projects a point on the boundary of self transformed by m and retuns the id of the feature the point was projected on.
source§

fn distance_to_point( &self, m: &Isometry<N, Unit<Complex<N>>, 2>, pt: &OPoint<N, Const<2>>, solid: bool ) -> N

Computes the minimal distance between a point and self transformed by m.
source§

fn contains_point( &self, m: &Isometry<N, Unit<Complex<N>>, 2>, pt: &OPoint<N, Const<2>> ) -> bool

Tests if the given point is inside of self transformed by m.
source§

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>

Computes the time of impact between this transform shape and a ray.
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>>

Computes the time of impact, and normal between this transformed shape and a ray.
source§

fn intersects_ray( &self, m: &Isometry<N, Unit<Complex<N>>, 2>, ray: &Ray<N>, max_toi: N ) -> bool

Tests whether a ray intersects this transformed shape.
source§

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,

Serialize this value into the given Serde serializer. Read more
source§

impl<'a, N, T> SimultaneousVisitor<T, AABB<N>> for AABBSetsInterferencesCollector<'a, N, T>where N: RealField + Copy, T: Clone,

source§

fn visit( &mut self, left_bv: &AABB<N>, left_data: Option<&T>, right_bv: &AABB<N>, right_data: Option<&T> ) -> VisitStatus

Execute an operation on the content of two nodes, one from each structure. Read more
source§

impl<N> Copy for AABB<N>where N: Copy + RealField,

source§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast for Twhere T: Any,

§

fn into_any(self: Box<T, Global>) -> Box<dyn Any, 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.
§

fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>

Convert 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)

Convert &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)

Convert &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 Twhere T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T, Global>) -> Arc<dyn Any + Send + Sync, Global>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
§

impl<T> Finalize for T

§

unsafe fn finalize_raw(data: *mut ())

Safety Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> UserData for Twhere T: Clone + Any + Send + Sync,

source§

fn clone_boxed(&self) -> Box<dyn UserData, Global>

Clone this trait-object.
source§

fn to_any(&self) -> Box<dyn Any + Send + Sync, Global>

Clone as its super-trait trait objects.
source§

fn as_any(&self) -> &(dyn Any + Send + Sync + 'static)

Downcast to Any.
§

impl<T> Component for Twhere T: Send + Sync + 'static,

source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,

source§

impl<T> Scalar for Twhere T: 'static + Clone + PartialEq<T> + Debug,