Struct three_d::core::AxisAlignedBoundingBox
source · [−]pub struct AxisAlignedBoundingBox { /* private fields */ }Expand description
A bounding box that aligns with the x, y and z axes.
Implementations
sourceimpl AxisAlignedBoundingBox
impl AxisAlignedBoundingBox
sourcepub const EMPTY: Self = Self {
min: vec3(std::f32::INFINITY, std::f32::INFINITY, std::f32::INFINITY),
max: vec3(
std::f32::NEG_INFINITY,
std::f32::NEG_INFINITY,
std::f32::NEG_INFINITY,
),
}
pub const EMPTY: Self = Self { min: vec3(std::f32::INFINITY, std::f32::INFINITY, std::f32::INFINITY), max: vec3( std::f32::NEG_INFINITY, std::f32::NEG_INFINITY, std::f32::NEG_INFINITY, ), }
An empty bounding box.
sourcepub const INFINITE: Self = Self {
min: vec3(
std::f32::NEG_INFINITY,
std::f32::NEG_INFINITY,
std::f32::NEG_INFINITY,
),
max: vec3(std::f32::INFINITY, std::f32::INFINITY, std::f32::INFINITY),
}
pub const INFINITE: Self = Self { min: vec3( std::f32::NEG_INFINITY, std::f32::NEG_INFINITY, std::f32::NEG_INFINITY, ), max: vec3(std::f32::INFINITY, std::f32::INFINITY, std::f32::INFINITY), }
An infinitely large bounding box.
sourcepub fn new_with_positions(positions: &[Vec3]) -> Self
pub fn new_with_positions(positions: &[Vec3]) -> Self
Constructs a new bounding box and expands it such that all of the given positions are contained inside the bounding box.
sourcepub fn new_with_transformed_positions(
positions: &[Vec3],
transformation: &Mat4
) -> Self
pub fn new_with_transformed_positions(
positions: &[Vec3],
transformation: &Mat4
) -> Self
Constructs a new bounding box and expands it such that all of the given positions transformed with the given transformation are contained inside the bounding box. A position consisting of an x, y and z coordinate corresponds to three consecutive value in the positions array.
sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the bounding box is empty (ie. constructed by AxisAlignedBoundingBox::EMPTY).
sourcepub fn is_infinite(&self) -> bool
pub fn is_infinite(&self) -> bool
Returns true if the bounding box is infinitely large (ie. constructed by AxisAlignedBoundingBox::INFINITE).
sourcepub fn expand(&mut self, positions: &[Vec3])
pub fn expand(&mut self, positions: &[Vec3])
Expands the bounding box such that all of the given positions are contained inside the bounding box. A position consisting of an x, y and z coordinate corresponds to three consecutive value in the positions array.
sourcepub fn expand_with_transformation(
&mut self,
positions: &[Vec3],
transformation: &Mat4
)
pub fn expand_with_transformation(
&mut self,
positions: &[Vec3],
transformation: &Mat4
)
Expands the bounding box such that all of the given positions transformed with the given transformation are contained inside the bounding box. A position consisting of an x, y and z coordinate corresponds to three consecutive value in the positions array.
sourcepub fn expand_with_aabb(&mut self, other: &AxisAlignedBoundingBox)
pub fn expand_with_aabb(&mut self, other: &AxisAlignedBoundingBox)
Expand the bounding box such that it also contains the given other bounding box.
sourcepub fn transform(&mut self, transformation: &Mat4)
pub fn transform(&mut self, transformation: &Mat4)
Transforms the bounding box by the given transformation.
Note: Use new_with_transformed_positions instead of new_with_positions followed by this method to create a more tight bounding box.
sourcepub fn distance(&self, position: &Vec3) -> f32
pub fn distance(&self, position: &Vec3) -> f32
The distance from position to the point in this bounding box that is closest to position.
sourcepub fn distance_max(&self, position: &Vec3) -> f32
pub fn distance_max(&self, position: &Vec3) -> f32
The distance from position to the point in this bounding box that is furthest away from position.
Trait Implementations
sourceimpl Clone for AxisAlignedBoundingBox
impl Clone for AxisAlignedBoundingBox
sourcefn clone(&self) -> AxisAlignedBoundingBox
fn clone(&self) -> AxisAlignedBoundingBox
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for AxisAlignedBoundingBox
impl Debug for AxisAlignedBoundingBox
impl Copy for AxisAlignedBoundingBox
Auto Trait Implementations
impl RefUnwindSafe for AxisAlignedBoundingBox
impl Send for AxisAlignedBoundingBox
impl Sync for AxisAlignedBoundingBox
impl Unpin for AxisAlignedBoundingBox
impl UnwindSafe for AxisAlignedBoundingBox
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more