mirror of https://github.com/AxioDL/zeus.git
Quaternion assign-multiply fix
This commit is contained in:
parent
0e491fc8f5
commit
841e25df42
|
@ -77,10 +77,12 @@ const CQuaternion& CQuaternion::operator-=(const CQuaternion& q)
|
||||||
|
|
||||||
const CQuaternion& CQuaternion::operator*=(const CQuaternion& q)
|
const CQuaternion& CQuaternion::operator*=(const CQuaternion& q)
|
||||||
{
|
{
|
||||||
w = w * q.w - CVector3f(x, y, z).dot({q.x, q.y, q.z});
|
CQuaternion orig = *this;
|
||||||
x = y * q.z - z * q.y + w * q.x + x * q.w;
|
|
||||||
y = z * q.x - x * q.z + w * q.y + y * q.w;
|
w = orig.w * q.w - CVector3f(orig.x, orig.y, orig.z).dot({q.x, q.y, q.z});
|
||||||
z = x * q.y - y * q.x + w * q.z + z * q.w;
|
x = orig.y * q.z - orig.z * q.y + orig.w * q.x + orig.x * q.w;
|
||||||
|
y = orig.z * q.x - orig.x * q.z + orig.w * q.y + orig.y * q.w;
|
||||||
|
z = orig.x * q.y - orig.y * q.x + orig.w * q.z + orig.z * q.w;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue