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;
|
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)
|
void toAxisAngle(float& a, float& b, float& c, float& angle)
|
||||||
{
|
{
|
||||||
angle = acos(w) * 2;
|
angle = acos(w) * 2;
|
||||||
@ -129,11 +113,6 @@ public:
|
|||||||
(*this) = Quaternion::fromEulerZYX(euler.x, euler.y, yaw);
|
(*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(
|
Quaternion ret(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user