Skip to main content

Aabb3D

Struct Aabb3D 

Source
pub struct Aabb3D { /* private fields */ }
Expand description

Axis-aligned 3D bounding box used for frustum culling, chunk streaming, and BVH acceleration.

Implementations§

Source§

impl Aabb3D

Bounding-box union, centroid, surface area, and ray-slab intersection for Aabb3D.

Source

pub const fn empty() -> Self

Creates an inverted empty AABB ready to accumulate points via expand_point.

§Returns
  • Self - Empty AABB.
Source

pub fn expand_point(&mut self, point: Vec3)

Expands this bounding box to include point.

§Arguments
  • &Self - Mutable AABB.
  • Vec3 - Point to enclose.
Source

pub fn expand_box(&mut self, other: Self)

Expands this bounding box to include other.

§Arguments
  • &Self - Mutable AABB.
  • Self - Other bounding box.
Source

pub fn center(&self) -> Vec3

Returns the geometric center of the AABB.

§Arguments
  • &Self - AABB reference.
§Returns
  • Vec3 - Box centroid.
Source

pub fn radius(&self) -> f32

Computes bounding-sphere radius enclosing this box.

§Arguments
  • &Self - AABB reference.
§Returns
  • f32 - Enclosing radius.
Source

pub fn surface_area(&self) -> f32

Computes half surface area (dx*dy + dy*dz + dz*dx) for Surface Area Heuristic (SAH) BVH splits.

§Arguments
  • &Self - AABB reference.
§Returns
  • f32 - Non-negative half surface area.
Source

pub fn intersect_ray_near( &self, origin: Vec3, inv_dir: Vec3, t_min: f32, t_max: f32, ) -> f32

Branchless slab Ray-AABB intersection returning entry distance tmin or f32::INFINITY on miss.

§Arguments
  • &Self - AABB 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, or f32::INFINITY if missed.
Source

pub fn intersects_ray(&self, ray: &Ray3D, t_min: f32, t_max: f32) -> bool

Branchless slab Ray-AABB intersection returning true when ray hits within [t_min, t_max].

§Arguments
  • &Self - AABB reference.
  • &Ray3D - Ray with precomputed inverse direction.
  • f32 - Minimum valid distance.
  • f32 - Maximum valid distance.
§Returns
  • bool - Whether the ray intersects this box.
Source§

impl Aabb3D

Source

pub fn get_min(&self) -> Vec3

Source

pub fn get_mut_min(&mut self) -> &mut Vec3

Source

pub fn set_min(&mut self, val: Vec3) -> &mut Self

Source

pub fn get_max(&self) -> Vec3

Source

pub fn get_mut_max(&mut self) -> &mut Vec3

Source

pub fn set_max(&mut self, val: Vec3) -> &mut Self

Source§

impl Aabb3D

Source

pub fn new(min: Vec3, max: Vec3) -> Self

Trait Implementations§

Source§

impl Clone for Aabb3D

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Aabb3D

Source§

impl Debug for Aabb3D

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Aabb3D

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Aabb3D

Auto Trait Implementations§

§

impl Forget for Aabb3D

§

impl Freeze for Aabb3D

§

impl Move for Aabb3D

§

impl RefUnwindSafe for Aabb3D

§

impl Send for Aabb3D

§

impl Sync for Aabb3D

§

impl Unpin for Aabb3D

§

impl UnsafeUnpin for Aabb3D

§

impl UnwindSafe for Aabb3D

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.