diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-06-18 12:35:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-18 12:35:14 +0200 |
commit | 3fc39954ec3473cc022af615c5eb8b1ba271e008 (patch) | |
tree | 90b2c8ccc77e6775b0fe9eae0037089ae77c0c48 /core/math/transform_2d.cpp | |
parent | 3e8620c2759e6a457ea48b159bd6664d8d98b272 (diff) | |
parent | bd6ed3fb091d2d541f85e4152f0538088a3956db (diff) |
Merge pull request #49638 from aaronfranke/multiply-transforms
Allow multiplying Transforms and Basis by numbers
Diffstat (limited to 'core/math/transform_2d.cpp')
-rw-r--r-- | core/math/transform_2d.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/math/transform_2d.cpp b/core/math/transform_2d.cpp index 0140f31b8a..16934d67df 100644 --- a/core/math/transform_2d.cpp +++ b/core/math/transform_2d.cpp @@ -276,6 +276,18 @@ Transform2D Transform2D::interpolate_with(const Transform2D &p_transform, real_t return res; } +void Transform2D::operator*=(const real_t p_val) { + elements[0] *= p_val; + elements[1] *= p_val; + elements[2] *= p_val; +} + +Transform2D Transform2D::operator*(const real_t p_val) const { + Transform2D ret(*this); + ret *= p_val; + return ret; +} + Transform2D::operator String() const { return "[X: " + elements[0].operator String() + ", Y: " + elements[1].operator String() + |