pub struct AABB2D<S> {
pub min_x: S,
pub min_y: S,
pub max_x: S,
pub max_y: S,
}Expand description
Axis-aligned bounding box in 2D.
Fields§
§min_x: SMinimum x coordinate.
min_y: SMinimum y coordinate.
max_x: SMaximum x coordinate.
max_y: SMaximum y coordinate.
Implementations§
Source§impl<S> AABB2D<S>
impl<S> AABB2D<S>
Sourcepub fn new(min_x: S, min_y: S, max_x: S, max_y: S) -> AABB2D<S>
pub fn new(min_x: S, min_y: S, max_x: S, max_y: S) -> AABB2D<S>
Creates a new AABB from min/max coordinates.
Sourcepub fn from_points(points: &[(S, S)]) -> Option<AABB2D<S>>
pub fn from_points(points: &[(S, S)]) -> Option<AABB2D<S>>
Creates an AABB from a set of points.
Sourcepub fn contains_point(&self, x: S, y: S) -> bool
pub fn contains_point(&self, x: S, y: S) -> bool
Checks if this AABB contains a point.
Sourcepub fn intersects(&self, other: &AABB2D<S>) -> bool
pub fn intersects(&self, other: &AABB2D<S>) -> bool
Checks if this AABB intersects another AABB.
Sourcepub fn intersection(&self, other: &AABB2D<S>) -> Option<AABB2D<S>>
pub fn intersection(&self, other: &AABB2D<S>) -> Option<AABB2D<S>>
Returns the intersection of two AABBs, if any.
Trait Implementations§
impl<S> Copy for AABB2D<S>where
S: Copy,
impl<S> StructuralPartialEq for AABB2D<S>
Auto Trait Implementations§
impl<S> Freeze for AABB2D<S>where
S: Freeze,
impl<S> RefUnwindSafe for AABB2D<S>where
S: RefUnwindSafe,
impl<S> Send for AABB2D<S>where
S: Send,
impl<S> Sync for AABB2D<S>where
S: Sync,
impl<S> Unpin for AABB2D<S>where
S: Unpin,
impl<S> UnwindSafe for AABB2D<S>where
S: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.