summaryrefslogtreecommitdiff
path: root/core/math/quaternion.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/math/quaternion.h')
-rw-r--r--core/math/quaternion.h15
1 files changed, 6 insertions, 9 deletions
diff --git a/core/math/quaternion.h b/core/math/quaternion.h
index 43d7bffcfc..c5af2121d9 100644
--- a/core/math/quaternion.h
+++ b/core/math/quaternion.h
@@ -31,10 +31,10 @@
#ifndef QUATERNION_H
#define QUATERNION_H
-#include "core/math/math_defs.h"
#include "core/math/math_funcs.h"
#include "core/math/vector3.h"
-#include "core/string/ustring.h"
+
+class String;
struct _NO_DISCARD_ Quaternion {
union {
@@ -55,6 +55,7 @@ struct _NO_DISCARD_ Quaternion {
}
_FORCE_INLINE_ real_t length_squared() const;
bool is_equal_approx(const Quaternion &p_quaternion) const;
+ bool is_finite() const;
real_t length() const;
void normalize();
Quaternion normalized() const;
@@ -65,9 +66,8 @@ struct _NO_DISCARD_ Quaternion {
_FORCE_INLINE_ real_t dot(const Quaternion &p_q) const;
real_t angle_to(const Quaternion &p_to) const;
- Vector3 get_euler_xyz() const;
- Vector3 get_euler_yxz() const;
- Vector3 get_euler() const { return get_euler_yxz(); };
+ Vector3 get_euler(EulerOrder p_order = EulerOrder::YXZ) const;
+ static Quaternion from_euler(const Vector3 &p_euler);
Quaternion slerp(const Quaternion &p_to, const real_t &p_weight) const;
Quaternion slerpni(const Quaternion &p_to, const real_t &p_weight) const;
@@ -127,8 +127,6 @@ struct _NO_DISCARD_ Quaternion {
Quaternion(const Vector3 &p_axis, real_t p_angle);
- Quaternion(const Vector3 &p_euler);
-
Quaternion(const Quaternion &p_q) :
x(p_q.x),
y(p_q.y),
@@ -143,8 +141,7 @@ struct _NO_DISCARD_ Quaternion {
w = p_q.w;
}
- Quaternion(const Vector3 &v0, const Vector3 &v1) // shortest arc
- {
+ Quaternion(const Vector3 &v0, const Vector3 &v1) { // Shortest arc.
Vector3 c = v0.cross(v1);
real_t d = v0.dot(v1);