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) -> Self
pub fn new(xx: f32, xy: f32, yx: f32, yy: f32, x: f32, y: f32) -> Self
Creates a new transform.
sourcepub fn translation(x: f32, y: f32) -> Self
pub fn translation(x: f32, y: f32) -> Self
Creates a translation transform.
sourcepub fn rotation_about(point: impl Into<Point>, angle: Angle) -> Self
pub fn rotation_about(point: impl Into<Point>, angle: Angle) -> Self
Creates a rotation transform around a point.
sourcepub fn then(&self, other: &Transform) -> Self
pub fn then(&self, other: &Transform) -> Self
Returns a new transform that represents the application of this transform followed by other.
sourcepub fn pre_translate(&self, x: f32, y: f32) -> Self
pub fn pre_translate(&self, x: f32, y: f32) -> Self
Returns a new transform that represents a translation followed by this transform.
sourcepub fn then_translate(&self, x: f32, y: f32) -> Self
pub fn then_translate(&self, x: f32, y: f32) -> Self
Returns a new transform that represents this transform followed by a translation.
sourcepub fn pre_rotate(&self, angle: Angle) -> Self
pub fn pre_rotate(&self, angle: Angle) -> Self
Returns a new transform that represents a rotation followed by this transform.
sourcepub fn then_rotate(&self, angle: Angle) -> Self
pub fn then_rotate(&self, angle: Angle) -> Self
Returns a new transform that represents this transform followed by a rotation.
sourcepub fn pre_scale(&self, x: f32, y: f32) -> Self
pub fn pre_scale(&self, x: f32, y: f32) -> Self
Returns a new transform that represents a scale followed by this transform.
sourcepub fn then_scale(&self, x: f32, y: f32) -> Self
pub fn then_scale(&self, x: f32, y: f32) -> Self
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: Point) -> Point
pub fn transform_point(&self, point: Point) -> Point
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
)