pub struct BBox3D {
pub min_x: f64,
pub min_y: f64,
pub min_z: f64,
pub max_x: f64,
pub max_y: f64,
pub max_z: f64,
}Expand description
A 3-dimensional axis-aligned bounding box.
Fields§
§min_x: f64Minimum X.
min_y: f64Minimum Y.
min_z: f64Minimum Z.
max_x: f64Maximum X.
max_y: f64Maximum Y.
max_z: f64Maximum Z.
Implementations§
Source§impl BBox3D
impl BBox3D
Sourcepub const fn new(
min_x: f64,
min_y: f64,
min_z: f64,
max_x: f64,
max_y: f64,
max_z: f64,
) -> Self
pub const fn new( min_x: f64, min_y: f64, min_z: f64, max_x: f64, max_y: f64, max_z: f64, ) -> Self
Creates a new BBox3D.
Sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Returns true if the bounding box is geometrically valid (min <= max on all axes).
Sourcepub fn contains_point(&self, p: &Point3D) -> bool
pub fn contains_point(&self, p: &Point3D) -> bool
Returns true if the 3D point lies inside (or on the boundary of) this box.
Sourcepub fn intersects(&self, other: &BBox3D) -> bool
pub fn intersects(&self, other: &BBox3D) -> bool
Returns true if this bounding box overlaps with another in all three dimensions.
Sourcepub fn union(&self, other: &BBox3D) -> BBox3D
pub fn union(&self, other: &BBox3D) -> BBox3D
Computes the smallest bounding box containing both boxes.
Sourcepub fn volume(&self) -> f64
pub fn volume(&self) -> f64
Computes the volume of the bounding box.
Returns 0.0 if any dimension has negative extent.
Sourcepub fn expand(&self, amount: f64) -> BBox3D
pub fn expand(&self, amount: f64) -> BBox3D
Returns an expanded bounding box — each face is pushed outward by amount.
If amount is negative, the box shrinks (but is not validated).
Sourcepub fn surface_area(&self) -> f64
pub fn surface_area(&self) -> f64
Returns the surface area of the bounding box (sum of all 6 face areas).
Returns 0.0 if any dimension has negative extent.