pub struct Aabb { /* private fields */ }Expand description
Finite axis-aligned closed box. Degenerate extents (planes/points) are allowed.
Implementations§
Source§impl Aabb
impl Aabb
Sourcepub fn new(min: Vec3, max: Vec3) -> Option<Self>
pub fn new(min: Vec3, max: Vec3) -> Option<Self>
Creates ordered bounds; inverted or non-finite extents return None.
Sourcepub fn from_points(points: impl IntoIterator<Item = Vec3>) -> Option<Self>
pub fn from_points(points: impl IntoIterator<Item = Vec3>) -> Option<Self>
Builds bounds around at least one finite point; any invalid point rejects the set.
Sourcepub fn center(self) -> Vec3
pub fn center(self) -> Vec3
Midpoint, computed without summing potentially large same-sign endpoints.
Sourcepub fn half_extents(self) -> Vec3
pub fn half_extents(self) -> Vec3
Half of the per-axis extents.
Sourcepub fn contains(self, point: Vec3) -> bool
pub fn contains(self, point: Vec3) -> bool
Whether a finite point lies inside or on the boundary.
Sourcepub fn intersects(self, other: Self) -> bool
pub fn intersects(self, other: Self) -> bool
Whether two closed boxes overlap or touch.
Sourcepub fn closest_point(self, point: Vec3) -> Vec3
pub fn closest_point(self, point: Vec3) -> Vec3
Closest point in/on the box; the caller must supply a finite point.
Sourcepub fn expanded(self, margin: f32) -> Option<Self>
pub fn expanded(self, margin: f32) -> Option<Self>
Expands every face by a non-negative finite margin; overflow returns None.
Sourcepub fn corners(self) -> [Vec3; 8]
pub fn corners(self) -> [Vec3; 8]
Eight corners in bit order: bit 0 selects max X, bit 1 max Y, bit 2 max Z.
Sourcepub fn transformed(self, matrix: Mat4) -> Option<Self>
pub fn transformed(self, matrix: Mat4) -> Option<Self>
Axis-aligned envelope after a finite affine transformation, including mirrors/shear.
Trait Implementations§
impl Copy for Aabb
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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreimpl<T> MaybeSync for T
impl<T> Scalar for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.