From a6e91d13d5d43796d0e6bb570fb4f010cf27921a Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 24 Oct 2023 03:18:03 +0200 Subject: Allow only uniform scaling in `Transformation` --- graphics/src/transformation.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'graphics/src/transformation.rs') diff --git a/graphics/src/transformation.rs b/graphics/src/transformation.rs index 1aeb691e..e2642980 100644 --- a/graphics/src/transformation.rs +++ b/graphics/src/transformation.rs @@ -26,21 +26,16 @@ impl Transformation { Transformation(Mat4::from_translation(Vec3::new(x, y, 0.0))) } - /// Creates a scale transformation. - pub fn scale(x: f32, y: f32) -> Transformation { - Transformation(Mat4::from_scale(Vec3::new(x, y, 1.0))) + /// Creates a uniform scaling transformation. + pub fn scale(scaling: f32) -> Transformation { + Transformation(Mat4::from_scale(Vec3::new(scaling, scaling, 1.0))) } - /// The scale factor on the X axis. - pub fn scale_x(&self) -> f32 { + /// The scale factor of the [`Transformation`]. + pub fn scale_factor(&self) -> f32 { self.0.x_axis.x } - /// The scale factor on the Y axis. - pub fn scale_y(&self) -> f32 { - self.0.y_axis.y - } - /// The translation on the X axis. pub fn translation_x(&self) -> f32 { self.0.w_axis.x -- cgit