diff options
author | Ferenc Arn <tagcup@yahoo.com> | 2017-08-29 21:47:59 -0400 |
---|---|---|
committer | Ferenc Arn <tagcup@yahoo.com> | 2017-08-29 21:47:59 -0400 |
commit | a0bbf5c9afd0822d5f392c91fff37ecd4315647a (patch) | |
tree | 50ff8abf4b5d639ae6437edc6b17dd702b788f17 /core | |
parent | efcafab6255ea78365e519ca3a13e9bf8b2a81d4 (diff) |
Remove Basis::set_scale and Basis::set_rotation_* functions.
Those functions were added in #8277 but they did more harm than good. They're subtle, don't do what people think and requires users to understand the non-uniqueness of polar decomposition. They ended up confusing people.
Until we store additional information enough to make a unique polar decomposition, these functions shouldn't be a part of Basis.
Diffstat (limited to 'core')
-rw-r--r-- | core/math/matrix3.cpp | 33 | ||||
-rw-r--r-- | core/math/matrix3.h | 4 | ||||
-rw-r--r-- | core/variant_call.cpp | 6 |
3 files changed, 0 insertions, 43 deletions
diff --git a/core/math/matrix3.cpp b/core/math/matrix3.cpp index c7e2a8f307..57555bbb2a 100644 --- a/core/math/matrix3.cpp +++ b/core/math/matrix3.cpp @@ -254,17 +254,6 @@ Vector3 Basis::get_scale() const { Vector3(elements[0][2], elements[1][2], elements[2][2]).length()); } -// Sets scaling while preserving rotation. -// This requires some care when working with matrices with negative determinant, -// since we're using a particular convention for "polar" decomposition in get_scale and get_rotation. -// For details, see the explanation in get_scale. -void Basis::set_scale(const Vector3 &p_scale) { - Vector3 e = get_euler(); - Basis(); // reset to identity - scale(p_scale); - rotate(e); -} - // Multiplies the matrix from left by the rotation matrix: M -> R.M // Note that this does *not* rotate the matrix itself. // @@ -316,28 +305,6 @@ void Basis::get_rotation_axis_angle(Vector3 &p_axis, real_t &p_angle) const { m.get_axis_angle(p_axis, p_angle); } -// Sets rotation while preserving scaling. -// This requires some care when working with matrices with negative determinant, -// since we're using a particular convention for "polar" decomposition in get_scale and get_rotation. -// For details, see the explanation in get_scale. -void Basis::set_rotation_euler(const Vector3 &p_euler) { - Vector3 s = get_scale(); - Basis(); // reset to identity - scale(s); - rotate(p_euler); -} - -// Sets rotation while preserving scaling. -// This requires some care when working with matrices with negative determinant, -// since we're using a particular convention for "polar" decomposition in get_scale and get_rotation. -// For details, see the explanation in get_scale. -void Basis::set_rotation_axis_angle(const Vector3 &p_axis, real_t p_angle) { - Vector3 s = get_scale(); - Basis(); // reset to identity - scale(s); - rotate(p_axis, p_angle); -} - // get_euler_xyz returns a vector containing the Euler angles in the format // (a1,a2,a3), where a3 is the angle of the first rotation, and a1 is the last // (following the convention they are commonly defined in the literature). diff --git a/core/math/matrix3.h b/core/math/matrix3.h index be85c244bd..be8de2e1c4 100644 --- a/core/math/matrix3.h +++ b/core/math/matrix3.h @@ -81,9 +81,6 @@ public: Vector3 get_rotation() const; void get_rotation_axis_angle(Vector3 &p_axis, real_t &p_angle) const; - void set_rotation_euler(const Vector3 &p_euler); - void set_rotation_axis_angle(const Vector3 &p_axis, real_t p_angle); - Vector3 get_euler_xyz() const; void set_euler_xyz(const Vector3 &p_euler); Vector3 get_euler_yxz() const; @@ -99,7 +96,6 @@ public: Basis scaled(const Vector3 &p_scale) const; Vector3 get_scale() const; - void set_scale(const Vector3 &p_scale); // transposed dot products _FORCE_INLINE_ real_t tdotx(const Vector3 &v) const { diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 77372d1e60..ad15f8f5cb 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -729,9 +729,6 @@ struct _VariantCall { VCALL_PTR1R(Basis, scaled); VCALL_PTR0R(Basis, get_scale); VCALL_PTR0R(Basis, get_euler); - VCALL_PTR1(Basis, set_scale); - VCALL_PTR1(Basis, set_rotation_euler); - VCALL_PTR2(Basis, set_rotation_axis_angle); VCALL_PTR1R(Basis, tdotx); VCALL_PTR1R(Basis, tdoty); VCALL_PTR1R(Basis, tdotz); @@ -1700,9 +1697,6 @@ void register_variant_methods() { ADDFUNC0(BASIS, REAL, Basis, determinant, varray()); ADDFUNC2(BASIS, BASIS, Basis, rotated, VECTOR3, "axis", REAL, "phi", varray()); ADDFUNC1(BASIS, BASIS, Basis, scaled, VECTOR3, "scale", varray()); - ADDFUNC1(BASIS, NIL, Basis, set_scale, VECTOR3, "scale", varray()); - ADDFUNC1(BASIS, NIL, Basis, set_rotation_euler, VECTOR3, "euler", varray()); - ADDFUNC2(BASIS, NIL, Basis, set_rotation_axis_angle, VECTOR3, "axis", REAL, "angle", varray()); ADDFUNC0(BASIS, VECTOR3, Basis, get_scale, varray()); ADDFUNC0(BASIS, VECTOR3, Basis, get_euler, varray()); ADDFUNC1(BASIS, REAL, Basis, tdotx, VECTOR3, "with", varray()); |