pub struct Aabb {
pub min: Vec3,
pub max: Vec3,
}Expand description
Axis-aligned bounding box.
Fields§
§min: Vec3§max: Vec3Implementations§
Source§impl Aabb
impl Aabb
pub fn new(min: Vec3, max: Vec3) -> Self
pub fn empty() -> Self
pub fn from_point(p: Vec3, half: f32) -> Self
pub fn union(&self, other: &Aabb) -> Self
pub fn center(&self) -> Vec3
pub fn extents(&self) -> Vec3
pub fn surface_area(&self) -> f32
pub fn contains_point(&self, p: Vec3) -> bool
pub fn intersects_sphere(&self, center: Vec3, radius: f32) -> bool
pub fn intersects_aabb(&self, other: &Aabb) -> bool
Sourcepub fn ray_intersect(&self, origin: Vec3, dir_inv: Vec3) -> Option<f32>
pub fn ray_intersect(&self, origin: Vec3, dir_inv: Vec3) -> Option<f32>
Ray-AABB intersection (slab method). Returns distance or None.
pub fn longest_axis(&self) -> usize
Trait Implementations§
impl StructuralPartialEq for Aabb
Auto Trait Implementations§
impl Freeze for Aabb
impl RefUnwindSafe for Aabb
impl Send for Aabb
impl Sync for Aabb
impl Unpin for Aabb
impl UnsafeUnpin for Aabb
impl UnwindSafe for Aabb
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.