Struct raylib::core::math::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() -> Matrix

Returns the identity matrix.

source

pub fn zero() -> Matrix

Returns the zero matriz.

source

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

Returns a translation matrix.

source

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

Returns a rotation matrix.

source

pub fn rotate_x(angle: f32) -> Matrix

Returns a translation matrix around the X axis.

source

pub fn rotate_y(angle: f32) -> Matrix

Returns a translation matrix around the Y axis.

source

pub fn rotate_z(angle: f32) -> Matrix

Returns a translation matrix around the Z axis.

source

pub fn rotate_xyz(ang: Vector3) -> Self

Returns xyz-rotation matrix (angles in radians)

source

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

Returns a scaling matrix.

source

pub fn frustum( left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32 ) -> Matrix

Returns perspective projection matrix based on frustum parameters.

source

pub fn perspective(fovy: f32, aspect: f32, near: f32, far: f32) -> Matrix

Returns perspective projection matrix.

source

pub fn ortho( left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32 ) -> Matrix

Returns orthographic projection matrix.

source

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

Returns camera look-at matrix (view matrix).

source

pub fn determinant(&self) -> f32

Calculates the determinant of the current matrix.

source

pub fn trace(&self) -> f32

Calculates the trace of the matrix (sum of the values along the diagonal).

source

pub fn transposed(&self) -> Matrix

Returns a new Matrix transposed from the current one.

source

pub fn inverted(&self) -> Matrix

Returns a new Matrix inverted from the current one.

source

pub fn normalized(&self) -> Matrix

Returns a new Matrix normalized from the current one.

source

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

Returns a 16-length f32 array containing the current matrix data.

Trait Implementations§

source§

impl Add for Matrix

§

type Output = Matrix

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl AddAssign for Matrix

source§

fn add_assign(&mut self, mat: Matrix)

Performs the += operation. Read more
source§

impl Clone for Matrix

source§

fn clone(&self) -> Matrix

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
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 From<Matrix> for Matrix

source§

fn from(r: Matrix) -> Matrix

Converts to this type from the input type.
source§

impl Into<Matrix> for &Matrix

source§

fn into(self) -> Matrix

Converts this type into the (usually inferred) input type.
source§

impl Into<Matrix> for Matrix

source§

fn into(self) -> Matrix

Converts this type into the (usually inferred) input type.
source§

impl Mul for Matrix

§

type Output = Matrix

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl MulAssign for Matrix

source§

fn mul_assign(&mut self, mat: Matrix)

Performs the *= operation. Read more
source§

impl PartialEq for Matrix

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Sub for Matrix

§

type Output = Matrix

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl SubAssign for Matrix

source§

fn sub_assign(&mut self, mat: Matrix)

Performs the -= operation. Read more
source§

impl Copy for Matrix

source§

impl StructuralPartialEq for Matrix

Auto Trait Implementations§

§

impl Freeze for Matrix

§

impl RefUnwindSafe for Matrix

§

impl Send for Matrix

§

impl Sync for Matrix

§

impl Unpin for Matrix

§

impl UnwindSafe for Matrix

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> 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,

§

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>,

§

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>,

§

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.