diff options
| author | tagcup | 2017-12-26 19:15:20 -0500 |
|---|---|---|
| committer | tagcup | 2017-12-27 16:40:49 -0500 |
| commit | e9896b17a9804ba6392dab0bd6c484f4d2e294c1 (patch) | |
| tree | d35e6d3097458c56ef07021155b9de855a89eae4 /core/math/matrix3.cpp | |
| parent | c2240a2a714526e226ead5a20e3a070bb3eaaef6 (diff) | |
| download | godot-e9896b17a9804ba6392dab0bd6c484f4d2e294c1.tar.gz godot-e9896b17a9804ba6392dab0bd6c484f4d2e294c1.tar.zst godot-e9896b17a9804ba6392dab0bd6c484f4d2e294c1.zip | |
Diffstat (limited to 'core/math/matrix3.cpp')
| -rw-r--r-- | core/math/matrix3.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/core/math/matrix3.cpp b/core/math/matrix3.cpp index 534614147..bef5cf4fb 100644 --- a/core/math/matrix3.cpp +++ b/core/math/matrix3.cpp @@ -228,12 +228,24 @@ void Basis::scale(const Vector3 &p_scale) { } Basis Basis::scaled(const Vector3 &p_scale) const { - Basis m = *this; m.scale(p_scale); return m; } +void Basis::scale_local(const Vector3 &p_scale) { + // performs a scaling in object-local coordinate system: + // M -> (M.S.Minv).M = M.S. + *this = scaled_local(p_scale); +} + +Basis Basis::scaled_local(const Vector3 &p_scale) const { + Basis b; + b.set_scale(p_scale); + + return (*this) * b; +} + void Basis::set_scale(const Vector3 &p_scale) { set_axis(0, get_axis(0).normalized() * p_scale.x); @@ -312,7 +324,8 @@ void Basis::rotate(const Vector3 &p_axis, real_t p_phi) { } void Basis::rotate_local(const Vector3 &p_axis, real_t p_phi) { - + // performs a rotation in object-local coordinate system: + // M -> (M.R.Minv).M = M.R. *this = rotated_local(p_axis, p_phi); } Basis Basis::rotated_local(const Vector3 &p_axis, real_t p_phi) const { |
