pub struct AabbGpu {
pub min: [f32; 3],
pub max: [f32; 3],
}Expand description
Axis-aligned bounding box for GPU collision passes.
Corners are stored as [f32; 3] to match typical GPU buffer layouts.
Fields§
§min: [f32; 3]Component-wise minimum corner.
max: [f32; 3]Component-wise maximum corner.
Implementations§
Source§impl AabbGpu
impl AabbGpu
Sourcepub fn new(min: [f32; 3], max: [f32; 3]) -> Self
pub fn new(min: [f32; 3], max: [f32; 3]) -> Self
Construct an AabbGpu from explicit min/max corners.
Sourcepub fn from_point(p: [f32; 3]) -> Self
pub fn from_point(p: [f32; 3]) -> Self
Construct a degenerate AabbGpu that contains exactly one point.
Sourcepub fn merge(&self, other: &AabbGpu) -> AabbGpu
pub fn merge(&self, other: &AabbGpu) -> AabbGpu
Return the smallest AabbGpu that contains both self and other.
Sourcepub fn overlaps(&self, other: &AabbGpu) -> bool
pub fn overlaps(&self, other: &AabbGpu) -> bool
Returns true if this box overlaps other (touching counts as overlap).
Sourcepub fn contains_point(&self, p: [f32; 3]) -> bool
pub fn contains_point(&self, p: [f32; 3]) -> bool
Returns true if the point p lies inside or on the surface.
Sourcepub fn surface_area(&self) -> f32
pub fn surface_area(&self) -> f32
Surface area of the AABB (sum of the six face areas).
Sourcepub fn half_extents(&self) -> [f32; 3]
pub fn half_extents(&self) -> [f32; 3]
Half-extents of the AABB.
Trait Implementations§
impl StructuralPartialEq for AabbGpu
Auto Trait Implementations§
impl Freeze for AabbGpu
impl RefUnwindSafe for AabbGpu
impl Send for AabbGpu
impl Sync for AabbGpu
impl Unpin for AabbGpu
impl UnsafeUnpin for AabbGpu
impl UnwindSafe for AabbGpu
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