[−][src]Struct hektor::Mat3
A 3x3 column-major Matrix.
There's three columns, and each column is itself a Vec3
.
Methods
impl Mat3
[src]
pub fn x_axis(self) -> Vec3
[src]
Obtains the x_axis
column of this matrix
pub fn y_axis(self) -> Vec3
[src]
Obtains the y_axis
column of this matrix
pub fn z_axis(self) -> Vec3
[src]
Obtains the z_axis
column of this matrix
pub fn x_axis_mut(&mut self) -> &mut Vec3
[src]
&mut
to the x_axis
column of this matrix
pub fn y_axis_mut(&mut self) -> &mut Vec3
[src]
&mut
to the y_axis
column of this matrix
pub fn z_axis_mut(&mut self) -> &mut Vec3
[src]
&mut
to the z_axis
column of this matrix
impl Mat3
[src]
pub fn new(x_axis: Vec3, y_axis: Vec3, z_axis: Vec3) -> Self
[src]
Combines the columns given into a new Mat3
pub fn splat(v: f32) -> Self
[src]
Splats the given value across all columns.
pub fn diagonal(x: f32, y: f32, z: f32) -> Self
[src]
Forms a diagonal matrix from the values given.
pub fn to_mat2(self) -> Mat2
[src]
Down-converts to a Mat2
pub fn to_mat4(self, w: f32) -> Mat4
[src]
Up-converts to a Mat4
by adding the given w
as the w
of the
w_axis
. The x_axis
, y_axis
, and z_axis
are extended with 0.0
pub fn determinant(self) -> f32
[src]
Determinant of the matrix.
This gives the scale factor of a unit 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 cubes become 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 Mat3
[src]
fn determinant(self) -> f32
[src]
impl Display for Mat3
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Display formats without labels in a 3 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 Mat3
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Debug formats with each axis labeled and then shown as a 3-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 Mat3
[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 Mat3
[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<Mat3> for Mat3
[src]
impl Add<Mat3> for Mat3
[src]
type Output = Self
The resulting type after applying the +
operator.
fn add(self, rhs: Self) -> Self
[src]
impl Add<f32> for Mat3
[src]
type Output = Self
The resulting type after applying the +
operator.
fn add(self, rhs: f32) -> Self
[src]
impl Add<Mat3> for f32
[src]
type Output = Mat3
The resulting type after applying the +
operator.
fn add(self, rhs: Mat3) -> Mat3
[src]
impl Sub<Mat3> for Mat3
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, rhs: Self) -> Self
[src]
impl Sub<f32> for Mat3
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, rhs: f32) -> Self
[src]
impl Sub<Mat3> for f32
[src]
type Output = Mat3
The resulting type after applying the -
operator.
fn sub(self, rhs: Mat3) -> Mat3
[src]
impl Mul<f32> for Mat3
[src]
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, rhs: f32) -> Self
[src]
impl Mul<Mat3> for f32
[src]
type Output = Mat3
The resulting type after applying the *
operator.
fn mul(self, rhs: Mat3) -> Mat3
[src]
impl Mul<Vec3> for Mat3
[src]
type Output = Vec3
The resulting type after applying the *
operator.
fn mul(self, v3: Vec3) -> Vec3
[src]
impl Mul<Mat3> for Mat3
[src]
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, rhs: Self) -> Self
[src]
impl Neg for Mat3
[src]
impl AddAssign<Mat3> for Mat3
[src]
fn add_assign(&mut self, rhs: Self)
[src]
impl AddAssign<f32> for Mat3
[src]
fn add_assign(&mut self, rhs: f32)
[src]
impl SubAssign<Mat3> for Mat3
[src]
fn sub_assign(&mut self, rhs: Self)
[src]
impl SubAssign<f32> for Mat3
[src]
fn sub_assign(&mut self, rhs: f32)
[src]
impl MulAssign<f32> for Mat3
[src]
fn mul_assign(&mut self, rhs: f32)
[src]
impl MulAssign<Mat3> for Mat3
[src]
fn mul_assign(&mut self, rhs: Self)
[src]
impl Index<usize> for Mat3
[src]
impl IndexMut<usize> for Mat3
[src]
impl Copy for Mat3
[src]
impl AsRef<[Vec3; 3]> for Mat3
[src]
impl AsMut<[Vec3; 3]> for Mat3
[src]
impl From<[f32; 9]> for Mat3
[src]
impl From<Mat3> for [f32; 9]
[src]
impl Clone for Mat3
[src]
fn clone(&self) -> Mat3
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Default for Mat3
[src]
impl Pod for Mat3
[src]
impl Zeroable for Mat3
[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,