diff options
Diffstat (limited to 'core/math/quat.cpp')
-rw-r--r-- | core/math/quat.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/core/math/quat.cpp b/core/math/quat.cpp index 61cd41b23d..c10f5da494 100644 --- a/core/math/quat.cpp +++ b/core/math/quat.cpp @@ -107,7 +107,6 @@ Vector3 Quat::get_euler_yxz() const { } void Quat::operator*=(const Quat &q) { - set(w * q.x + x * q.w + y * q.z - z * q.y, w * q.y + y * q.w + z * q.x - x * q.z, w * q.z + z * q.w + x * q.y - y * q.x, @@ -115,19 +114,16 @@ void Quat::operator*=(const Quat &q) { } Quat Quat::operator*(const Quat &q) const { - Quat r = *this; r *= q; return r; } bool Quat::is_equal_approx(const Quat &p_quat) const { - return Math::is_equal_approx(x, p_quat.x) && Math::is_equal_approx(y, p_quat.y) && Math::is_equal_approx(z, p_quat.z) && Math::is_equal_approx(w, p_quat.w); } real_t Quat::length() const { - return Math::sqrt(length_squared()); } @@ -206,7 +202,9 @@ Quat Quat::slerpni(const Quat &q, const real_t &t) const { real_t dot = from.dot(q); - if (Math::absf(dot) > 0.9999) return from; + if (Math::absf(dot) > 0.9999) { + return from; + } real_t theta = Math::acos(dot), sinT = 1.0 / Math::sin(theta), @@ -232,7 +230,6 @@ Quat Quat::cubic_slerp(const Quat &q, const Quat &prep, const Quat &postq, const } Quat::operator String() const { - return String::num(x) + ", " + String::num(y) + ", " + String::num(z) + ", " + String::num(w); } @@ -241,9 +238,9 @@ void Quat::set_axis_angle(const Vector3 &axis, const real_t &angle) { ERR_FAIL_COND_MSG(!axis.is_normalized(), "The axis Vector3 must be normalized."); #endif real_t d = axis.length(); - if (d == 0) + if (d == 0) { set(0, 0, 0, 0); - else { + } else { real_t sin_angle = Math::sin(angle * 0.5); real_t cos_angle = Math::cos(angle * 0.5); real_t s = sin_angle / d; |