pub struct Transform {
pub xx: f32,
pub xy: f32,
pub yx: f32,
pub yy: f32,
pub x: f32,
pub y: f32,
}
Expand description
Two dimensional transformation matrix.
Fields§
§xx: f32
§xy: f32
§yx: f32
§yy: f32
§x: f32
§y: f32
Implementations§
source§impl Transform
impl Transform
sourcepub fn new(xx: f32, xy: f32, yx: f32, yy: f32, x: f32, y: f32) -> Transform
pub fn new(xx: f32, xy: f32, yx: f32, yy: f32, x: f32, y: f32) -> Transform
Creates a new transform.
sourcepub fn translation(x: f32, y: f32) -> Transform
pub fn translation(x: f32, y: f32) -> Transform
Creates a translation transform.
sourcepub fn rotation_about(point: impl Into<Vector>, angle: Angle) -> Transform
pub fn rotation_about(point: impl Into<Vector>, angle: Angle) -> Transform
Creates a rotation transform around a point.
sourcepub fn then(&self, other: &Transform) -> Transform
pub fn then(&self, other: &Transform) -> Transform
Returns a new transform that represents the application of this transform followed by other.
sourcepub fn pre_translate(&self, x: f32, y: f32) -> Transform
pub fn pre_translate(&self, x: f32, y: f32) -> Transform
Returns a new transform that represents a translation followed by this transform.
sourcepub fn then_translate(&self, x: f32, y: f32) -> Transform
pub fn then_translate(&self, x: f32, y: f32) -> Transform
Returns a new transform that represents this transform followed by a translation.
sourcepub fn pre_rotate(&self, angle: Angle) -> Transform
pub fn pre_rotate(&self, angle: Angle) -> Transform
Returns a new transform that represents a rotation followed by this transform.
sourcepub fn then_rotate(&self, angle: Angle) -> Transform
pub fn then_rotate(&self, angle: Angle) -> Transform
Returns a new transform that represents this transform followed by a rotation.
sourcepub fn pre_scale(&self, x: f32, y: f32) -> Transform
pub fn pre_scale(&self, x: f32, y: f32) -> Transform
Returns a new transform that represents a scale followed by this transform.
sourcepub fn then_scale(&self, x: f32, y: f32) -> Transform
pub fn then_scale(&self, x: f32, y: f32) -> Transform
Returns a new transform that represents this transform followed by a scale.
sourcepub fn determinant(&self) -> f32
pub fn determinant(&self) -> f32
Returns the determinant of the transform.
sourcepub fn transform_point(&self, point: Vector) -> Vector
pub fn transform_point(&self, point: Vector) -> Vector
Returns the result of applying this transform to a point.
sourcepub fn transform_vector(&self, vector: Vector) -> Vector
pub fn transform_vector(&self, vector: Vector) -> Vector
Returns the result of applying this transform to a vector.
Trait Implementations§
impl Copy for Transform
Auto Trait Implementations§
impl Freeze for Transform
impl RefUnwindSafe for Transform
impl Send for Transform
impl Sync for Transform
impl Unpin for Transform
impl UnwindSafe for Transform
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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>
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>
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