Struct vg::Transform2D
source · [−]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
sourceimpl 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
sourceimpl Clone for Transform2D
impl Clone for Transform2D
sourcefn clone(&self) -> Transform2D
fn clone(&self) -> Transform2D
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for Transform2D
impl Debug for Transform2D
sourceimpl Default for Transform2D
impl Default for Transform2D
sourceimpl Index<usize> for Transform2D
impl Index<usize> for Transform2D
sourceimpl IndexMut<usize> for Transform2D
impl IndexMut<usize> for Transform2D
sourceimpl PartialEq<Transform2D> for Transform2D
impl PartialEq<Transform2D> for Transform2D
sourcefn eq(&self, other: &Transform2D) -> bool
fn eq(&self, other: &Transform2D) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &Transform2D) -> bool
fn ne(&self, other: &Transform2D) -> bool
This method tests for !=
.
sourceimpl PartialOrd<Transform2D> for Transform2D
impl PartialOrd<Transform2D> for Transform2D
sourcefn partial_cmp(&self, other: &Transform2D) -> Option<Ordering>
fn partial_cmp(&self, other: &Transform2D) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for Transform2D
impl StructuralPartialEq for Transform2D
Auto Trait Implementations
impl RefUnwindSafe for Transform2D
impl Send for Transform2D
impl Sync for Transform2D
impl Unpin for Transform2D
impl UnwindSafe for Transform2D
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more