pub struct AABB { /* private fields */ }
Expand description
An axis-aligned bounding box. Represented by a cuboid defined by two points. As long as the
set_*
functions are used, the lower
point will be less than or equal to the upper
point
for any axis.
Implementations
sourceimpl AABB
impl AABB
sourcepub fn from(lower: Point3<f32>, upper: Point3<f32>) -> AABB
pub fn from(lower: Point3<f32>, upper: Point3<f32>) -> AABB
Constructs a new AABB with the given points. This method does not ensure lower
<= upper
for all axes.
sourcepub fn left(&self) -> f32
pub fn left(&self) -> f32
Returns the x coordinate of the lower point, representing the left side of the AABB.
sourcepub fn right(&self) -> f32
pub fn right(&self) -> f32
Returns the x coordinate of the upper point, representing the right side of the AABB.
sourcepub fn top(&self) -> f32
pub fn top(&self) -> f32
Returns the y coordinate of the lower point, representing the top side of the AABB.
sourcepub fn bottom(&self) -> f32
pub fn bottom(&self) -> f32
Returns the y coordinate of the upper point, representing the bottom side of the AABB.
sourcepub fn front(&self) -> f32
pub fn front(&self) -> f32
Returns the z coordinate of the lower point, representing the front side of the AABB.
sourcepub fn back(&self) -> f32
pub fn back(&self) -> f32
Returns the z coordinate of the upper point, representing the back side of the AABB.
sourcepub fn set_lower(&mut self, lower: Point3<f32>)
pub fn set_lower(&mut self, lower: Point3<f32>)
Updates the lower point. Rearranges the coordinates to assure that lower
<= upper
for
all axes.
sourcepub fn set_upper(&mut self, upper: Point3<f32>)
pub fn set_upper(&mut self, upper: Point3<f32>)
Updates the upper point. Rearranges the coordinates to assure that lower
<= upper
for
all axes.
sourcepub fn set_left(&mut self, left: f32)
pub fn set_left(&mut self, left: f32)
Updates the x coordinate of the lower point (the left side of the AABB). Ensures that
lower
<= upper
for all axes.
sourcepub fn set_right(&mut self, right: f32)
pub fn set_right(&mut self, right: f32)
Updates the x coordinate of the upper point (the right side of the AABB). Ensures that
lower
<= upper
for all axes.
sourcepub fn set_bottom(&mut self, bottom: f32)
pub fn set_bottom(&mut self, bottom: f32)
Updates the y coordinate of the lower point (the bottom side of the AABB). Ensures that
lower
<= upper
for all axes.
sourcepub fn set_top(&mut self, top: f32)
pub fn set_top(&mut self, top: f32)
Updates the y coordinate of the upper point (the top side of the AABB). Ensures that
lower
<= upper
for all axes.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for AABB
impl Send for AABB
impl Sync for AABB
impl Unpin for AABB
impl UnwindSafe for AABB
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