pub struct Aabb2 {
pub min: Vec2,
pub max: Vec2,
}Expand description
Axis-aligned 2D box, also used for UI rectangles.
Fields§
§min: Vec2Minimum corner.
max: Vec2Maximum corner.
Implementations§
Source§impl Aabb2
impl Aabb2
Sourcepub fn from_center(center: Vec2, size: Vec2) -> Self
pub fn from_center(center: Vec2, size: Vec2) -> Self
Constructs a box from its center and nonnegative full dimensions. Panics for negative or nonfinite sizes/centers.
Sourcepub fn intersects(&self, other: &Self) -> bool
pub fn intersects(&self, other: &Self) -> bool
Whether boxes overlap with positive volume. Touching is not overlap.
Source§impl Aabb2
impl Aabb2
Sourcepub fn overlap(&self, other: &Self) -> Option<Penetration2D>
pub fn overlap(&self, other: &Self) -> Option<Penetration2D>
Positive overlap; normal moves this box away from the other box. Empty or flat boxes have no positive overlap.
Sourcepub fn overlap_circle(&self, other: &Circle) -> Option<Penetration2D>
pub fn overlap_circle(&self, other: &Circle) -> Option<Penetration2D>
Positive overlap; normal moves this box away from the circle. Empty or flat boxes have no positive 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 UnsafeUnpin 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