Skip to content

Commit

Permalink
Quaternion library cleanups and code style
Browse files Browse the repository at this point in the history
  • Loading branch information
okalachev committed Dec 13, 2023
1 parent c156ac9 commit efc719c
Showing 1 changed file with 2 additions and 23 deletions.
25 changes: 2 additions & 23 deletions flix/quaternion.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,6 @@ class Quaternion : public Printable {
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;
Expand Down Expand Up @@ -130,12 +114,7 @@ class Quaternion : public Printable {
(*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,
Expand All @@ -145,7 +124,7 @@ class Quaternion : public Printable {
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,
Expand Down

0 comments on commit efc719c

Please sign in to comment.