pub struct Matrix {
pub a: f64,
pub b: f64,
pub c: f64,
pub d: f64,
pub tx: f64,
pub ty: f64,
}Expand description
Affine transformation matrix [a, b, c, d, tx, ty].
Transforms point (x, y) to: x’ = ax + cy + tx y’ = bx + dy + ty
Fields§
§a: f64§b: f64§c: f64§d: f64§tx: f64§ty: f64Implementations§
Source§impl Matrix
impl Matrix
Sourcepub fn new(a: f64, b: f64, c: f64, d: f64, tx: f64, ty: f64) -> Matrix
pub fn new(a: f64, b: f64, c: f64, d: f64, tx: f64, ty: f64) -> Matrix
Create from 6 components.
Sourcepub fn multiply(&self, other: &Matrix) -> Matrix
pub fn multiply(&self, other: &Matrix) -> Matrix
Column-vector multiply: self × other.
Composes two transforms: the result applies other first, then self.
Sourcepub fn concat(&self, other: &Matrix) -> Matrix
pub fn concat(&self, other: &Matrix) -> Matrix
PostScript concat: CTM = other × CTM (row-vector convention).
Uses column-vector multiply internally: self.multiply(other).
Sourcepub fn transform_delta(&self, dx: f64, dy: f64) -> (f64, f64)
pub fn transform_delta(&self, dx: f64, dy: f64) -> (f64, f64)
Transform a delta (no translation).
Sourcepub fn determinant(&self) -> f64
pub fn determinant(&self) -> f64
Determinant.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Matrix
impl RefUnwindSafe for Matrix
impl Send for Matrix
impl Sync for Matrix
impl Unpin for Matrix
impl UnsafeUnpin for Matrix
impl UnwindSafe for Matrix
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