I have looked at three separate formulas and while they are mostly identical, I'm wondering why their signs are different. to illustrate, here are the formulas:
Common Code
float xSin = Math::Sinr (x / 2);
float xCos = Math::cosr (x / 2);
float ySin = Math::Sinr (y / 2);
float yCos = Math::Cosr (y / 2);
float zSin = Math::Sinr (z / 2);
float zCos = Math::Cosr (z / 2);
X = xSin * yCos * zCos + xCos * ySin * zSin;
Y = xCos * ySin * zCos + xSin * yCos * zSin;
Z = xCos * yCos * zSin - xSin * ySin * zCos;
W = xCos * yCos * zCos - xSin * ySin * zSin;
X = xSin * yCos * zCos - xCos * ySin * zSin;
Y = xCos * ySin * zCos + xSin * yCos * zSin;
Z = xCos * yCos * zSin - xSin * ySin * zCos;
W = xCos * yCos * zCos + xSin * ySin * zSin;
X = xSin * yCos * zCos + xCos * ySin * zSin;
Y = xCos * ySin * zCos - xSin * yCos * zSin;
Z = xCos * yCos * zSin - xSin * ySin * zCos;
W = xCos * yCos * zCos + xSin * ySin * zSin;
You can see that the first has + + - -
, the second - + - +
and the third + - - +
. For this I have normalized the yaw pitch and rolls into their proper XYZ counterparts, but I don't understand the difference in signs.