#[repr(C)]pub struct Mat3<T> {
pub a11: T,
pub a12: T,
pub a13: T,
pub a21: T,
pub a22: T,
pub a23: T,
pub a31: T,
pub a32: T,
pub a33: T,
}
Expand description
3D transformation matrix.
Each field aij represents the i-th row and j-th column of the matrix.
Row-major storage with column-major semantics.
Stored in row-major order (fields appear in reading order),
but interpreted as column-major: each column is a transformed basis vector,
and matrices are applied to column vectors via mat * vec
.
Fields§
§a11: T
§a12: T
§a13: T
§a21: T
§a22: T
§a23: T
§a31: T
§a32: T
§a33: T
Implementations§
Source§impl<T> Mat3<T>
impl<T> Mat3<T>
Sourcepub fn transform3(self) -> Transform3<T>where
T: Zero,
pub fn transform3(self) -> Transform3<T>where
T: Zero,
Converts to a Transform3 matrix.
Sourcepub fn translate(self, trans: Vec3<T>) -> Transform3<T>
pub fn translate(self, trans: Vec3<T>) -> Transform3<T>
Adds a translation to the matrix.
Source§impl<T> Mat3<T>
impl<T> Mat3<T>
Sourcepub fn from_row_major(mat: [[T; 3]; 3]) -> Mat3<T>
pub fn from_row_major(mat: [[T; 3]; 3]) -> Mat3<T>
Imports the matrix from a row-major layout.
Sourcepub fn from_column_major(mat: [[T; 3]; 3]) -> Mat3<T>
pub fn from_column_major(mat: [[T; 3]; 3]) -> Mat3<T>
Imports the matrix from a column-major layout.
Sourcepub fn into_row_major(self) -> [[T; 3]; 3]
pub fn into_row_major(self) -> [[T; 3]; 3]
Exports the matrix as a row-major array.
Sourcepub fn into_column_major(self) -> [[T; 3]; 3]
pub fn into_column_major(self) -> [[T; 3]; 3]
Exports the matrix as a column-major array.
Source§impl<T> Mat3<T>
impl<T> Mat3<T>
Source§impl<T: Scalar> Mat3<T>
impl<T: Scalar> Mat3<T>
Sourcepub fn flat_norm_sqr(self) -> T
pub fn flat_norm_sqr(self) -> T
Computes the squared Frobenius norm (sum of squares of all matrix elements).
This measure is useful for quickly checking matrix magnitude or comparing matrices without the cost of a square root operation.
To check if a matrix is effectively zero, test if flat_norm_sqr()
is below a small epsilon threshold.
pub fn try_invert(self) -> Option<Mat3<T>>where
T: Float,
Trait Implementations§
Source§impl<T: Zero + One> From<Transform2<T>> for Mat3<T>
impl<T: Zero + One> From<Transform2<T>> for Mat3<T>
Source§fn from(mat: Transform2<T>) -> Mat3<T>
fn from(mat: Transform2<T>) -> Mat3<T>
Source§impl<T: Copy + Add<Output = T> + Mul<Output = T>> Mul<Mat3<T>> for Transform3<T>
impl<T: Copy + Add<Output = T> + Mul<Output = T>> Mul<Mat3<T>> for Transform3<T>
Source§type Output = Transform3<T>
type Output = Transform3<T>
*
operator.Source§impl<T> MulAssign<&Mat3<T>> for Mat3<T>
impl<T> MulAssign<&Mat3<T>> for Mat3<T>
Source§fn mul_assign(&mut self, rhs: &Mat3<T>)
fn mul_assign(&mut self, rhs: &Mat3<T>)
*=
operation. Read moreSource§impl<T> MulAssign<&T> for Mat3<T>
impl<T> MulAssign<&T> for Mat3<T>
Source§fn mul_assign(&mut self, rhs: &T)
fn mul_assign(&mut self, rhs: &T)
*=
operation. Read moreSource§impl<T: Copy + Add<Output = T> + Mul<Output = T>> MulAssign<Mat3<T>> for Transform3<T>
impl<T: Copy + Add<Output = T> + Mul<Output = T>> MulAssign<Mat3<T>> for Transform3<T>
Source§fn mul_assign(&mut self, rhs: Mat3<T>)
fn mul_assign(&mut self, rhs: Mat3<T>)
*=
operation. Read moreSource§impl<T: Copy + MulAssign> MulAssign<T> for Mat3<T>
impl<T: Copy + MulAssign> MulAssign<T> for Mat3<T>
Source§fn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
*=
operation. Read moreSource§impl<T: Copy + Add<Output = T> + Mul<Output = T>> MulAssign<Transform2<T>> for Mat3<T>
impl<T: Copy + Add<Output = T> + Mul<Output = T>> MulAssign<Transform2<T>> for Mat3<T>
Source§fn mul_assign(&mut self, rhs: Transform2<T>)
fn mul_assign(&mut self, rhs: Transform2<T>)
*=
operation. Read moreSource§impl<T: Copy + Add<Output = T> + Mul<Output = T>> MulAssign for Mat3<T>
impl<T: Copy + Add<Output = T> + Mul<Output = T>> MulAssign for Mat3<T>
Source§fn mul_assign(&mut self, rhs: Mat3<T>)
fn mul_assign(&mut self, rhs: Mat3<T>)
*=
operation. Read more