pub struct BoundingBox<S: 'static + Debug + Copy + PartialEq, const D: usize> {
pub min: Point<S, D>,
pub max: Point<S, D>,
}Expand description
3D Bounding Box - defined by two diagonally opposing points.
Fields§
§min: Point<S, D>X-Y-Z-Minimum corner of the box.
max: Point<S, D>X-Y-Z-Maximum corner of the box.
Implementations§
Source§impl<S: Float + Debug + RealField, const D: usize> BoundingBox<S, D>
impl<S: Float + Debug + RealField, const D: usize> BoundingBox<S, D>
Sourcepub fn neg_infinity() -> Self
pub fn neg_infinity() -> Self
Returns a negatively infinte sized box.
Sourcepub fn new(a: &Point<S, D>, b: &Point<S, D>) -> Self
pub fn new(a: &Point<S, D>, b: &Point<S, D>) -> Self
Create a new Bounding Box by supplying two points.
Sourcepub fn intersection(&self, other: &Self) -> Self
pub fn intersection(&self, other: &Self) -> Self
Create a CSG Intersection of two Bounding Boxes.
Sourcepub fn get_corners(&self) -> Vec<Point<S, D>> ⓘ
pub fn get_corners(&self) -> Vec<Point<S, D>> ⓘ
Get the corners of the Bounding Box
Warning: bounding box of dimension D has 2^D corners
Sourcepub fn dilate(&mut self, d: S) -> &mut Self
pub fn dilate(&mut self, d: S) -> &mut Self
Dilate a Bounding Box by some amount in all directions.
Sourcepub fn insert(&mut self, o: &Point<S, D>) -> &mut Self
pub fn insert(&mut self, o: &Point<S, D>) -> &mut Self
Add a Point to a Bounding Box, e.g. expand the Bounding Box to contain that point.
Trait Implementations§
Source§impl<T, const D: usize> AbsDiffEq for BoundingBox<T, D>
impl<T, const D: usize> AbsDiffEq for BoundingBox<T, D>
Source§fn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
The default tolerance to use when testing values that are close together. Read more
Source§fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
A test for equality that uses the absolute difference to compute the approximate
equality of two numbers.
Source§fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
The inverse of
AbsDiffEq::abs_diff_eq.Source§impl<S: Clone + 'static + Debug + Copy + PartialEq, const D: usize> Clone for BoundingBox<S, D>
impl<S: Clone + 'static + Debug + Copy + PartialEq, const D: usize> Clone for BoundingBox<S, D>
Source§fn clone(&self) -> BoundingBox<S, D>
fn clone(&self) -> BoundingBox<S, D>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<S: Debug + 'static + Debug + Copy + PartialEq, const D: usize> Debug for BoundingBox<S, D>
impl<S: Debug + 'static + Debug + Copy + PartialEq, const D: usize> Debug for BoundingBox<S, D>
Source§impl<S: Float + RealField, T: AsRef<[Point<S, D>]>, const D: usize> From<T> for BoundingBox<S, D>
impl<S: Float + RealField, T: AsRef<[Point<S, D>]>, const D: usize> From<T> for BoundingBox<S, D>
Source§impl<S: PartialEq + 'static + Debug + Copy + PartialEq, const D: usize> PartialEq for BoundingBox<S, D>
impl<S: PartialEq + 'static + Debug + Copy + PartialEq, const D: usize> PartialEq for BoundingBox<S, D>
Source§impl<T, const D: usize> RelativeEq for BoundingBox<T, D>
impl<T, const D: usize> RelativeEq for BoundingBox<T, D>
Source§fn default_max_relative() -> <T as AbsDiffEq>::Epsilon
fn default_max_relative() -> <T as AbsDiffEq>::Epsilon
The default relative tolerance for testing values that are far-apart. Read more
Source§fn relative_eq(
&self,
other: &Self,
epsilon: <T as AbsDiffEq>::Epsilon,
max_relative: <T as AbsDiffEq>::Epsilon,
) -> bool
fn relative_eq( &self, other: &Self, epsilon: <T as AbsDiffEq>::Epsilon, max_relative: <T as AbsDiffEq>::Epsilon, ) -> bool
A test for equality that uses a relative comparison if the values are far apart.
Source§fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon,
) -> bool
fn relative_ne( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool
The inverse of
RelativeEq::relative_eq.impl<S: 'static + Debug + Copy + PartialEq, const D: usize> StructuralPartialEq for BoundingBox<S, D>
Auto Trait Implementations§
impl<S, const D: usize> Freeze for BoundingBox<S, D>where
S: Freeze,
impl<S, const D: usize> RefUnwindSafe for BoundingBox<S, D>where
S: RefUnwindSafe,
impl<S, const D: usize> Send for BoundingBox<S, D>where
S: Send,
impl<S, const D: usize> Sync for BoundingBox<S, D>where
S: Sync,
impl<S, const D: usize> Unpin for BoundingBox<S, D>where
S: Unpin,
impl<S, const D: usize> UnsafeUnpin for BoundingBox<S, D>where
S: UnsafeUnpin,
impl<S, const D: usize> UnwindSafe for BoundingBox<S, D>where
S: UnwindSafe,
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.