[][src]Struct rstar::AABB

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.

Methods

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]

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]

type Point = P

The envelope's point type.

impl<P: Clone> Clone for AABB<P> where
    P: Point
[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<P: Ord> Ord for AABB<P> where
    P: Point
[src]

fn max(self, other: Self) -> Self1.21.0[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self1.21.0[src]

Compares and returns the minimum of two values. Read more

fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Restrict a value to a certain interval. Read more

impl<P> From<AABB<P>> for Rectangle<P> where
    P: Point
[src]

impl<P: PartialOrd> PartialOrd<AABB<P>> for AABB<P> where
    P: Point
[src]

impl<P: PartialEq> PartialEq<AABB<P>> for AABB<P> where
    P: Point
[src]

impl<P: Copy> Copy for AABB<P> where
    P: Point
[src]

impl<P: Eq> Eq for AABB<P> where
    P: Point
[src]

impl<P: Debug> Debug for AABB<P> where
    P: Point
[src]

Auto Trait Implementations

impl<P> Sync for AABB<P> where
    P: Sync

impl<P> Send for AABB<P> where
    P: Send

impl<P> Unpin for AABB<P> where
    P: Unpin

impl<P> RefUnwindSafe for AABB<P> where
    P: RefUnwindSafe

impl<P> UnwindSafe for AABB<P> where
    P: UnwindSafe

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]