[−][src]Struct spade::BoundingRect
An axis aligned minimal bounding rectangle.
An axis aligned minimal bounding rectangle is the smallest rectangle that completely
surrounds an object and is aligned along all axes. The vector type V
's dimension
determines if this is a rectangle, a box or a higher dimensional volume.
Methods
impl<V> BoundingRect<V> where
V: PointN,
[src]
V: PointN,
pub fn from_point(point: V) -> BoundingRect<V>
[src]
Creates a bounding rectangle that contains exactly one point.
This will create a bounding rectangle with lower == upper == point
.
pub fn from_points<I>(points: I) -> Self where
I: IntoIterator<Item = V>,
[src]
I: IntoIterator<Item = V>,
pub fn from_corners(corner1: &V, corner2: &V) -> BoundingRect<V>
[src]
Creates a bounding rectangle that contains two points.
pub fn lower(&self) -> V
[src]
Returns the lower corner of the bounding rectangle.
The lower corner has the smaller coordinates.
pub fn upper(&self) -> V
[src]
Returns the upper corner of the bounding rectangle.
The upper corner has the larger coordinates.
pub fn contains_point(&self, point: &V) -> bool
[src]
Checks if a point is contained within the bounding rectangle.
A point lying exactly on the bounding rectangle's border is also contained.
pub fn contains_rect(&self, rect: &BoundingRect<V>) -> bool
[src]
Checks if another bounding rectangle is completley contained withing this rectangle.
A rectangle is contained if and only if all four corner are contained (see contains_point
).
pub fn add_point(&mut self, point: V)
[src]
Enlarges this bounding rectangle to contain a point.
If the point is already contained, nothing will be changed.
Otherwise, this will enlarge self
to be just large enough
to contain the new point.
pub fn add_rect(&mut self, rect: &BoundingRect<V>)
[src]
Enlarges this bounding rectangle to contain a rectangle.
If the rectangle is already contained, nothing will be changed.
Otherwise, this will enlarge self
to be just large enough
to contain the new rectangle.
pub fn area(&self) -> V::Scalar
[src]
Returns the rectangle's area.
pub fn half_margin(&self) -> V::Scalar
[src]
Returns half of the rectangle's margin, thus width + height
.
pub fn center(&self) -> V
[src]
Returns the rectangle's center.
pub fn intersect(&self, other: &BoundingRect<V>) -> BoundingRect<V>
[src]
Returns the intersection of this and another bounding rectangle.
If the rectangles do not intersect, a bounding rectangle with an area and margin of zero is returned.
pub fn intersects(&self, other: &BoundingRect<V>) -> bool
[src]
Returns true if this and another bounding rectangle intersect each other. If the rectangles just "touch" each other at one side, true is returned.
Trait Implementations
impl<V: Clone + PointN> Clone for BoundingRect<V>
[src]
fn clone(&self) -> BoundingRect<V>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<V: Copy + PointN> Copy for BoundingRect<V>
[src]
impl<V: Debug + PointN> Debug for BoundingRect<V>
[src]
impl<V: Eq + PointN> Eq for BoundingRect<V>
[src]
impl<V: Hash + PointN> Hash for BoundingRect<V>
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<V: Ord + PointN> Ord for BoundingRect<V>
[src]
fn cmp(&self, other: &BoundingRect<V>) -> 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<V: PartialEq + PointN> PartialEq<BoundingRect<V>> for BoundingRect<V>
[src]
fn eq(&self, other: &BoundingRect<V>) -> bool
[src]
fn ne(&self, other: &BoundingRect<V>) -> bool
[src]
impl<V: PartialOrd + PointN> PartialOrd<BoundingRect<V>> for BoundingRect<V>
[src]
fn partial_cmp(&self, other: &BoundingRect<V>) -> Option<Ordering>
[src]
fn lt(&self, other: &BoundingRect<V>) -> bool
[src]
fn le(&self, other: &BoundingRect<V>) -> bool
[src]
fn gt(&self, other: &BoundingRect<V>) -> bool
[src]
fn ge(&self, other: &BoundingRect<V>) -> bool
[src]
impl<V> SpatialObject for BoundingRect<V> where
V: PointN,
[src]
V: PointN,
type Point = V
The object's point type.
fn mbr(&self) -> BoundingRect<V>
[src]
fn distance2(&self, point: &Self::Point) -> V::Scalar
[src]
fn contains(&self, point: &Self::Point) -> bool
[src]
impl<V: PointN> StructuralEq for BoundingRect<V>
[src]
impl<V: PointN> StructuralPartialEq for BoundingRect<V>
[src]
Auto Trait Implementations
impl<V> RefUnwindSafe for BoundingRect<V> where
V: RefUnwindSafe,
V: RefUnwindSafe,
impl<V> Send for BoundingRect<V> where
V: Send,
V: Send,
impl<V> Sync for BoundingRect<V> where
V: Sync,
V: Sync,
impl<V> Unpin for BoundingRect<V> where
V: Unpin,
V: Unpin,
impl<V> UnwindSafe for BoundingRect<V> where
V: UnwindSafe,
V: 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> Scalar for T where
T: PartialEq<T> + Copy + Any + Debug,
[src]
T: PartialEq<T> + Copy + Any + Debug,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn is_in_subset(&self) -> bool
unsafe fn to_subset_unchecked(&self) -> SS
fn from_subset(element: &SS) -> SP
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>,