pub struct Mat3 {
pub col: [Vec3; 3],
}Expand description
Column-major 3×3 matrix.
Columns are stored as col[0..2], so mat * v is sum_i col[i]*v[i].
Fields§
§col: [Vec3; 3]Columns: col[j] is the j-th column.
Implementations§
Source§impl Mat3
impl Mat3
Sourcepub fn from_axes(right: UnitVec3, up: UnitVec3, forward: UnitVec3) -> Self
pub fn from_axes(right: UnitVec3, up: UnitVec3, forward: UnitVec3) -> Self
Rotation matrix that maps the +Z axis to dir and +X axis to right,
forming a right-handed orthonormal frame.
right must be perpendicular to dir. Use UnitVec3::perp_basis
to construct a consistent right if you don’t have one.
Sourcepub fn rotation(axis: UnitVec3, angle: f64) -> Self
pub fn rotation(axis: UnitVec3, angle: f64) -> Self
Rotation by angle radians around axis (must be unit length).
Sourcepub fn try_inverse(self) -> Option<Self>
pub fn try_inverse(self) -> Option<Self>
Inverse (returns None if singular).
Uses the cofactor/adjugate method: M⁻¹ = adj(M)ᵀ / det.
The three Vec3s below are the columns of the inverse.
Trait Implementations§
impl Copy for Mat3
Source§impl MulAssign for Mat3
impl MulAssign for Mat3
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*= operation. Read moreimpl StructuralPartialEq for Mat3
Auto Trait Implementations§
impl Freeze for Mat3
impl RefUnwindSafe for Mat3
impl Send for Mat3
impl Sync for Mat3
impl Unpin for Mat3
impl UnsafeUnpin for Mat3
impl UnwindSafe for Mat3
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more