#[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: Transform2D
pub const fn translation(tx: f32, ty: f32) -> Transform2D
pub const fn scale(sx: f32, sy: f32) -> Transform2D
pub fn rotation(radians: f32) -> Transform2D
pub fn transform_point(self, p: Point) -> Point
Sourcepub const fn from_w3c(
a: f32,
b: f32,
c: f32,
d: f32,
e: f32,
f: f32,
) -> Transform2D
pub const fn from_w3c( a: f32, b: f32, c: f32, d: f32, e: f32, f: f32, ) -> Transform2D
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: Transform2D) -> Transform2D
pub fn multiply(self, rhs: Transform2D) -> Transform2D
Concatenates this transform with another (self * other).
Sourcepub fn determinant(self) -> f32
pub fn determinant(self) -> f32
Computes determinant of transformation.
Sourcepub fn inverse(self) -> Option<Transform2D>
pub fn inverse(self) -> Option<Transform2D>
Inverts the affine transform if non-singular.
Trait Implementations§
Source§impl Clone for Transform2D
impl Clone for Transform2D
Source§fn clone(&self) -> Transform2D
fn clone(&self) -> Transform2D
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for Transform2D
Source§impl Debug for Transform2D
impl Debug for Transform2D
Source§impl Default for Transform2D
impl Default for Transform2D
Source§fn default() -> Transform2D
fn default() -> Transform2D
Returns the “default value” for a type. Read more
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