pub struct BoundingBox {
pub min: [f64; 3],
pub max: [f64; 3],
}Expand description
Axis-aligned bounding box (AABB) for 3D geometry.
Fields§
§min: [f64; 3]Minimum corner.
max: [f64; 3]Maximum corner.
Implementations§
Source§impl BoundingBox
impl BoundingBox
Sourcepub fn new(min: [f64; 3], max: [f64; 3]) -> Self
pub fn new(min: [f64; 3], max: [f64; 3]) -> Self
Create a bounding box from min and max corners.
Sourcepub fn include_point(&mut self, p: [f64; 3])
pub fn include_point(&mut self, p: [f64; 3])
Expand the bounding box to include a point.
Sourcepub fn include_box(&mut self, other: &BoundingBox)
pub fn include_box(&mut self, other: &BoundingBox)
Expand to include another bounding box.
Sourcepub fn from_points(points: &[[f64; 3]]) -> Self
pub fn from_points(points: &[[f64; 3]]) -> Self
Compute from a set of points.
Sourcepub fn surface_area(&self) -> f64
pub fn surface_area(&self) -> f64
Get the surface area.
Sourcepub fn contains_point(&self, p: [f64; 3]) -> bool
pub fn contains_point(&self, p: [f64; 3]) -> bool
Check if a point is inside the bounding box.
Sourcepub fn intersects(&self, other: &BoundingBox) -> bool
pub fn intersects(&self, other: &BoundingBox) -> bool
Check if this box intersects another.
Sourcepub fn convert_units(&self, converter: &UnitConverter) -> BoundingBox
pub fn convert_units(&self, converter: &UnitConverter) -> BoundingBox
Apply a unit conversion to the bounding box.
Trait Implementations§
Source§impl Clone for BoundingBox
impl Clone for BoundingBox
Source§fn clone(&self) -> BoundingBox
fn clone(&self) -> BoundingBox
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BoundingBox
impl Debug for BoundingBox
impl Copy for BoundingBox
Auto Trait Implementations§
impl Freeze for BoundingBox
impl RefUnwindSafe for BoundingBox
impl Send for BoundingBox
impl Sync for BoundingBox
impl Unpin for BoundingBox
impl UnsafeUnpin for BoundingBox
impl UnwindSafe for BoundingBox
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.