pub struct AABB3 {
pub min: Point3,
pub max: Point3,
}Expand description
Fields§
§min: Point3Minimum corner.
max: Point3Maximum corner.
Implementations§
Source§impl AABB3
impl AABB3
Sourcepub fn new(
min_x: f64,
min_y: f64,
min_z: f64,
max_x: f64,
max_y: f64,
max_z: f64,
) -> Self
pub fn new( min_x: f64, min_y: f64, min_z: f64, max_x: f64, max_y: f64, max_z: f64, ) -> Self
Creates an AABB from min/max coordinates.
Sourcepub fn from_min_size(min: Point3, width: f64, depth: f64, height: f64) -> Self
pub fn from_min_size(min: Point3, width: f64, depth: f64, height: f64) -> Self
Creates an AABB from min corner and dimensions.
Sourcepub fn from_points(points: &[Point3]) -> Option<Self>
pub fn from_points(points: &[Point3]) -> Option<Self>
Sourcepub fn surface_area(&self) -> f64
pub fn surface_area(&self) -> f64
Surface area.
Useful as a BVH splitting heuristic (SAH).
Sourcepub fn contains_point(&self, p: &Point3) -> bool
pub fn contains_point(&self, p: &Point3) -> bool
Whether this AABB contains a point.
Sourcepub fn intersects(&self, other: &Self) -> bool
pub fn intersects(&self, other: &Self) -> bool
Sourcepub fn intersection(&self, other: &Self) -> Option<Self>
pub fn intersection(&self, other: &Self) -> Option<Self>
Returns the intersection of two AABBs, or None if they don’t overlap.
Trait Implementations§
impl Copy for AABB3
impl StructuralPartialEq for AABB3
Auto Trait Implementations§
impl Freeze for AABB3
impl RefUnwindSafe for AABB3
impl Send for AABB3
impl Sync for AABB3
impl Unpin for AABB3
impl UnsafeUnpin for AABB3
impl UnwindSafe for AABB3
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.