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.