pub struct Aabb {
pub min: [f32; 3],
pub max: [f32; 3],
}Expand description
An axis-aligned bounding box stored as two [f32; 3] corners.
Fields§
§min: [f32; 3]Minimum corner (component-wise).
max: [f32; 3]Maximum corner (component-wise).
Implementations§
Source§impl Aabb
impl Aabb
Sourcepub fn new(min: [f32; 3], max: [f32; 3]) -> Self
pub fn new(min: [f32; 3], max: [f32; 3]) -> Self
Construct an Aabb from explicit min/max corners.
Sourcepub fn intersects(&self, other: &Aabb) -> bool
pub fn intersects(&self, other: &Aabb) -> bool
Returns true if this box overlaps other (touching counts).
Sourcepub fn contains(&self, p: [f32; 3]) -> bool
pub fn contains(&self, p: [f32; 3]) -> bool
Returns true if point p lies inside or on the surface of this box.
Sourcepub fn surface_area(&self) -> f32
pub fn surface_area(&self) -> f32
Surface area of the box (sum of all six face areas).
Trait Implementations§
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
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