diff options
| author | Juan Linietsky <reduzio@gmail.com> | 2017-01-03 23:20:20 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-01-03 23:20:20 -0300 |
| commit | 3a0c19d3f6ddb26359c95d84c376a8e6b1afd04d (patch) | |
| tree | 8e313066ce55a3366cd6b972ff429372583cda28 /core/math/quat.h | |
| parent | f2e99826c0b1e8227644bfab0795d858c504d279 (diff) | |
| parent | bd7ba0b664fa98381db9ef8edb69ba211213d595 (diff) | |
| download | redot-engine-3a0c19d3f6ddb26359c95d84c376a8e6b1afd04d.tar.gz | |
Merge pull request #6865 from tagcup/godot_issue_6816
Use right handed coordinate system for rotation matrices and quaternions. Also fixed Euler angles (XYZ convention).
Diffstat (limited to 'core/math/quat.h')
| -rw-r--r-- | core/math/quat.h | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/core/math/quat.h b/core/math/quat.h index 9f4145cddb..40c048006f 100644 --- a/core/math/quat.h +++ b/core/math/quat.h @@ -49,15 +49,16 @@ public: Quat inverse() const; _FORCE_INLINE_ real_t dot(const Quat& q) const; void set_euler(const Vector3& p_euler); + Vector3 get_euler() const; Quat slerp(const Quat& q, const real_t& t) const; Quat slerpni(const Quat& q, const real_t& t) const; Quat cubic_slerp(const Quat& q, const Quat& prep, const Quat& postq,const real_t& t) const; _FORCE_INLINE_ void get_axis_and_angle(Vector3& r_axis, real_t &r_angle) const { r_angle = 2 * Math::acos(w); - r_axis.x = -x / Math::sqrt(1-w*w); - r_axis.y = -y / Math::sqrt(1-w*w); - r_axis.z = -z / Math::sqrt(1-w*w); + r_axis.x = x / Math::sqrt(1-w*w); + r_axis.y = y / Math::sqrt(1-w*w); + r_axis.z = z / Math::sqrt(1-w*w); } void operator*=(const Quat& q); @@ -183,12 +184,10 @@ Quat Quat::operator/(const real_t& s) const { bool Quat::operator==(const Quat& p_quat) const { - return x==p_quat.x && y==p_quat.y && z==p_quat.z && w==p_quat.w; } bool Quat::operator!=(const Quat& p_quat) const { - return x!=p_quat.x || y!=p_quat.y || z!=p_quat.z || w!=p_quat.w; } |
