pub struct Transform2D(pub [f32; 6]);Expand description
2×3 matrix (2 rows, 3 columns) used for 2D linear transformations.
It can represent transformations such as translation, rotation, or scaling.
Tuple Fields§
§0: [f32; 6]Implementations§
Source§impl Transform2D
impl Transform2D
Sourcepub fn identity() -> Self
pub fn identity() -> Self
Creates an identity transformation with no translation, rotation or scaling applied.
Sourcepub fn new_translation(x: f32, y: f32) -> Self
pub fn new_translation(x: f32, y: f32) -> Self
Creates transformation with translation
Sourcepub fn premultiply(&mut self, other: &Self)
pub fn premultiply(&mut self, other: &Self)
PreMultiply transformation
Sourcepub fn transform_point(&self, sx: f32, sy: f32) -> (f32, f32)
pub fn transform_point(&self, sx: f32, sy: f32) -> (f32, f32)
Transfor point with transformation
Sourcepub fn average_scale(&self) -> f32
pub fn average_scale(&self) -> f32
Retrieve average scale
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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Transform2D
impl Debug for Transform2D
Source§impl Default for Transform2D
impl Default for Transform2D
Source§impl Index<usize> for Transform2D
impl Index<usize> for Transform2D
Source§impl IndexMut<usize> for Transform2D
impl IndexMut<usize> for Transform2D
Source§impl PartialEq for Transform2D
impl PartialEq for Transform2D
Source§impl PartialOrd for Transform2D
impl PartialOrd for Transform2D
impl Copy for Transform2D
impl StructuralPartialEq for Transform2D
Auto Trait Implementations§
impl Freeze for Transform2D
impl RefUnwindSafe for Transform2D
impl Send for Transform2D
impl Sync for Transform2D
impl Unpin 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