#[repr(C)]pub struct Transform2D {
pub a: f32,
pub b: f32,
pub c: f32,
pub d: f32,
pub tx: f32,
pub ty: f32,
}Expand description
2x3 Affine Transformation Matrix.
| a c tx | | b d ty | | 0 0 1 |
Fields§
§a: f32§b: f32§c: f32§d: f32§tx: f32§ty: f32Implementations§
Source§impl Transform2D
impl Transform2D
pub const IDENTITY: Self
pub const fn translation(tx: f32, ty: f32) -> Self
pub const fn scale(sx: f32, sy: f32) -> Self
pub fn rotation(radians: f32) -> Self
pub fn transform_point(self, p: Point<f32>) -> Point<f32>
Sourcepub const fn from_w3c(a: f32, b: f32, c: f32, d: f32, e: f32, f: f32) -> Self
pub const fn from_w3c(a: f32, b: f32, c: f32, d: f32, e: f32, f: f32) -> Self
Creates a 2D affine transform from standard W3C 6-parameter coefficients:
a (scale x), b (shear y), c (shear x), d (scale y), e (translate x), f (translate y).
pub fn transform_xy(&self, x: f32, y: f32) -> (f32, f32)
pub fn translate(&mut self, dx: f32, dy: f32)
pub fn scale_mut(&mut self, sx: f32, sy: f32)
pub fn rotate_mut(&mut self, radians: f32)
Sourcepub fn multiply(self, rhs: Self) -> Self
pub fn multiply(self, rhs: Self) -> Self
Concatenates this transform with another (self * other).
Sourcepub fn determinant(self) -> f32
pub fn determinant(self) -> f32
Computes determinant of transformation.
Trait Implementations§
Source§impl Clone for Transform2D
impl Clone for Transform2D
impl Copy for Transform2D
Source§impl Debug for Transform2D
impl Debug for Transform2D
Source§impl Default for Transform2D
impl Default for Transform2D
Source§impl PartialEq for Transform2D
impl PartialEq for Transform2D
impl StructuralPartialEq for Transform2D
Auto Trait Implementations§
impl Forget for Transform2D
impl Freeze for Transform2D
impl Move for Transform2D
impl RefUnwindSafe for Transform2D
impl Send for Transform2D
impl Sync for Transform2D
impl Unpin for Transform2D
impl UnsafeUnpin for Transform2D
impl UnwindSafe for Transform2D
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