pub struct AxisAlignedBoundingBox { /* private fields */ }
Expand description
A bounding box that aligns with the x, y and z axes.
Implementations§
Source§impl AxisAlignedBoundingBox
impl AxisAlignedBoundingBox
Sourcepub const EMPTY: AxisAlignedBoundingBox
pub const EMPTY: AxisAlignedBoundingBox
An empty bounding box.
Sourcepub const INFINITE: AxisAlignedBoundingBox
pub const INFINITE: AxisAlignedBoundingBox
An infinitely large bounding box.
Sourcepub fn new_with_positions(positions: &[Vector3<f32>]) -> AxisAlignedBoundingBox
pub fn new_with_positions(positions: &[Vector3<f32>]) -> AxisAlignedBoundingBox
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: &[Vector3<f32>],
transformation: &Matrix4<f32>,
) -> AxisAlignedBoundingBox
pub fn new_with_transformed_positions( positions: &[Vector3<f32>], transformation: &Matrix4<f32>, ) -> AxisAlignedBoundingBox
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: &[Vector3<f32>])
pub fn expand(&mut self, positions: &[Vector3<f32>])
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: &[Vector3<f32>],
transformation: &Matrix4<f32>,
)
pub fn expand_with_transformation( &mut self, positions: &[Vector3<f32>], transformation: &Matrix4<f32>, )
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: &Matrix4<f32>)
pub fn transform(&mut self, transformation: &Matrix4<f32>)
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: &Vector3<f32>) -> f32
pub fn distance(&self, position: &Vector3<f32>) -> f32
The distance from position to the point in this bounding box that is closest to position.
Sourcepub fn distance_max(&self, position: &Vector3<f32>) -> f32
pub fn distance_max(&self, position: &Vector3<f32>) -> f32
The distance from position to the point in this bounding box that is furthest away from position.
Trait Implementations§
Source§impl Clone for AxisAlignedBoundingBox
impl Clone for AxisAlignedBoundingBox
Source§fn clone(&self) -> AxisAlignedBoundingBox
fn clone(&self) -> AxisAlignedBoundingBox
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more