pub struct Aabb3 {
pub min: V3,
pub max: V3,
}Expand description
A closed axis-aligned box. Aabb3::EMPTY (+INF/-INF) is the identity
of Aabb3::extend and Aabb3::union; it is not well-formed, so nothing
publishes it by accident (see Aabb3::is_well_formed).
Fields§
§min: V3§max: V3Implementations§
Source§impl Aabb3
impl Aabb3
Sourcepub fn from_points(points: impl IntoIterator<Item = V3>) -> Aabb3
pub fn from_points(points: impl IntoIterator<Item = V3>) -> Aabb3
The box of points (Aabb3::EMPTY for none).
Sourcepub fn from_f32_positions(positions: &[f32]) -> Aabb3
pub fn from_f32_positions(positions: &[f32]) -> Aabb3
The box of a flat x, y, z, ... f32 position buffer, widened exactly to
f64. Only complete triplets count; a 1-2 float tail is ignored.
Sourcepub fn extend(&mut self, p: V3)
pub fn extend(&mut self, p: V3)
Grow to include p.
Uses f64::min/f64::max, which return the non-NaN operand: a NaN
coordinate is skipped rather than poisoning the box. That is the
behaviour of every fold this replaces. It also means axes can diverge (one
axis left at its sentinel while its neighbours hold real bounds), which is
why publishing a box goes through Aabb3::is_well_formed.
Sourcepub fn union(&self, other: &Aabb3) -> Aabb3
pub fn union(&self, other: &Aabb3) -> Aabb3
The smallest box holding both (NaN skipped, as in Aabb3::extend).
Sourcepub fn overlaps(&self, other: &Aabb3) -> bool
pub fn overlaps(&self, other: &Aabb3) -> bool
Closed overlap: boxes that merely touch overlap. An Aabb3::EMPTY box
overlaps nothing.
Sourcepub fn is_well_formed(&self) -> bool
pub fn is_well_formed(&self) -> bool
Every axis finite and min <= max.
All three axes are tested, not just one: because Aabb3::extend drops
NaN, a position buffer carrying NaN on one axis and finite values on the
others leaves that axis at its INFINITY..NEG_INFINITY sentinel while its
neighbours hold real bounds. Testing only axis 0 would then publish
[x0, inf, z0, x1, -inf, z1] as a measured box, which downstream
differences turn into NaN. This also covers “no point was ever seen”.
Sourcepub fn from_array6(a: [f64; 6]) -> Aabb3
pub fn from_array6(a: [f64; 6]) -> Aabb3
Inverse of Aabb3::to_array6; performs no validation.
Trait Implementations§
impl Copy for Aabb3
impl StructuralPartialEq for Aabb3
Auto Trait Implementations§
impl Freeze for Aabb3
impl RefUnwindSafe for Aabb3
impl Send for Aabb3
impl Sync for Aabb3
impl Unpin for Aabb3
impl UnwindSafe for Aabb3
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read moreSource§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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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 more§impl<T> Pointable for T
impl<T> Pointable 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>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.