[−][src]Struct rstar::primitives::Rectangle
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]
P: Point,
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]
P: Point,
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]
P: Point,
impl<P: Copy> Copy for Rectangle<P> where
P: Point,
[src]
P: Point,
impl<P: Debug> Debug for Rectangle<P> where
P: Point,
[src]
P: Point,
impl<P: Eq> Eq for Rectangle<P> where
P: Point,
[src]
P: Point,
impl<P> From<AABB<P>> for Rectangle<P> where
P: Point,
[src]
P: Point,
impl<P: Ord> Ord for Rectangle<P> where
P: Point,
[src]
P: Point,
fn cmp(&self, other: &Rectangle<P>) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<P: PartialEq> PartialEq<Rectangle<P>> for Rectangle<P> where
P: Point,
[src]
P: Point,
impl<P: PartialOrd> PartialOrd<Rectangle<P>> for Rectangle<P> where
P: Point,
[src]
P: Point,
fn partial_cmp(&self, other: &Rectangle<P>) -> Option<Ordering>
[src]
fn lt(&self, other: &Rectangle<P>) -> bool
[src]
fn le(&self, other: &Rectangle<P>) -> bool
[src]
fn gt(&self, other: &Rectangle<P>) -> bool
[src]
fn ge(&self, other: &Rectangle<P>) -> bool
[src]
impl<P> PointDistance for Rectangle<P> where
P: Point,
[src]
P: Point,
fn distance_2(
&self,
point: &<Self::Envelope as Envelope>::Point
) -> <<Self::Envelope as Envelope>::Point as Point>::Scalar
[src]
&self,
point: &<Self::Envelope as Envelope>::Point
) -> <<Self::Envelope as Envelope>::Point as Point>::Scalar
fn contains_point(&self, point: &<Self::Envelope as Envelope>::Point) -> bool
[src]
fn distance_2_if_less_or_equal(
&self,
point: &<Self::Envelope as Envelope>::Point,
max_distance_2: <<Self::Envelope as Envelope>::Point as Point>::Scalar
) -> Option<<<Self::Envelope as Envelope>::Point as Point>::Scalar>
[src]
&self,
point: &<Self::Envelope as Envelope>::Point,
max_distance_2: <<Self::Envelope as Envelope>::Point as Point>::Scalar
) -> Option<<<Self::Envelope as Envelope>::Point as Point>::Scalar>
impl<P> RTreeObject for Rectangle<P> where
P: Point,
[src]
P: Point,
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
fn envelope(&self) -> Self::Envelope
[src]
impl<P> StructuralEq for Rectangle<P> where
P: Point,
[src]
P: Point,
impl<P> StructuralPartialEq for Rectangle<P> where
P: Point,
[src]
P: Point,
Auto Trait Implementations
impl<P> RefUnwindSafe for Rectangle<P> where
P: RefUnwindSafe,
P: RefUnwindSafe,
impl<P> Send for Rectangle<P> where
P: Send,
P: Send,
impl<P> Sync for Rectangle<P> where
P: Sync,
P: Sync,
impl<P> Unpin for Rectangle<P> where
P: Unpin,
P: Unpin,
impl<P> UnwindSafe for Rectangle<P> where
P: UnwindSafe,
P: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,