Struct rstar::AABB [−][src]
pub struct AABB<P> where
P: Point, { /* fields omitted */ }
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
impl<P> AABB<P> where
P: Point,
[src]
impl<P> AABB<P> where
P: Point,
[src]pub fn from_point(p: P) -> Self
[src]
Returns the AABB encompassing a single point.
pub fn lower(&self) -> P
[src]
Returns the AABB’s lower corner.
This is the point contained within the AABB with the smallest coordinate value in each dimension.
pub fn upper(&self) -> P
[src]
Returns the AABB’s upper corner.
This is the point contained within the AABB with the largest coordinate value in each dimension.
pub fn from_corners(p1: P, p2: P) -> Self
[src]
Creates a new AABB encompassing two points.
pub fn from_points<'a, I>(i: I) -> Self where
I: IntoIterator<Item = &'a P> + 'a,
P: 'a,
[src]
I: IntoIterator<Item = &'a P> + 'a,
P: 'a,
Creates a new AABB encompassing a collection of points.
pub fn min_point(&self, point: &P) -> P
[src]
Returns the point within this AABB closest to a given point.
If point
is contained within the AABB, point
will be returned.
pub fn distance_2(&self, point: &P) -> P::Scalar
[src]
Returns the squared distance to the AABB’s min_point.
Trait Implementations
impl<P> Envelope for AABB<P> where
P: Point,
[src]
impl<P> Envelope for AABB<P> where
P: Point,
[src]type Point = P
The envelope’s point type.
fn new_empty() -> Self
[src]
fn contains_point(&self, point: &P) -> bool
[src]
fn contains_envelope(&self, other: &Self) -> bool
[src]
fn merge(&mut self, other: &Self)
[src]
fn merged(&self, other: &Self) -> Self
[src]
fn intersects(&self, other: &Self) -> bool
[src]
fn area(&self) -> P::Scalar
[src]
fn distance_2(&self, point: &P) -> P::Scalar
[src]
fn min_max_dist_2(&self, point: &P) -> <P as Point>::Scalar
[src]
fn center(&self) -> Self::Point
[src]
fn intersection_area(&self, other: &Self) -> <Self::Point as Point>::Scalar
[src]
fn perimeter_value(&self) -> P::Scalar
[src]
fn sort_envelopes<T: RTreeObject<Envelope = Self>>(
axis: usize,
envelopes: &mut [T]
)
[src]
axis: usize,
envelopes: &mut [T]
)
fn partition_envelopes<T: RTreeObject<Envelope = Self>>(
axis: usize,
envelopes: &mut [T],
selection_size: usize
)
[src]
axis: usize,
envelopes: &mut [T],
selection_size: usize
)
impl<P: PartialOrd> PartialOrd<AABB<P>> for AABB<P> where
P: Point,
[src]
impl<P: PartialOrd> PartialOrd<AABB<P>> for AABB<P> where
P: Point,
[src]impl<P> StructuralEq for AABB<P> where
P: Point,
[src]
impl<P> StructuralEq for AABB<P> where
P: Point,
[src]impl<P> StructuralPartialEq for AABB<P> where
P: Point,
[src]
impl<P> StructuralPartialEq for AABB<P> where
P: Point,
[src]Auto Trait Implementations
impl<P> RefUnwindSafe for AABB<P> where
P: RefUnwindSafe,
impl<P> RefUnwindSafe for AABB<P> where
P: RefUnwindSafe,
impl<P> UnwindSafe for AABB<P> where
P: UnwindSafe,
impl<P> UnwindSafe for AABB<P> where
P: UnwindSafe,