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 ensure_size(&mut self, min_size: Vector3<f32>)
pub fn ensure_size(&mut self, min_size: Vector3<f32>)
Expands the bounding box to be at least the given size, keeping the center the same.
Sourcepub fn intersection(
self,
other: AxisAlignedBoundingBox,
) -> AxisAlignedBoundingBox
pub fn intersection( self, other: AxisAlignedBoundingBox, ) -> AxisAlignedBoundingBox
Returns the intersection between this and the other given bounding box.
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.
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.
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.
Sourcepub fn transformed(self, transformation: Matrix4<f32>) -> AxisAlignedBoundingBox
pub fn transformed(self, transformation: Matrix4<f32>) -> AxisAlignedBoundingBox
Returns the bounding box transformed by the given transformation.
Sourcepub fn contains(&self, aabb: AxisAlignedBoundingBox) -> bool
pub fn contains(&self, aabb: AxisAlignedBoundingBox) -> bool
Returns true if the given bounding box is fully inside this bounding box.
Sourcepub fn is_inside(&self, position: Vector3<f32>) -> bool
pub fn is_inside(&self, position: Vector3<f32>) -> bool
Returns true if the given position is inside this 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