pub(in worldgen::feature) enum Rotation {
None,
Clockwise90,
Clockwise180,
CounterClockwise90,
}Expand description
Horizontal rotation around the Y axis.
Variants§
None
0°.
Clockwise90
90° clockwise.
Clockwise180
180°.
CounterClockwise90
270° clockwise (= 90° counter-clockwise).
Implementations§
Source§impl Rotation
impl Rotation
Sourcepub fn get_random(rng: &mut impl Random) -> Rotation
pub fn get_random(rng: &mut impl Random) -> Rotation
Returns a uniformly random rotation.
Sourcepub fn get_shuffled(rng: &mut impl Random) -> [Rotation; 4]
pub fn get_shuffled(rng: &mut impl Random) -> [Rotation; 4]
Matches vanilla’s Util.shuffledCopy(values(), random) (reverse Fisher-Yates).
Sourcepub const fn rotate(self, dir: Direction) -> Direction
pub const fn rotate(self, dir: Direction) -> Direction
Vertical directions (Up/Down) are unchanged.
Sourcepub const fn then(self, other: Rotation) -> Rotation
pub const fn then(self, other: Rotation) -> Rotation
self.then(other) = apply self first, then other.
Sourcepub const fn transform_pos(self, pos: IVec3, pivot: IVec3) -> IVec3
pub const fn transform_pos(self, pos: IVec3, pivot: IVec3) -> IVec3
Matches vanilla’s StructureTemplate.transform(pos, Mirror.NONE, rotation, pivot).
pivot.y is ignored (only the XZ plane matters).
Sourcepub const fn rotate_size(self, size: IVec3) -> IVec3
pub const fn rotate_size(self, size: IVec3) -> IVec3
90°/270° swap the X and Z dimensions.
Sourcepub const fn transform_pos_mirrored(
self,
pos: IVec3,
pivot: IVec3,
mirror_front_back: bool,
) -> IVec3
pub const fn transform_pos_mirrored( self, pos: IVec3, pivot: IVec3, mirror_front_back: bool, ) -> IVec3
Matches vanilla’s StructureTemplate.transform(pos, Mirror.FRONT_BACK, rotation, pivot).
Sourcepub fn get_bounding_box_full(
self,
pos: IVec3,
size: IVec3,
pivot: IVec3,
mirror_front_back: bool,
) -> Aabb<IVec3, Structure>
pub fn get_bounding_box_full( self, pos: IVec3, size: IVec3, pivot: IVec3, mirror_front_back: bool, ) -> Aabb<IVec3, Structure>
Matches vanilla’s StructureTemplate.getBoundingBox(position, rotation, pivot, mirror, size).
Sourcepub fn get_bounding_box_with_pivot(
self,
pos: IVec3,
size: IVec3,
pivot: IVec3,
) -> Aabb<IVec3, Structure>
pub fn get_bounding_box_with_pivot( self, pos: IVec3, size: IVec3, pivot: IVec3, ) -> Aabb<IVec3, Structure>
[get_bounding_box_full] with mirror=NONE.
Sourcepub fn get_bounding_box(self, pos: IVec3, size: IVec3) -> Aabb<IVec3, Structure>
pub fn get_bounding_box(self, pos: IVec3, size: IVec3) -> Aabb<IVec3, Structure>
[get_bounding_box_full] with pivot=ZERO and mirror=NONE. Used by jigsaw pool elements.
Trait Implementations§
impl Copy for Rotation
impl Eq for Rotation
impl StructuralPartialEq for Rotation
Auto Trait Implementations§
impl Freeze for Rotation
impl RefUnwindSafe for Rotation
impl Send for Rotation
impl Sync for Rotation
impl Unpin for Rotation
impl UnsafeUnpin for Rotation
impl UnwindSafe for Rotation
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,
§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
§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
key and return true if they are equal.§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
§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
self with key and returns 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> ⓘ
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 moreArc<SyncMutex<>>