[][src]Struct hektor::Mat4

#[repr(C)]
pub struct Mat4 { /* fields omitted */ }

A 4x4 column-major Matrix.

There's four columns, and each column is itself a Vec4.

Methods

impl Mat4[src]

pub fn x_axis(self) -> Vec4[src]

Obtains the x_axis column of this matrix

pub fn y_axis(self) -> Vec4[src]

Obtains the y_axis column of this matrix

pub fn z_axis(self) -> Vec4[src]

Obtains the z_axis column of this matrix

pub fn w_axis(self) -> Vec4[src]

Obtains the w_axis column of this matrix

pub fn x_axis_mut(&mut self) -> &mut Vec4[src]

&mut to the x_axis column of this matrix

pub fn y_axis_mut(&mut self) -> &mut Vec4[src]

&mut to the y_axis column of this matrix

pub fn z_axis_mut(&mut self) -> &mut Vec4[src]

&mut to the z_axis column of this matrix

pub fn w_axis_mut(&mut self) -> &mut Vec4[src]

&mut to the w_axis column of this matrix

impl Mat4[src]

pub fn new(x_axis: Vec4, y_axis: Vec4, z_axis: Vec4, w_axis: Vec4) -> Self[src]

Combines the columns given into a new Mat4

pub fn splat(v: f32) -> Self[src]

Splats the given value across all columns.

pub fn diagonal(x: f32, y: f32, z: f32, w: f32) -> Self[src]

Forms a diagonal matrix from the values given.

pub fn to_mat3(self) -> Mat3[src]

Down-converts to a Mat3

pub fn determinant(self) -> f32[src]

Determinant of the matrix.

This gives the scale factor of a unit hyper-cube in the matrix's modified coordinate space:

  • Positive means that the output orientation is generally similar.
  • Negative means that the output orientation is flipped.
  • Zero means that the output loses at least 1 dimension (meaning that hyper-cubes become cubes, squares, lines, or points).

pub fn transpose(self) -> Self[src]

Transpose the matrix.

This "flips" it along the diagonal. The diagonal values stay the same.

pub fn inverse(self) -> Option<Self>[src]

Gives the inverse matrix, if it exists.

m * m.inverse() and m.inverse() * m should both give an identity matrix as the output. As we all known, with floating point there's usually a little bit of rounding error possible so it may not work perfectly.

Failure

There's no inverse if the determinant is zero.

Trait Implementations

impl CanDeterminant for Mat4[src]

impl Display for Mat4[src]

fn fmt(&self, f: &mut Formatter) -> Result[src]

Display formats without labels in a 4 line style similar to standard math notation.

Passes the formatter along to the fields, so you can use any normal f32 Display format arguments that you like.

impl Debug for Mat4[src]

fn fmt(&self, f: &mut Formatter) -> Result[src]

Debug formats with each axis labeled and then shown as a 4-tuple in one long line.

Passes the formatter along to the fields, so you can use any normal f32 Debug format arguments that you like.

impl UpperExp for Mat4[src]

fn fmt(&self, f: &mut Formatter) -> Result[src]

UpperExp formats like Display, but with the upper exponent.

Passes the formatter along to the fields, so you can use any normal f32 UpperExp format arguments that you like.

impl LowerExp for Mat4[src]

fn fmt(&self, f: &mut Formatter) -> Result[src]

LowerExp formats like Display, but with the lower exponent.

Passes the formatter along to the fields, so you can use any normal f32 LowerExp format arguments that you like.

impl PartialEq<Mat4> for Mat4[src]

impl Add<Mat4> for Mat4[src]

type Output = Self

The resulting type after applying the + operator.

impl Add<f32> for Mat4[src]

type Output = Self

The resulting type after applying the + operator.

impl Add<Mat4> for f32[src]

type Output = Mat4

The resulting type after applying the + operator.

impl Sub<Mat4> for Mat4[src]

type Output = Self

The resulting type after applying the - operator.

impl Sub<f32> for Mat4[src]

type Output = Self

The resulting type after applying the - operator.

impl Sub<Mat4> for f32[src]

type Output = Mat4

The resulting type after applying the - operator.

impl Mul<f32> for Mat4[src]

type Output = Self

The resulting type after applying the * operator.

impl Mul<Mat4> for f32[src]

type Output = Mat4

The resulting type after applying the * operator.

impl Mul<Vec4> for Mat4[src]

type Output = Vec4

The resulting type after applying the * operator.

impl Mul<Mat4> for Mat4[src]

type Output = Self

The resulting type after applying the * operator.

impl Neg for Mat4[src]

type Output = Self

The resulting type after applying the - operator.

impl AddAssign<Mat4> for Mat4[src]

impl AddAssign<f32> for Mat4[src]

impl SubAssign<Mat4> for Mat4[src]

impl SubAssign<f32> for Mat4[src]

impl MulAssign<f32> for Mat4[src]

impl MulAssign<Mat4> for Mat4[src]

impl Index<usize> for Mat4[src]

type Output = Vec4

The returned type after indexing.

impl IndexMut<usize> for Mat4[src]

impl Copy for Mat4[src]

impl AsRef<[Vec4; 4]> for Mat4[src]

impl AsMut<[Vec4; 4]> for Mat4[src]

impl From<[f32; 16]> for Mat4[src]

impl From<Mat4> for [f32; 16][src]

impl Clone for Mat4[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Default for Mat4[src]

impl Pod for Mat4[src]

impl Zeroable for Mat4[src]

fn zeroed() -> Self[src]

Calls zeroed. Read more

Auto Trait Implementations

impl Unpin for Mat4

impl Sync for Mat4

impl Send for Mat4

Blanket Implementations

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]