Struct iron_shapes::matrix2d::Matrix2d
source · pub struct Matrix2d<T: CoordinateType> {
pub(crate) m11: T,
pub(crate) m12: T,
pub(crate) m21: T,
pub(crate) m22: T,
}Expand description
A 2x2 matrix of the form:
[[ m11, m12 ],
[ m21, m22 ]]
Fields§
§m11: Tm11
m12: Tm12
m21: Tm21
m22: Tm22
Implementations§
source§impl<T> Matrix2d<T>where
T: CoordinateType,
impl<T> Matrix2d<T>where T: CoordinateType,
sourcepub fn new(m11: T, m12: T, m21: T, m22: T) -> Self
pub fn new(m11: T, m12: T, m21: T, m22: T) -> Self
Create a new 2x2 matrix with entries of the form:
[[ m11, m12 ],
[ m21, m22 ]]
sourcepub fn mul_scalar(&self, rhs: T) -> Self
pub fn mul_scalar(&self, rhs: T) -> Self
Compute product of the matrix with a scalar.
sourcepub fn mul_column_vector(&self, rhs: Vector<T>) -> Vector<T>
pub fn mul_column_vector(&self, rhs: Vector<T>) -> Vector<T>
Compute matrix-column-vector multiplication. The vector is interpreted as column vector.
sourcepub fn mul_matrix(&self, rhs: &Self) -> Self
pub fn mul_matrix(&self, rhs: &Self) -> Self
Matrix-matrix multiplication.
sourcepub fn determinant(&self) -> T
pub fn determinant(&self) -> T
Compute the determinant of this matrix.
sourcepub fn is_identity(&self) -> bool
pub fn is_identity(&self) -> bool
Test if this matrix is the identity matrix.
sourcepub fn is_unitary(&self) -> bool
pub fn is_unitary(&self) -> bool
Test if this matrix is unitary.
sourcepub fn try_inverse(&self) -> Option<Self>
pub fn try_inverse(&self) -> Option<Self>
Compute the inverse matrix.
None will be returned if the determinant is zero and the matrix
is not invertible.
Trait Implementations§
source§impl<T: CoordinateType> Default for Matrix2d<T>
impl<T: CoordinateType> Default for Matrix2d<T>
source§impl<'de, T> Deserialize<'de> for Matrix2d<T>where
T: Deserialize<'de> + CoordinateType,
impl<'de, T> Deserialize<'de> for Matrix2d<T>where T: Deserialize<'de> + CoordinateType,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more