pub struct Box3 {
pub origin: DVec3,
pub x: DVec3,
pub y: DVec3,
pub z: DVec3,
}Expand description
An oriented box: the generalization of a rectangle to three dimensions.
Distinct from Aabb, which is axis-aligned and exists for broad-phase
rejection. This one carries its own orientation, so it can bound a rotated
object tightly where an axis-aligned box would not.
The three edge vectors are not required to be mutually perpendicular, for
the same reason Rectangle3 does not require it: a dirty import stays
representable and inspectable.
Fields§
§origin: DVec3Corner the edge vectors start from.
x: DVec3First edge vector, from origin.
y: DVec3Second edge vector, from origin.
z: DVec3Third edge vector, from origin.
Implementations§
Source§impl Box3
impl Box3
Sourcepub const fn new(origin: DVec3, x: DVec3, y: DVec3, z: DVec3) -> Box3
pub const fn new(origin: DVec3, x: DVec3, y: DVec3, z: DVec3) -> Box3
Construct from a corner and three edge vectors.
Sourcepub fn corners(&self) -> [DVec3; 8]
pub fn corners(&self) -> [DVec3; 8]
The eight corners.
Ordered so bit 0 selects x, bit 1 selects y, and bit 2 selects z:
index 0 is origin and index 7 is the far corner. That ordering lets a
caller index a corner by axis mask instead of memorising a winding.
Sourcepub fn signed_volume(&self) -> f64
pub fn signed_volume(&self) -> f64
Signed volume. Negative when the edge vectors are left-handed.
Signed rather than absolute so a caller can detect an inverted frame, which is a common symptom of a mirrored or badly converted import.
Trait Implementations§
impl Copy for Box3
impl StructuralPartialEq for Box3
Auto Trait Implementations§
impl Freeze for Box3
impl RefUnwindSafe for Box3
impl Send for Box3
impl Sync for Box3
impl Unpin for Box3
impl UnwindSafe for Box3
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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