Skip to main content

Matrix

Struct Matrix 

Source
#[repr(C)]
pub struct Matrix {
Show 16 fields pub m0: f32, pub m4: f32, pub m8: f32, pub m12: f32, pub m1: f32, pub m5: f32, pub m9: f32, pub m13: f32, pub m2: f32, pub m6: f32, pub m10: f32, pub m14: f32, pub m3: f32, pub m7: f32, pub m11: f32, pub m15: f32,
}

Fields§

§m0: f32§m4: f32§m8: f32§m12: f32§m1: f32§m5: f32§m9: f32§m13: f32§m2: f32§m6: f32§m10: f32§m14: f32§m3: f32§m7: f32§m11: f32§m15: f32

Implementations§

Source§

impl Matrix

Source

pub fn identity() -> Self

Identity matrix. (raymath MatrixIdentity)

Source

pub fn determinant(self) -> f32

Matrix determinant. (raymath MatrixDeterminant)

Source

pub fn trace(self) -> f32

Trace of the matrix (sum of diagonal values). (raymath MatrixTrace)

Source

pub fn transpose(self) -> Self

Transpose matrix. (raymath MatrixTranspose)

Source

pub fn invert(self) -> Self

Invert matrix. (raymath MatrixInvert)

Source

pub fn mul_value(self, value: f32) -> Self

Multiply matrix by scalar. (raymath MatrixMultiplyValue)

Source

pub fn translate(x: f32, y: f32, z: f32) -> Self

Translate matrix. (raymath MatrixTranslate)

Source

pub fn rotate(axis: Vector3, angle: f32) -> Self

Rotate matrix by axis and angle (radians). (raymath MatrixRotate)

Source

pub fn rotate_x(angle: f32) -> Self

Rotate around X axis (radians). (raymath MatrixRotateX)

Source

pub fn rotate_y(angle: f32) -> Self

Rotate around Y axis (radians). (raymath MatrixRotateY)

Source

pub fn rotate_z(angle: f32) -> Self

Rotate around Z axis (radians). (raymath MatrixRotateZ)

Source

pub fn rotate_xyz(angle: Vector3) -> Self

Rotate around XYZ axes (radians, intrinsic order). (raymath MatrixRotateXYZ)

Source

pub fn rotate_zyx(angle: Vector3) -> Self

Rotate around ZYX axes (radians, intrinsic order). (raymath MatrixRotateZYX)

Source

pub fn scale(x: f32, y: f32, z: f32) -> Self

Scale matrix. (raymath MatrixScale)

Source

pub fn frustum( left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64, ) -> Self

Frustum projection matrix. (raymath MatrixFrustum)

Source

pub fn perspective(fov_y: f64, aspect: f64, near: f64, far: f64) -> Self

Perspective projection matrix. (raymath MatrixPerspective)

Source

pub fn ortho( left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64, ) -> Self

Orthographic projection matrix. (raymath MatrixOrtho)

Source

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

Look-at view matrix. (raymath MatrixLookAt)

Source

pub fn to_float_array(self) -> float16

Convert matrix to float array. (raymath MatrixToFloatV)

Source

pub fn compose( translation: Vector3, rotation: Quaternion, scale: Vector3, ) -> Self

Compose a matrix from translation, rotation quaternion, and scale. (raymath MatrixCompose)

Trait Implementations§

Source§

impl Add for Matrix

Source§

type Output = Matrix

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Matrix) -> Matrix

Performs the + operation. Read more
Source§

impl AddAssign for Matrix

Source§

fn add_assign(&mut self, rhs: Matrix)

Performs the += operation. Read more
Source§

impl Clone for Matrix

Source§

fn clone(&self) -> Matrix

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 Matrix

Source§

impl Debug for Matrix

Source§

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

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

impl Default for Matrix

Source§

fn default() -> Matrix

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

impl Mul for Matrix

Source§

type Output = Matrix

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Matrix) -> Matrix

Performs the * operation. Read more
Source§

impl MulAssign for Matrix

Source§

fn mul_assign(&mut self, rhs: Matrix)

Performs the *= operation. Read more
Source§

impl PartialEq for Matrix

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Matrix

Source§

impl Sub for Matrix

Source§

type Output = Matrix

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Matrix) -> Matrix

Performs the - operation. Read more
Source§

impl SubAssign for Matrix

Source§

fn sub_assign(&mut self, rhs: Matrix)

Performs the -= operation. Read more

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.