pub struct Matrix2D {
pub a: f64,
pub b: f64,
pub c: f64,
pub d: f64,
pub h: f64,
pub v: f64,
}Expand description
A 2D affine transformation matrix.
Fields§
§a: f64§b: f64§c: f64§d: f64§h: f64§v: f64Implementations§
Source§impl Matrix2D
impl Matrix2D
Sourcepub fn new(a: f64, b: f64, c: f64, d: f64, h: f64, v: f64) -> Self
pub fn new(a: f64, b: f64, c: f64, d: f64, h: f64, v: f64) -> Self
Create a new matrix with explicit components.
Sourcepub fn translation(h: f64, v: f64) -> Self
pub fn translation(h: f64, v: f64) -> Self
Create a translation matrix.
Sourcepub fn multiply(&self, other: &Matrix2D) -> Matrix2D
pub fn multiply(&self, other: &Matrix2D) -> Matrix2D
Multiply this matrix by another: self * other.
This concatenates transformations: first other is applied, then self.
Sourcepub fn concat(&self, other: &Matrix2D) -> Matrix2D
pub fn concat(&self, other: &Matrix2D) -> Matrix2D
Concatenate: equivalent to other * self (apply self first, then other).
Sourcepub fn determinant(&self) -> f64
pub fn determinant(&self) -> f64
Compute the determinant.
Sourcepub fn inverse(&self) -> Option<Matrix2D>
pub fn inverse(&self) -> Option<Matrix2D>
Compute the inverse matrix. Returns None if the matrix is singular.
Sourcepub fn transform_point(&self, x: f64, y: f64) -> Point
pub fn transform_point(&self, x: f64, y: f64) -> Point
Transform a point through this matrix.
Trait Implementations§
impl Copy for Matrix2D
impl StructuralPartialEq for Matrix2D
Auto Trait Implementations§
impl Freeze for Matrix2D
impl RefUnwindSafe for Matrix2D
impl Send for Matrix2D
impl Sync for Matrix2D
impl Unpin for Matrix2D
impl UnsafeUnpin for Matrix2D
impl UnwindSafe for Matrix2D
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