summaryrefslogtreecommitdiffstats
path: root/src/math/Quaternion.h
diff options
context:
space:
mode:
authorRoman Masanin <36927roma@gmail.com>2020-09-14 20:47:15 +0200
committerRoman Masanin <36927roma@gmail.com>2020-09-14 20:47:15 +0200
commit97550b4fd90cf1c3e9704ac03295475a3a21b01c (patch)
tree2f415a4829c705e6a2cdfb033ad861bf448aa7e5 /src/math/Quaternion.h
parentfinish work on ProcessPlayerVehicleEngine and cleanup (diff)
parentMove a bunch of math to cpp files + small fixes (diff)
downloadre3-97550b4fd90cf1c3e9704ac03295475a3a21b01c.tar
re3-97550b4fd90cf1c3e9704ac03295475a3a21b01c.tar.gz
re3-97550b4fd90cf1c3e9704ac03295475a3a21b01c.tar.bz2
re3-97550b4fd90cf1c3e9704ac03295475a3a21b01c.tar.lz
re3-97550b4fd90cf1c3e9704ac03295475a3a21b01c.tar.xz
re3-97550b4fd90cf1c3e9704ac03295475a3a21b01c.tar.zst
re3-97550b4fd90cf1c3e9704ac03295475a3a21b01c.zip
Diffstat (limited to 'src/math/Quaternion.h')
-rw-r--r--src/math/Quaternion.h18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/math/Quaternion.h b/src/math/Quaternion.h
index dac49362..a5a34626 100644
--- a/src/math/Quaternion.h
+++ b/src/math/Quaternion.h
@@ -10,18 +10,8 @@ public:
float Magnitude(void) const { return Sqrt(x*x + y*y + z*z + w*w); }
float MagnitudeSqr(void) const { return x*x + y*y + z*z + w*w; }
- void Normalise(void) {
- float sq = MagnitudeSqr();
- if(sq == 0.0f)
- w = 1.0f;
- else{
- float invsqrt = RecipSqrt(sq);
- x *= invsqrt;
- y *= invsqrt;
- z *= invsqrt;
- w *= invsqrt;
- }
- }
+ void Normalise(void);
+ void Multiply(const CQuaternion &q1, const CQuaternion &q2);
const CQuaternion &operator+=(CQuaternion const &right) {
x += right.x;
@@ -60,8 +50,12 @@ public:
}
void Slerp(const CQuaternion &q1, const CQuaternion &q2, float theta, float invSin, float t);
+ void Get(RwV3d *axis, float *angle);
void Set(RwV3d *axis, float angle);
void Get(RwMatrix *matrix);
+ void Set(const RwMatrix &matrix);
+ void Set(float f1, float f2, float f3);
+ void Get(float *f1, float *f2, float *f3);
};
inline float