pub struct Matrix4 {
pub m: [[f64; 4]; 4],
}Expand description
4x4 transformation matrix for 3D operations
Fields§
§m: [[f64; 4]; 4]Matrix elements stored in row-major order
Implementations§
Source§impl Matrix4
impl Matrix4
Sourcepub fn translation(tx: f64, ty: f64, tz: f64) -> Self
pub fn translation(tx: f64, ty: f64, tz: f64) -> Self
Create translation matrix
Sourcepub fn scaling_with_origin(sx: f64, sy: f64, sz: f64, origin: Vector3) -> Self
pub fn scaling_with_origin(sx: f64, sy: f64, sz: f64, origin: Vector3) -> Self
Create scaling matrix with origin
Sourcepub fn rotation_x(angle: f64) -> Self
pub fn rotation_x(angle: f64) -> Self
Create rotation matrix around X axis
Sourcepub fn rotation_y(angle: f64) -> Self
pub fn rotation_y(angle: f64) -> Self
Create rotation matrix around Y axis
Sourcepub fn rotation_z(angle: f64) -> Self
pub fn rotation_z(angle: f64) -> Self
Create rotation matrix around Z axis
Sourcepub fn rotation(axis: Vector3, angle: f64) -> Self
pub fn rotation(axis: Vector3, angle: f64) -> Self
Create rotation matrix around arbitrary axis (Rodrigues’ rotation formula)
Sourcepub fn from_matrix3(m3: Matrix3) -> Self
pub fn from_matrix3(m3: Matrix3) -> Self
Create matrix from Matrix3 (3x3 rotation/scale portion)
Sourcepub fn to_matrix3(&self) -> Matrix3
pub fn to_matrix3(&self) -> Matrix3
Get the 3x3 rotation/scale portion
Sourcepub fn transform_point(&self, v: Vector3) -> Vector3
pub fn transform_point(&self, v: Vector3) -> Vector3
Transform a point (applies full transformation including translation)
Sourcepub fn transform_direction(&self, v: Vector3) -> Vector3
pub fn transform_direction(&self, v: Vector3) -> Vector3
Transform a direction vector (ignores translation)
Trait Implementations§
impl Copy for Matrix4
impl StructuralPartialEq for Matrix4
Auto Trait Implementations§
impl Freeze for Matrix4
impl RefUnwindSafe for Matrix4
impl Send for Matrix4
impl Sync for Matrix4
impl Unpin for Matrix4
impl UnsafeUnpin for Matrix4
impl UnwindSafe for Matrix4
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