#[repr(u8)]pub enum Octant {
Nnn = 0,
Nnp = 1,
Npn = 2,
Npp = 3,
Pnn = 4,
Pnp = 5,
Ppn = 6,
Ppp = 7,
}Expand description
Identifies one of eight octants, or elements of a 2×2×2 cube.
Used with OctantMask and OctantMap.
This enum’s discriminants are not currently to be considered stable; they may be reordered.
Variants§
Nnn = 0
The -X, -Y, -Z octant.
Nnp = 1
The -X, -Y, +Z octant.
Npn = 2
The -X, +Y, -Z octant.
Npp = 3
The -X, +Y, +Z octant.
Pnn = 4
The +X, -Y, -Z octant.
Pnp = 5
The +X, -Y, +Z octant.
Ppn = 6
The +X, +Y, -Z octant.
Ppp = 7
The +X, +Y, +Z octant.
Implementations§
Source§impl Octant
impl Octant
Sourcepub fn try_from_positive_cube(cube: Cube) -> Option<Self>
pub fn try_from_positive_cube(cube: Cube) -> Option<Self>
Given a cube in the volume (0..2)³, return which octant of that volume it is.
Sourcepub fn try_from_01<T: Copy + NumCast, U>(
corner_or_translation: Vector3D<T, U>,
) -> Option<Self>
pub fn try_from_01<T: Copy + NumCast, U>( corner_or_translation: Vector3D<T, U>, ) -> Option<Self>
Given the low corner of an octant in the volume (0..2)³, return which octant it is.
That is, each coordinate of the returned Vector3D is either 0 or 1.
This is equivalent to Self::try_from_positive_cube() but with more flexible input.
TODO: better trait bounds would be Zero + One
Sourcepub fn from_vector(vector: FreeVector) -> Self
pub fn from_vector(vector: FreeVector) -> Self
Returns the octant the given vector points toward, when interpreted as pointing away from the center point where all octants meet.
Ties due to zero components are broken in the positive direction.
Sourcepub fn to_positive_cube(self) -> Cube
pub fn to_positive_cube(self) -> Cube
Returns this octant of the volume (0..2)³.
That is, each coordinate of the returned Cube is either 0 or 1.
Trait Implementations§
impl Copy for Octant
impl Eq for Octant
Source§impl Exhaust for Octant
impl Exhaust for Octant
Source§type Iter = ExhaustOctantIter
type Iter = ExhaustOctantIter
Self::exhaust_factories().
See the trait documentation for what properties this iterator should have. Read moreSource§fn exhaust_factories() -> Self::Iter
fn exhaust_factories() -> Self::Iter
Source§fn from_factory(factory: Self::Factory) -> Self
fn from_factory(factory: Self::Factory) -> Self
Self::Factory value produced by
its Self::Iter. Read moreSource§impl From<Octant> for OctantMask
impl From<Octant> for OctantMask
Source§impl FromIterator<Octant> for OctantMask
impl FromIterator<Octant> for OctantMask
impl StructuralPartialEq for Octant
Auto Trait Implementations§
impl Freeze for Octant
impl RefUnwindSafe for Octant
impl Send for Octant
impl Sync for Octant
impl Unpin for Octant
impl UnsafeUnpin for Octant
impl UnwindSafe for Octant
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> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.