@@ -13,22 +13,27 @@ impl Transformation {
1313
1414 /// Creates an orthographic projection.
1515 #[ rustfmt:: skip]
16- pub fn orthographic ( width : u32 , height : u32 ) -> Transformation {
17- Transformation ( Mat4 :: orthographic_rh_gl (
16+ pub fn orthographic ( width : u32 , height : u32 ) -> Self {
17+ Self ( Mat4 :: orthographic_rh_gl (
1818 0.0 , width as f32 ,
1919 height as f32 , 0.0 ,
2020 -1.0 , 1.0
2121 ) )
2222 }
2323
2424 /// Creates a translate transformation.
25- pub fn translate ( x : f32 , y : f32 ) -> Transformation {
26- Transformation ( Mat4 :: from_translation ( Vec3 :: new ( x, y, 0.0 ) ) )
25+ pub fn translate ( x : f32 , y : f32 ) -> Self {
26+ Self ( Mat4 :: from_translation ( Vec3 :: new ( x, y, 0.0 ) ) )
2727 }
2828
2929 /// Creates a uniform scaling transformation.
30- pub fn scale ( scaling : f32 ) -> Transformation {
31- Transformation ( Mat4 :: from_scale ( Vec3 :: new ( scaling, scaling, 1.0 ) ) )
30+ pub fn scale ( scaling : f32 ) -> Self {
31+ Self ( Mat4 :: from_scale ( Vec3 :: new ( scaling, scaling, 1.0 ) ) )
32+ }
33+
34+ /// Returns the inverse of the [`Transformation`].
35+ pub fn inverse ( self ) -> Self {
36+ Self ( self . 0 . inverse ( ) )
3237 }
3338
3439 /// Returns the scale factor of the [`Transformation`].
@@ -52,7 +57,7 @@ impl Mul for Transformation {
5257 type Output = Self ;
5358
5459 fn mul ( self , rhs : Self ) -> Self {
55- Transformation ( self . 0 * rhs. 0 )
60+ Self ( self . 0 * rhs. 0 )
5661 }
5762}
5863
0 commit comments