pub struct Matrix3<T> { /* private fields */ }Expand description
A 3×3 matrix stored as three column vectors.
Implementations§
Source§impl<T> Matrix3<T>
impl<T> Matrix3<T>
Source§impl<T: Copy> Matrix3<T>
impl<T: Copy> Matrix3<T>
Sourcepub fn from_rows(
x_row: Vector3<T>,
y_row: Vector3<T>,
z_row: Vector3<T>,
) -> Self
pub fn from_rows( x_row: Vector3<T>, y_row: Vector3<T>, z_row: Vector3<T>, ) -> Self
Constructs a matrix from its three row vectors.
Sourcepub fn from_cols_array(m: &[T; 9]) -> Self
pub fn from_cols_array(m: &[T; 9]) -> Self
Constructs a matrix from a column-major array of nine elements.
Sourcepub fn to_cols_array(&self) -> [T; 9]
pub fn to_cols_array(&self) -> [T; 9]
Returns the elements as a column-major array of nine elements.
Source§impl<V: Scalar> Matrix3<V>
impl<V: Scalar> Matrix3<V>
Sourcepub fn from_scale(scale: Vector3<V>) -> Self
pub fn from_scale(scale: Vector3<V>) -> Self
Constructs a non-uniform scaling matrix from the per-axis factors in
scale.
Sourcepub fn outer_product(a: Vector3<V>, b: Vector3<V>) -> Self
pub fn outer_product(a: Vector3<V>, b: Vector3<V>) -> Self
Constructs the outer (dyadic) product a ⊗ b, the 3×3 matrix whose
(i, j) entry is aᵢ · bⱼ.
Sourcepub fn from_rotation_x(angle: V) -> Self
pub fn from_rotation_x(angle: V) -> Self
Constructs a right-handed rotation of angle radians about the x
axis.
Sourcepub fn from_rotation_y(angle: V) -> Self
pub fn from_rotation_y(angle: V) -> Self
Constructs a right-handed rotation of angle radians about the y
axis.
Sourcepub fn from_rotation_z(angle: V) -> Self
pub fn from_rotation_z(angle: V) -> Self
Constructs a right-handed rotation of angle radians about the z
axis.
Sourcepub fn from_axis_angle(axis: Vector3<V>, angle: V) -> Self
pub fn from_axis_angle(axis: Vector3<V>, angle: V) -> Self
Constructs a right-handed rotation of angle radians about the unit
vector axis (Rodrigues’ rotation formula).
axis is assumed to be normalized; a non-unit axis yields a matrix
that also scales.
Sourcepub fn determinant(&self) -> V
pub fn determinant(&self) -> V
Returns the determinant.
Sourcepub fn is_invertible(&self) -> bool
pub fn is_invertible(&self) -> bool
Returns true if the matrix has a finite, non-zero determinant and is
therefore invertible.
Sourcepub fn try_inverse(&self) -> Option<Self>
pub fn try_inverse(&self) -> Option<Self>
Returns the inverse, or None if the matrix is not invertible.
Sourcepub fn inverse(&self) -> Self
pub fn inverse(&self) -> Self
Returns the inverse.
§Panics
Panics if the matrix is not invertible; use
try_inverse to handle singular matrices.
Trait Implementations§
Source§impl<T: AddAssign> AddAssign for Matrix3<T>
impl<T: AddAssign> AddAssign for Matrix3<T>
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+= operation. Read moreimpl<T: Copy> Copy for Matrix3<T>
Source§impl<T: DivAssign<S> + Copy, S: Scalar> DivAssign<S> for Matrix3<T>
impl<T: DivAssign<S> + Copy, S: Scalar> DivAssign<S> for Matrix3<T>
Source§fn div_assign(&mut self, rhs: S)
fn div_assign(&mut self, rhs: S)
/= operation. Read moreSource§impl<V: Scalar> MulAssign for Matrix3<V>
impl<V: Scalar> MulAssign for Matrix3<V>
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
*= operation. Read moreSource§impl<T: MulAssign<S> + Copy, S: Scalar> MulAssign<S> for Matrix3<T>
impl<T: MulAssign<S> + Copy, S: Scalar> MulAssign<S> for Matrix3<T>
Source§fn mul_assign(&mut self, rhs: S)
fn mul_assign(&mut self, rhs: S)
*= operation. Read more