Skip to main content

Matrix4

Struct Matrix4 

Source
pub struct Matrix4 {
    pub elements: [f64; 16],
}
Expand description

Port of three.js’ Matrix4: a 4x4 matrix.

Fields§

§elements: [f64; 16]

A column-major list of matrix values.

Implementations§

Source§

impl Matrix4

Source

pub const fn identity() -> Self

The identity matrix.

Source

pub fn make_scale(&mut self, x: f64, y: f64, z: f64) -> &mut Self

Matrix4.makeScale().

Source

pub fn compose( &mut self, position: &Vector3, quaternion: &Quaternion, scale: &Vector3, ) -> &mut Self

Matrix4.compose().

Source

pub fn look_at( &mut self, eye: &Vector3, target: &Vector3, up: &Vector3, ) -> &mut Self

Matrix4.lookAt(): writes only the upper 3x3 rotation.

Source

pub fn multiply_matrices(&mut self, a: &Self, b: &Self) -> &mut Self

Matrix4.multiplyMatrices().

Source

pub fn invert(&mut self) -> &mut Self

Matrix4.invert().

Source

pub fn make_perspective( &mut self, left: f64, right: f64, top: f64, bottom: f64, near: f64, far: f64, coordinate_system: CoordinateSystem, ) -> &mut Self

Matrix4.makePerspective(), reversedDepth = false.

Source

pub fn set( &mut self, n11: f64, n12: f64, n13: f64, n14: f64, n21: f64, n22: f64, n23: f64, n24: f64, n31: f64, n32: f64, n33: f64, n34: f64, n41: f64, n42: f64, n43: f64, n44: f64, ) -> &mut Self

Matrix4.set( n11, n12, ... ) — row-order arguments into a column-major store.

Source

pub fn from_rows( n11: f64, n12: f64, n13: f64, n14: f64, n21: f64, n22: f64, n23: f64, n24: f64, n31: f64, n32: f64, n33: f64, n34: f64, n41: f64, n42: f64, n43: f64, n44: f64, ) -> Self

new Matrix4( n11, ... ).

Source

pub fn set_identity(&mut self) -> &mut Self

Matrix4.identity().

Source

pub fn copy(&mut self, m: &Self) -> &mut Self

Matrix4.copy().

Source

pub fn copy_position(&mut self, m: &Self) -> &mut Self

Matrix4.copyPosition().

Source

pub fn set_from_matrix3(&mut self, m: &Matrix3) -> &mut Self

Matrix4.setFromMatrix3().

Source

pub fn extract_basis( &self, x_axis: &mut Vector3, y_axis: &mut Vector3, z_axis: &mut Vector3, )

Matrix4.extractBasis().

Source

pub fn make_basis( &mut self, x_axis: &Vector3, y_axis: &Vector3, z_axis: &Vector3, ) -> &mut Self

Matrix4.makeBasis().

Source

pub fn extract_rotation(&mut self, m: &Self) -> &mut Self

Matrix4.extractRotation(): the upper 3x3 of m with its scale divided out. A singular matrix yields the identity.

Source

pub fn make_rotation_from_euler(&mut self, euler: &Euler) -> &mut Self

Matrix4.makeRotationFromEuler().

Source

pub fn make_rotation_from_quaternion(&mut self, q: &Quaternion) -> &mut Self

Matrix4.makeRotationFromQuaternion().

Source

pub fn multiply(&mut self, m: &Self) -> &mut Self

Matrix4.multiply().

Source

pub fn premultiply(&mut self, m: &Self) -> &mut Self

Matrix4.premultiply().

Source

pub fn multiply_scalar(&mut self, s: f64) -> &mut Self

Matrix4.multiplyScalar().

Source

pub fn determinant(&self) -> f64

Matrix4.determinant().

Source

pub fn determinant_affine(&self) -> f64

Matrix4.determinantAffine() — the determinant of the upper 3x3.

Source

pub fn transpose(&mut self) -> &mut Self

Matrix4.transpose().

Source

pub fn set_position(&mut self, x: f64, y: f64, z: f64) -> &mut Self

Matrix4.setPosition().

Source

pub fn scale(&mut self, v: &Vector3) -> &mut Self

Matrix4.scale( v ).

Source

pub fn get_max_scale_on_axis(&self) -> f64

Matrix4.getMaxScaleOnAxis().

Source

pub fn make_translation(&mut self, x: f64, y: f64, z: f64) -> &mut Self

Matrix4.makeTranslation().

Source

pub fn make_rotation_x(&mut self, theta: f64) -> &mut Self

Matrix4.makeRotationX().

Source

pub fn make_rotation_y(&mut self, theta: f64) -> &mut Self

Matrix4.makeRotationY().

Source

pub fn make_rotation_z(&mut self, theta: f64) -> &mut Self

Matrix4.makeRotationZ().

Source

pub fn make_rotation_axis(&mut self, axis: &Vector3, angle: f64) -> &mut Self

Matrix4.makeRotationAxis(). axis is assumed to be normalized.

Source

pub fn make_shear( &mut self, xy: f64, xz: f64, yx: f64, yz: f64, zx: f64, zy: f64, ) -> &mut Self

Matrix4.makeShear().

Source

pub fn decompose( &self, position: &mut Vector3, quaternion: &mut Quaternion, scale: &mut Vector3, )

Matrix4.decompose().

Source

pub fn make_orthographic( &mut self, left: f64, right: f64, top: f64, bottom: f64, near: f64, far: f64, coordinate_system: CoordinateSystem, ) -> &mut Self

Matrix4.makeOrthographic(), reversedDepth = false.

Source

pub fn equals(&self, m: &Self) -> bool

Matrix4.equals().

Source

pub fn from_array(&mut self, array: &[f64], offset: usize) -> &mut Self

Matrix4.fromArray().

Source

pub fn to_array(&self) -> [f64; 16]

Matrix4.toArray().

Trait Implementations§

Source§

impl Clone for Matrix4

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 Copy for Matrix4

Source§

impl Debug for Matrix4

Source§

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

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

impl Default for Matrix4

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<Matrix4> for NodeRef

Source§

fn from(m: Matrix4) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Matrix4

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 StructuralPartialEq for Matrix4

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.
Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,