#[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<Octant>
pub fn try_from_positive_cube(cube: Cube) -> Option<Octant>
Given a cube in the volume (0..2)³, return which octant of that volume it is.
Sourcepub fn try_from_01<T, U>(
corner_or_translation: Vector3D<T, U>,
) -> Option<Octant>
pub fn try_from_01<T, U>( corner_or_translation: Vector3D<T, U>, ) -> Option<Octant>
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: Vector3D<f64, Cube>) -> Octant
pub fn from_vector(vector: Vector3D<f64, Cube>) -> Octant
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§
Source§impl<'arbitrary> Arbitrary<'arbitrary> for Octant
impl<'arbitrary> Arbitrary<'arbitrary> for Octant
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Octant, Error>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Octant, Error>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Octant, Error>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Octant, Error>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§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 from_factory(factory: <Octant as Exhaust>::Factory) -> Octant
fn from_factory(factory: <Octant as Exhaust>::Factory) -> Octant
Self::Factory value produced by
its Self::Iter. Read moreSource§impl From<Octant> for OctantMask
impl From<Octant> for OctantMask
Source§fn from(octant: Octant) -> OctantMask
fn from(octant: Octant) -> OctantMask
Source§impl FromIterator<Octant> for OctantMask
impl FromIterator<Octant> for OctantMask
Source§fn from_iter<T>(iter: T) -> OctantMaskwhere
T: IntoIterator<Item = Octant>,
fn from_iter<T>(iter: T) -> OctantMaskwhere
T: IntoIterator<Item = Octant>,
impl Copy for Octant
impl Eq for Octant
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 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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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