Allow only uniform scaling in Transformation
This commit is contained in:
parent
aa41d7656e
commit
a6e91d13d5
4 changed files with 16 additions and 21 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue