pub struct Mat4(pub [[f64; 4]; 4]);Expand description
A 4x4 matrix stored in row-major order, typically used for affine transforms.
Tuple Fields§
§0: [[f64; 4]; 4]Implementations§
Source§impl Mat4
impl Mat4
Sourcepub const fn translation(tx: f64, ty: f64, tz: f64) -> Self
pub const fn translation(tx: f64, ty: f64, tz: f64) -> Self
Create a translation matrix.
Sourcepub const fn scale(sx: f64, sy: f64, sz: f64) -> Self
pub const fn scale(sx: f64, sy: f64, sz: f64) -> Self
Create a uniform or non-uniform scale matrix.
Sourcepub fn rotation_x(angle: f64) -> Self
pub fn rotation_x(angle: f64) -> Self
Create a rotation matrix around the X axis by angle radians.
Sourcepub fn rotation_y(angle: f64) -> Self
pub fn rotation_y(angle: f64) -> Self
Create a rotation matrix around the Y axis by angle radians.
Sourcepub fn rotation_z(angle: f64) -> Self
pub fn rotation_z(angle: f64) -> Self
Create a rotation matrix around the Z axis by angle radians.
Sourcepub fn mul_point(self, p: Point3) -> Point3
pub fn mul_point(self, p: Point3) -> Point3
Transform a 3D point by this matrix (assumes w = 1).
Sourcepub fn determinant(self) -> f64
pub fn determinant(self) -> f64
Compute the determinant using cofactor expansion along the first row.
Trait Implementations§
impl Copy for Mat4
Source§impl<'de> Deserialize<'de> for Mat4
impl<'de> Deserialize<'de> for Mat4
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
impl StructuralPartialEq for Mat4
Auto Trait Implementations§
impl Freeze for Mat4
impl RefUnwindSafe for Mat4
impl Send for Mat4
impl Sync for Mat4
impl Unpin for Mat4
impl UnsafeUnpin for Mat4
impl UnwindSafe for Mat4
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