pub struct Aabb2 {
pub min: DVec2,
pub max: DVec2,
}Expand description
Axis-aligned two-dimensional bounding box.
The XY-plane counterpart of Aabb, with the same empty-absorbs-first
behaviour so a fold over points needs no special case for the first one.
Fields§
§min: DVec2Minimum corner.
max: DVec2Maximum corner.
Implementations§
Source§impl Aabb2
impl Aabb2
Sourcepub const fn empty() -> Aabb2
pub const fn empty() -> Aabb2
An empty box that absorbs the first extended point.
Inverted on purpose: min starts at positive infinity and max at
negative infinity, so the first extend overwrites both rather than
leaving a spurious box around the origin.
Sourcepub const fn from_point(point: DVec2) -> Aabb2
pub const fn from_point(point: DVec2) -> Aabb2
Construct a non-empty box containing exactly one point.
Sourcepub fn intersects(&self, other: &Aabb2) -> bool
pub fn intersects(&self, other: &Aabb2) -> bool
Whether the boxes overlap. Touching counts as overlap.
Trait Implementations§
impl Copy for Aabb2
impl StructuralPartialEq for Aabb2
Auto Trait Implementations§
impl Freeze for Aabb2
impl RefUnwindSafe for Aabb2
impl Send for Aabb2
impl Sync for Aabb2
impl Unpin for Aabb2
impl UnwindSafe for Aabb2
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 more