pub struct Aabb {
pub min: Vec3,
pub max: Vec3,
}Expand description
An axis-aligned bounding box.
Fields§
§min: Vec3Minimum corner.
max: Vec3Maximum corner.
Implementations§
Source§impl Aabb
impl Aabb
Sourcepub const fn new(min: Vec3, max: Vec3) -> Self
pub const fn new(min: Vec3, max: Vec3) -> Self
Creates an AABB from minimum and maximum corners.
Sourcepub fn from_points(points: &[Vec3]) -> Self
pub fn from_points(points: &[Vec3]) -> Self
Creates the smallest AABB containing all points.
Sourcepub fn half_extents(self) -> Vec3
pub fn half_extents(self) -> Vec3
Returns half the box extents.
Sourcepub fn contains_point(self, point: Vec3) -> bool
pub fn contains_point(self, point: Vec3) -> bool
Returns whether a point is inside or on the boundary.
Sourcepub fn intersects_aabb(self, other: Self) -> bool
pub fn intersects_aabb(self, other: Self) -> bool
Returns whether this box intersects another box.
Sourcepub fn transform(self, matrix: Mat4) -> Self
pub fn transform(self, matrix: Mat4) -> Self
Conservatively transforms the AABB by transforming all eight corners.
Sourcepub fn surface_area(self) -> f32
pub fn surface_area(self) -> f32
Returns the surface area.
Sourcepub fn bounding_sphere(self) -> Sphere
pub fn bounding_sphere(self) -> Sphere
Returns a conservative bounding sphere.
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