pub struct Aabb {
pub min: [f32; 3],
pub max: [f32; 3],
}Expand description
Axis-aligned bounding box in mesh-local coordinates.
Aabb::EMPTY (min = +∞, max = −∞) contains nothing and overlaps nothing.
Non-finite coordinates are tolerated: f32::min/max ignore NaN, so a NaN
coordinate never widens a box.
Fields§
§min: [f32; 3]§max: [f32; 3]Implementations§
Source§impl Aabb
impl Aabb
pub const EMPTY: Aabb
pub fn new(min: [f32; 3], max: [f32; 3]) -> Self
Sourcepub fn of_triangle(positions: &[[f32; 3]], tri: [u32; 3]) -> Self
pub fn of_triangle(positions: &[[f32; 3]], tri: [u32; 3]) -> Self
Box of one triangle, given slot-aligned positions.
pub fn grow_point(&mut self, p: [f32; 3])
pub fn grow(&mut self, other: &Aabb)
pub fn union(self, other: &Aabb) -> Aabb
Sourcepub fn contains(&self, other: &Aabb) -> bool
pub fn contains(&self, other: &Aabb) -> bool
True when other lies inside this box. An empty other is always contained.
Sourcepub fn overlaps(&self, other: &Aabb) -> bool
pub fn overlaps(&self, other: &Aabb) -> bool
True when the boxes share at least one point (touching counts).
Sourcepub fn surface_area(&self) -> f32
pub fn surface_area(&self) -> f32
Surface area; 0 for an empty box.
Trait Implementations§
impl Copy for Aabb
impl StructuralPartialEq for Aabb
Auto Trait Implementations§
impl Freeze for Aabb
impl RefUnwindSafe for Aabb
impl Send for Aabb
impl Sync for Aabb
impl Unpin for Aabb
impl UnsafeUnpin for Aabb
impl UnwindSafe for Aabb
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