[][src]Struct rstar::primitives::Rectangle

pub struct Rectangle<P> where
    P: Point
{ /* fields omitted */ }

An n-dimensional rectangle defined by its two corners.

This rectangle can be directly inserted into an r-tree.

Note: Despite being called rectangle, this struct can be used with more than two dimensions by using an appropriate point type.

Type parameters

P: The rectangle's Point type.

Implementations

impl<P> Rectangle<P> where
    P: Point
[src]

pub fn from_corners(corner_1: P, corner_2: P) -> Self[src]

Creates a new rectangle defined by two corners.

pub fn from_aabb(aabb: AABB<P>) -> Self[src]

Creates a new rectangle defined by it's axis aligned bounding box.

pub fn lower(&self) -> P[src]

Returns the rectangle's lower corner.

This is the point contained within the rectangle with the smallest coordinate value in each dimension.

pub fn upper(&self) -> P[src]

Returns the rectangle's upper corner.

This is the point contained within the AABB with the largest coordinate value in each dimension.

impl<P> Rectangle<P> where
    P: Point
[src]

pub fn nearest_point(&self, query_point: &P) -> P[src]

Returns the nearest point within this rectangle to a given point.

If query_point is contained within this rectangle, query_point is returned.

Trait Implementations

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

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

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

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

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

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

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

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

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

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

type Envelope = AABB<P>

The object's envelope type. Usually, AABB will be the right choice. This type also defines the objects dimensionality. Read more

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

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

Auto Trait Implementations

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

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

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

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

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

Blanket Implementations

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

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

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

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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

type Owned = T

The resulting type after obtaining ownership.

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.