pub enum Dir3 {
X,
Y,
Z,
NegX,
NegY,
NegZ,
}Expand description
A 3d direction.
Variants§
Implementations§
Source§impl Dir3
impl Dir3
pub const ALL: [Dir2; 4]
pub fn choose(rng: &mut impl RngExt) -> Dir3
pub fn from_dir(dir: Dir2) -> Dir3
pub fn to_dir(self) -> Option<Dir2>
pub fn from_vec3(vec: Vec3<i32>) -> Dir3
pub fn opposite(self) -> Dir3
Sourcepub fn rotate_axis_ccw(self, axis: Dir3) -> Dir3
pub fn rotate_axis_ccw(self, axis: Dir3) -> Dir3
Rotate counter clockwise around an axis by 90 degrees.
Sourcepub fn rotate_axis_cw(self, axis: Dir3) -> Dir3
pub fn rotate_axis_cw(self, axis: Dir3) -> Dir3
Rotate clockwise around an axis by 90 degrees.
Sourcepub fn cross(self, other: Dir3) -> Dir3
pub fn cross(self, other: Dir3) -> Dir3
Get a direction that is orthogonal to both directions, always a positive direction.
pub fn abs(self) -> Dir3
pub fn signum(self) -> i32
pub fn to_vec3(self) -> Vec3<i32>
pub fn is_positive(self) -> bool
pub fn is_negative(self) -> bool
Sourcepub fn select(self, vec: impl Into<Vec3<i32>>) -> i32
pub fn select(self, vec: impl Into<Vec3<i32>>) -> i32
Returns the component that the direction is parallell to
Sourcepub fn select_with(
self,
vec: impl Into<Vec3<i32>>,
other: impl Into<Vec3<i32>>,
) -> Vec3<i32>
pub fn select_with( self, vec: impl Into<Vec3<i32>>, other: impl Into<Vec3<i32>>, ) -> Vec3<i32>
Select one component the direction is parallel to from vec and select the other components from other
Sourcepub fn select_aabb<T>(self, aabb: Aabb<T>) -> T
pub fn select_aabb<T>(self, aabb: Aabb<T>) -> T
Returns the side of an aabb that the direction is pointing to
Sourcepub fn select_aabb_with<T>(
self,
aabb: Aabb<T>,
other: impl Into<Vec3<T>>,
) -> Vec3<T>
pub fn select_aabb_with<T>( self, aabb: Aabb<T>, other: impl Into<Vec3<T>>, ) -> Vec3<T>
Select one component from the side the direction is pointing to from aabr and select the other components from other
pub fn split_aabb_offset<T>(self, aabb: Aabb<T>, offset: T) -> [Aabb<T>; 2]
pub fn trim_aabb(self, aabb: Aabb<i32>, amount: i32) -> Aabb<i32>
pub fn extend_aabb(self, aabb: Aabb<i32>, amount: i32) -> Aabb<i32>
Trait Implementations§
Source§impl EnumSetConstHelper for Dir3
impl EnumSetConstHelper for Dir3
Source§const CONST_INIT_HELPER: __EnumSetInitHelper = __EnumSetInitHelper
const CONST_INIT_HELPER: __EnumSetInitHelper = __EnumSetInitHelper
The instance of the
ConstInitHelper.Source§const CONST_OP_HELPER: __EnumSetOpHelper = __EnumSetOpHelper
const CONST_OP_HELPER: __EnumSetOpHelper = __EnumSetOpHelper
The instance of the
ConstOpHelper.Source§type ConstInitHelper = __EnumSetInitHelper
type ConstInitHelper = __EnumSetInitHelper
A helper type used to convert values to EnumSets at compile-time.
Source§type ConstOpHelper = __EnumSetOpHelper
type ConstOpHelper = __EnumSetOpHelper
A helper type used to implement compile-time operations on enums.
Source§impl EnumSetTypePrivate for Dir3
impl EnumSetTypePrivate for Dir3
Source§const ALL_BITS: Self::Repr = {transmute(0x3f): <util::cardinal_directions::Dir3 as enumset::__internal::EnumSetTypePrivate>::Repr}
const ALL_BITS: Self::Repr = {transmute(0x3f): <util::cardinal_directions::Dir3 as enumset::__internal::EnumSetTypePrivate>::Repr}
A mask of bits that are valid in the bitset.
Source§const VARIANT_COUNT: u32 = 6u32
const VARIANT_COUNT: u32 = 6u32
The number of variants in the bitset.
Source§fn enum_into_u32(self) -> u32
fn enum_into_u32(self) -> u32
Converts an enum of this type into its bit position.
Source§unsafe fn enum_from_u32(val: u32) -> Self
unsafe fn enum_from_u32(val: u32) -> Self
Converts a bit position into an enum value.
§unsafe fn enum_from_u32_checked(val: u32) -> Self
unsafe fn enum_from_u32_checked(val: u32) -> Self
Converts a bit position into an enum value, with an debug_assert.
impl Copy for Dir3
impl EnumSetType for Dir3
impl Eq for Dir3
Auto Trait Implementations§
impl Freeze for Dir3
impl RefUnwindSafe for Dir3
impl Send for Dir3
impl Sync for Dir3
impl Unpin for Dir3
impl UnwindSafe for Dir3
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§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>
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 more