Skip to main content

Transform

Struct Transform 

Source
pub struct Transform {
    pub translation: [f64; 3],
    pub left_rotation: [f64; 4],
    pub scale: [f64; 3],
    pub right_rotation: [f64; 4],
}
Expand description

A display entity’s transformation (Display entity data, Minecraft Wiki): the rendered model is translation · left_rotation · scale · right_rotation applied to the unit cube.

Fields§

§translation: [f64; 3]

[x, y, z] translation, in blocks.

§left_rotation: [f64; 4]

[x, y, z, w] quaternion applied after scale.

§scale: [f64; 3]

[x, y, z] scale.

§right_rotation: [f64; 4]

[x, y, z, w] quaternion applied before scale.

Implementations§

Source§

impl Transform

Source

pub fn faced(&self, facing: Facing) -> Transform

This transform turned by facing about the vertical axis through the mark: the translation rotated, the yaw composed before the left rotation. The model is Ryaw · T · L · S · R, which is T(Ryaw·t) · (Ryaw·L) · S · R — so the emitted entity stands at yaw 0 and no client fact about how a display’s own yaw composes with its transformation is relied on (spec-0082 §3.2).

Source

pub fn turned(&self, a: f64) -> Transform

This transform turned by a radians about the vertical axis through the mark (right-handed about +y: +z turns toward +x) — what Self::faced does for a quarter turn, for any angle. An aimed assembly’s facings are turns of this kind (spec-0082 §5.7).

Source

pub fn cells(&self) -> BTreeSet<[i32; 3]>

The cells this part’s box meets, relative to the mark’s cell: every cell the transformed unit cube overlaps with positive volume, judged exactly (a separating-axis test of the oriented box against the cell), not by the box’s axis-aligned hull — a part laid on a diagonal meets the cells along it, never the empty corners of its hull. The entity stands at the mark cell’s centre (x + 0.5, z + 0.5) on its floor (y).

Source

pub fn meets_box(&self, lo: [f64; 3], hi: [f64; 3]) -> bool

Whether this part’s box overlaps the axis-aligned box lo..hi with positive volume, judged exactly. Coordinates are relative to the mark’s cell, which spans [0, 1] on every axis; the entity stands at its centre on its floor, as for Self::cells.

Trait Implementations§

Source§

impl Clone for Transform

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Transform

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Transform

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Transform

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Transform

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Transform

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.