pub struct AxisAlignedBox3D { /* private fields */ }Expand description
Axis-aligned 3D bounding box used for frustum culling, chunk streaming, and BVH acceleration.
Implementations§
Source§impl AxisAlignedBox3D
Bounding-box union, centroid, surface area, and ray-slab intersection for AxisAlignedBox3D.
impl AxisAlignedBox3D
Bounding-box union, centroid, surface area, and ray-slab intersection for AxisAlignedBox3D.
Sourcepub const fn empty() -> Self
pub const fn empty() -> Self
Creates an inverted empty axis-aligned bounding box ready to accumulate points via expand_point.
§Returns
Self- Empty axis-aligned bounding box.
Sourcepub fn expand_point(&mut self, point: Vec3)
pub fn expand_point(&mut self, point: Vec3)
Expands this bounding box to include point.
§Arguments
&Self- Mutable axis-aligned bounding box.Vec3- Point to enclose.
Sourcepub fn expand_box(&mut self, other: Self)
pub fn expand_box(&mut self, other: Self)
Expands this bounding box to include other.
§Arguments
&Self- Mutable axis-aligned bounding box.Self- Other bounding box.
Sourcepub fn surface_area(&self) -> f32
pub fn surface_area(&self) -> f32
Sourcepub fn intersect_ray_near(
&self,
origin: Vec3,
inv_dir: Vec3,
t_min: f32,
t_max: f32,
) -> f32
pub fn intersect_ray_near( &self, origin: Vec3, inv_dir: Vec3, t_min: f32, t_max: f32, ) -> f32
Branchless slab Ray-axis-aligned bounding box intersection returning entry distance tmin or f32::INFINITY on miss.
§Arguments
&Self- axis-aligned bounding box reference.Vec3- Ray origin.Vec3- Precomputed safe reciprocal ray direction.f32- Minimum valid distance.f32- Maximum valid distance.
§Returns
f32- Near intersection distance if hit, orf32::INFINITYif missed.
Sourcepub fn intersects_ray(&self, ray: &Ray3D, t_min: f32, t_max: f32) -> bool
pub fn intersects_ray(&self, ray: &Ray3D, t_min: f32, t_max: f32) -> bool
Branchless slab Ray-axis-aligned bounding box intersection returning true when ray hits within [t_min, t_max].
§Arguments
&Self- axis-aligned bounding box reference.&Ray3D- Ray with precomputed inverse direction.f32- Minimum valid distance.f32- Maximum valid distance.
§Returns
bool- Whether the ray intersects this box.
Trait Implementations§
Source§impl Clone for AxisAlignedBox3D
impl Clone for AxisAlignedBox3D
impl Copy for AxisAlignedBox3D
Source§impl Debug for AxisAlignedBox3D
impl Debug for AxisAlignedBox3D
Source§impl PartialEq for AxisAlignedBox3D
impl PartialEq for AxisAlignedBox3D
impl StructuralPartialEq for AxisAlignedBox3D
Auto Trait Implementations§
impl Forget for AxisAlignedBox3D
impl Freeze for AxisAlignedBox3D
impl Move for AxisAlignedBox3D
impl RefUnwindSafe for AxisAlignedBox3D
impl Send for AxisAlignedBox3D
impl Sync for AxisAlignedBox3D
impl Unpin for AxisAlignedBox3D
impl UnsafeUnpin for AxisAlignedBox3D
impl UnwindSafe for AxisAlignedBox3D
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