[−][src]Struct hektor::Mat4
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]
fn determinant(self) -> f32
[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.
fn add(self, rhs: Self) -> Self
[src]
impl Add<f32> for Mat4
[src]
type Output = Self
The resulting type after applying the +
operator.
fn add(self, rhs: f32) -> Self
[src]
impl Add<Mat4> for f32
[src]
type Output = Mat4
The resulting type after applying the +
operator.
fn add(self, rhs: Mat4) -> Mat4
[src]
impl Sub<Mat4> for Mat4
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, rhs: Self) -> Self
[src]
impl Sub<f32> for Mat4
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, rhs: f32) -> Self
[src]
impl Sub<Mat4> for f32
[src]
type Output = Mat4
The resulting type after applying the -
operator.
fn sub(self, rhs: Mat4) -> Mat4
[src]
impl Mul<f32> for Mat4
[src]
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, rhs: f32) -> Self
[src]
impl Mul<Mat4> for f32
[src]
type Output = Mat4
The resulting type after applying the *
operator.
fn mul(self, rhs: Mat4) -> Mat4
[src]
impl Mul<Vec4> for Mat4
[src]
type Output = Vec4
The resulting type after applying the *
operator.
fn mul(self, v4: Vec4) -> Vec4
[src]
impl Mul<Mat4> for Mat4
[src]
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, rhs: Self) -> Self
[src]
impl Neg for Mat4
[src]
impl AddAssign<Mat4> for Mat4
[src]
fn add_assign(&mut self, rhs: Self)
[src]
impl AddAssign<f32> for Mat4
[src]
fn add_assign(&mut self, rhs: f32)
[src]
impl SubAssign<Mat4> for Mat4
[src]
fn sub_assign(&mut self, rhs: Self)
[src]
impl SubAssign<f32> for Mat4
[src]
fn sub_assign(&mut self, rhs: f32)
[src]
impl MulAssign<f32> for Mat4
[src]
fn mul_assign(&mut self, rhs: f32)
[src]
impl MulAssign<Mat4> for Mat4
[src]
fn mul_assign(&mut self, rhs: Self)
[src]
impl Index<usize> for Mat4
[src]
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]
fn from(
Mat4 { x_axis: x_axis, y_axis: y_axis, z_axis: z_axis, w_axis: w_axis }: Mat4
) -> Self
[src]
Mat4 { x_axis: x_axis, y_axis: y_axis, z_axis: z_axis, w_axis: w_axis }: Mat4
) -> Self
impl Clone for Mat4
[src]
fn clone(&self) -> 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]
Auto Trait Implementations
Blanket Implementations
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,