#[repr(C)]pub struct Aabb {
pub min: Vec3A,
pub max: Vec3A,
}Expand description
An Axis-Aligned Bounding Box (AABB) represented by its minimum and maximum points.
Fields§
§min: Vec3A§max: Vec3AImplementations§
Source§impl Aabb
impl Aabb
Sourcepub const INVALID: Self
pub const INVALID: Self
An invalid (empty) AABB with min set to the maximum possible value and max set to the minimum possible value.
Sourcepub const LARGEST: Self
pub const LARGEST: Self
An infinite AABB with min set to negative infinity and max set to positive infinity.
Sourcepub const INFINITY: Self
pub const INFINITY: Self
An infinite AABB with min set to negative infinity and max set to positive infinity.
Sourcepub fn new(min: Vec3A, max: Vec3A) -> Self
pub fn new(min: Vec3A, max: Vec3A) -> Self
Creates a new AABB with the given minimum and maximum points.
Sourcepub fn from_point(point: Vec3A) -> Self
pub fn from_point(point: Vec3A) -> Self
Creates a new AABB with both min and max set to the given point.
Sourcepub fn from_points(points: &[Vec3A]) -> Self
pub fn from_points(points: &[Vec3A]) -> Self
Creates an AABB that bounds the given set of points.
Sourcepub fn contains_point(&self, point: Vec3A) -> bool
pub fn contains_point(&self, point: Vec3A) -> bool
Checks if the AABB contains the given point.
Sourcepub fn extend(&mut self, point: Vec3A) -> &mut Self
pub fn extend(&mut self, point: Vec3A) -> &mut Self
Extends the AABB to include the given point.
Sourcepub fn intersection(&self, other: &Self) -> Self
pub fn intersection(&self, other: &Self) -> Self
Returns the intersection of this AABB and another AABB.
The intersection of two AABBs is the overlapping region that is common to both AABBs. If the AABBs do not overlap, the resulting AABB will have min and max values that do not form a valid box (min will not be less than max).
Sourcepub fn center_axis(&self, axis: usize) -> f32
pub fn center_axis(&self, axis: usize) -> f32
Returns the center coordinate of the AABB along a specific axis.
Sourcepub fn largest_axis(&self) -> usize
pub fn largest_axis(&self) -> usize
Returns the index of the largest axis of the AABB.
Sourcepub fn smallest_axis(&self) -> usize
pub fn smallest_axis(&self) -> usize
Returns the index of the smallest axis of the AABB.
Sourcepub fn surface_area(&self) -> f32
pub fn surface_area(&self) -> f32
Returns the surface area of the AABB.
Sourcepub fn intersect_aabb(&self, other: &Aabb) -> bool
pub fn intersect_aabb(&self, other: &Aabb) -> bool
Checks if this AABB intersects with another AABB.
Sourcepub fn intersect_ray(&self, ray: &Ray) -> f32
pub fn intersect_ray(&self, ray: &Ray) -> f32
Checks if this AABB intersects with a ray and returns the distance to the intersection point.
Returns f32::INFINITY if there is no intersection.
Trait Implementations§
impl Copy for Aabb
impl Pod 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 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
Source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self must have the same layout as the specified Bits except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
bits
as &Self.