mirror of
https://github.com/okalachev/flix.git
synced 2025-07-27 17:49:33 +00:00
Quaternion library cleanups and code style
This commit is contained in:
parent
997af183f0
commit
d3e715ae53
@ -69,22 +69,6 @@ public:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static Quaternion _fromBetweenVectors(float a, float b, float c, float x, float y, float z)
|
||||
{
|
||||
float dot = a * x + b * y + c * z;
|
||||
float w1 = b * z - c * y;
|
||||
float w2 = c * x - a * z;
|
||||
float w3 = a * y - b * x;
|
||||
|
||||
Quaternion ret(
|
||||
dot + sqrt(dot * dot + w1 * w1 + w2 * w2 + w3 * w3),
|
||||
w1,
|
||||
w2,
|
||||
w3);
|
||||
ret.normalize();
|
||||
return ret;
|
||||
};
|
||||
|
||||
void toAxisAngle(float& a, float& b, float& c, float& angle)
|
||||
{
|
||||
angle = acos(w) * 2;
|
||||
@ -129,12 +113,7 @@ public:
|
||||
(*this) = Quaternion::fromEulerZYX(euler.x, euler.y, yaw);
|
||||
}
|
||||
|
||||
void toAngularRates(float& x, float& y, float& z)
|
||||
{
|
||||
// this->toAxisAngle(); // TODO:
|
||||
}
|
||||
|
||||
Quaternion & operator*=(const Quaternion &q)
|
||||
Quaternion& operator *= (const Quaternion& q)
|
||||
{
|
||||
Quaternion ret(
|
||||
w * q.w - x * q.x - y * q.y - z * q.z,
|
||||
@ -144,7 +123,7 @@ public:
|
||||
return (*this = ret);
|
||||
}
|
||||
|
||||
Quaternion operator*(const Quaternion& q)
|
||||
Quaternion operator * (const Quaternion& q)
|
||||
{
|
||||
return Quaternion(
|
||||
w * q.w - x * q.x - y * q.y - z * q.z,
|
||||
|
Loading…
x
Reference in New Issue
Block a user