pub struct Transform2D(pub [[f32; 3]; 3]);
Expand description
Represents a 2D affine transformation matrix
Tuple Fields§
§0: [[f32; 3]; 3]
Implementations§
Source§impl Transform2D
impl Transform2D
Sourcepub fn transform_point(&self, x: f32, y: f32) -> (f32, f32)
pub fn transform_point(&self, x: f32, y: f32) -> (f32, f32)
Applies this transformation to a point, returning the transformed point
Sourcepub fn identity() -> Transform2D
pub fn identity() -> Transform2D
Creates the identity transform
Sourcepub fn translate(x: f32, y: f32) -> Transform2D
pub fn translate(x: f32, y: f32) -> Transform2D
Creates a translation transformation
Sourcepub fn scale(scale_x: f32, scale_y: f32) -> Transform2D
pub fn scale(scale_x: f32, scale_y: f32) -> Transform2D
Creates a scaling transformation
Sourcepub fn rotate_degrees(degrees: f32) -> Transform2D
pub fn rotate_degrees(degrees: f32) -> Transform2D
Creates a transformation that’s a rotation in degrees
Sourcepub fn rotate(radians: f32) -> Transform2D
pub fn rotate(radians: f32) -> Transform2D
Creates a rotation transformation
Sourcepub fn invert(&self) -> Option<Transform2D>
pub fn invert(&self) -> Option<Transform2D>
Returns an inverted Transform2D
Trait Implementations§
Source§impl CanvasEncoding<String> for Transform2D
impl CanvasEncoding<String> for Transform2D
Source§fn encode_canvas(&self, append_to: &mut String)
fn encode_canvas(&self, append_to: &mut String)
Encodes this item by appending it to the specified string
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§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for Transform2D
impl Debug for Transform2D
Source§impl<'de> Deserialize<'de> for Transform2D
impl<'de> Deserialize<'de> for Transform2D
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<SpriteTransform> for Transform2D
impl From<SpriteTransform> for Transform2D
Source§fn from(sprite_transform: SpriteTransform) -> Transform2D
fn from(sprite_transform: SpriteTransform) -> Transform2D
Converts to this type from the input type.
Source§impl Mul<&Transform2D> for &Transform2D
impl Mul<&Transform2D> for &Transform2D
Source§type Output = Transform2D
type Output = Transform2D
The resulting type after applying the
*
operator.Source§fn mul(self, other: &Transform2D) -> Transform2D
fn mul(self, other: &Transform2D) -> Transform2D
Performs the
*
operation. Read moreSource§impl Mul for Transform2D
impl Mul for Transform2D
Source§type Output = Transform2D
type Output = Transform2D
The resulting type after applying the
*
operator.Source§fn mul(self, other: Transform2D) -> Transform2D
fn mul(self, other: Transform2D) -> Transform2D
Performs the
*
operation. Read moreSource§impl PartialEq for Transform2D
impl PartialEq for Transform2D
Source§impl Serialize for Transform2D
impl Serialize 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more