diff options
author | aap <aap@papnet.eu> | 2020-06-04 17:39:18 +0200 |
---|---|---|
committer | aap <aap@papnet.eu> | 2020-06-04 17:39:26 +0200 |
commit | 95e96c86a1924a98c648fbcd251c9dca5d66c4bb (patch) | |
tree | 57e724bb453e10526346722af47c359bc90bbbab /src/math | |
parent | fixes, mostly from miami (diff) | |
download | re3-95e96c86a1924a98c648fbcd251c9dca5d66c4bb.tar re3-95e96c86a1924a98c648fbcd251c9dca5d66c4bb.tar.gz re3-95e96c86a1924a98c648fbcd251c9dca5d66c4bb.tar.bz2 re3-95e96c86a1924a98c648fbcd251c9dca5d66c4bb.tar.lz re3-95e96c86a1924a98c648fbcd251c9dca5d66c4bb.tar.xz re3-95e96c86a1924a98c648fbcd251c9dca5d66c4bb.tar.zst re3-95e96c86a1924a98c648fbcd251c9dca5d66c4bb.zip |
Diffstat (limited to '')
-rw-r--r-- | src/math/Quaternion.h | 1 | ||||
-rw-r--r-- | src/math/math.cpp | 11 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/math/Quaternion.h b/src/math/Quaternion.h index 1d04bdff..dac49362 100644 --- a/src/math/Quaternion.h +++ b/src/math/Quaternion.h @@ -60,6 +60,7 @@ public: } void Slerp(const CQuaternion &q1, const CQuaternion &q2, float theta, float invSin, float t); + void Set(RwV3d *axis, float angle); void Get(RwMatrix *matrix); }; diff --git a/src/math/math.cpp b/src/math/math.cpp index 29f18d03..0cfc2ce9 100644 --- a/src/math/math.cpp +++ b/src/math/math.cpp @@ -184,6 +184,17 @@ CQuaternion::Slerp(const CQuaternion &q1, const CQuaternion &q2, float theta, fl } void +CQuaternion::Set(RwV3d *axis, float angle) +{ + float halfCos = Cos(angle*0.5f); + float halfSin = Sin(angle*0.5f); + x = axis->x*halfSin; + y = axis->y*halfSin; + z = axis->z*halfSin; + w = halfCos; +} + +void CQuaternion::Get(RwMatrix *matrix) { float x2 = x+x; |