pub struct AABB<P>where
P: Point,{ /* private fields */ }Expand description
Axis-aligned bounding box for spatial queries. An n-dimensional axis aligned bounding box (AABB).
An object’s AABB is the smallest box totally encompassing an object while being aligned to the current coordinate system. Although these structures are commonly called bounding boxes, they exist in any dimension.
Note that AABBs cannot be inserted into r-trees. Use the Rectangle struct for this purpose.
§Type arguments
P: The struct is generic over which point type is used. Using an n-dimensional point
type will result in an n-dimensional bounding box.
Implementations§
Source§impl<P> AABB<P>where
P: Point,
impl<P> AABB<P>where
P: Point,
Sourcepub fn from_point(p: P) -> AABB<P>
pub fn from_point(p: P) -> AABB<P>
Returns the AABB encompassing a single point.
Sourcepub fn lower(&self) -> P
pub fn lower(&self) -> P
Returns the AABB’s lower corner.
This is the point contained within the AABB with the smallest coordinate value in each dimension.
Sourcepub fn upper(&self) -> P
pub fn upper(&self) -> P
Returns the AABB’s upper corner.
This is the point contained within the AABB with the largest coordinate value in each dimension.
Sourcepub fn from_corners(p1: P, p2: P) -> AABB<P>
pub fn from_corners(p1: P, p2: P) -> AABB<P>
Creates a new AABB encompassing two points.
Sourcepub fn from_points<'a, I>(i: I) -> AABB<P>where
I: IntoIterator<Item = &'a P> + 'a,
P: 'a,
pub fn from_points<'a, I>(i: I) -> AABB<P>where
I: IntoIterator<Item = &'a P> + 'a,
P: 'a,
Creates a new AABB encompassing a collection of points.
Trait Implementations§
Source§impl<P> Envelope for AABB<P>where
P: Point,
impl<P> Envelope for AABB<P>where
P: Point,
Source§fn contains_point(&self, point: &P) -> bool
fn contains_point(&self, point: &P) -> bool
Source§fn contains_envelope(&self, other: &AABB<P>) -> bool
fn contains_envelope(&self, other: &AABB<P>) -> bool
self.Source§fn merged(&self, other: &AABB<P>) -> AABB<P>
fn merged(&self, other: &AABB<P>) -> AABB<P>
self and another envelope.Source§fn intersects(&self, other: &AABB<P>) -> bool
fn intersects(&self, other: &AABB<P>) -> bool
self and other intersect. The intersection might be
of zero area (the two envelopes only touching each other).Source§fn distance_2(&self, point: &P) -> <P as Point>::Scalar
fn distance_2(&self, point: &P) -> <P as Point>::Scalar
Source§fn min_max_dist_2(&self, point: &P) -> <P as Point>::Scalar
fn min_max_dist_2(&self, point: &P) -> <P as Point>::Scalar
Source§fn intersection_area(
&self,
other: &AABB<P>,
) -> <<AABB<P> as Envelope>::Point as Point>::Scalar
fn intersection_area( &self, other: &AABB<P>, ) -> <<AABB<P> as Envelope>::Point as Point>::Scalar
self and another envelope.Source§fn perimeter_value(&self) -> <P as Point>::Scalar
fn perimeter_value(&self) -> <P as Point>::Scalar
Source§fn sort_envelopes<T>(axis: usize, envelopes: &mut [T])where
T: RTreeObject<Envelope = AABB<P>>,
fn sort_envelopes<T>(axis: usize, envelopes: &mut [T])where
T: RTreeObject<Envelope = AABB<P>>,
Source§fn partition_envelopes<T>(
axis: usize,
envelopes: &mut [T],
selection_size: usize,
)where
T: RTreeObject<Envelope = AABB<P>>,
fn partition_envelopes<T>(
axis: usize,
envelopes: &mut [T],
selection_size: usize,
)where
T: RTreeObject<Envelope = AABB<P>>,
Source§impl<P> Ord for AABB<P>
impl<P> Ord for AABB<P>
Source§impl<P> PartialOrd for AABB<P>where
P: PartialOrd + Point,
impl<P> PartialOrd for AABB<P>where
P: PartialOrd + Point,
impl<P> Copy for AABB<P>
impl<P> Eq for AABB<P>
impl<P> StructuralPartialEq for AABB<P>where
P: Point,
Auto Trait Implementations§
impl<P> Freeze for AABB<P>where
P: Freeze,
impl<P> RefUnwindSafe for AABB<P>where
P: RefUnwindSafe,
impl<P> Send for AABB<P>where
P: Send,
impl<P> Sync for AABB<P>where
P: Sync,
impl<P> Unpin for AABB<P>where
P: Unpin,
impl<P> UnwindSafe for AABB<P>where
P: 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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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