I've been trying to figure out the difference between these, and why ToEulerXYZ does not get the right rotation.
Using MathGeoLib:
axisX:
x 0.80878228 float
y -0.58810818 float
z 0.00000000 float
axisY:
x 0.58811820 float
y 0.80877501 float
z 0.00000000 float
axisZ:
x 0.00000000 float
y 0.00000000 float
z 1.0000000 float
Code:
Quat aQ = Quat::RotateAxisAngle(axisX, DegToRad(30)) * Quat::RotateAxisAngle(axisY, DegToRad(60)) * Quat::RotateAxisAngle(axisZ, DegToRad(40));
float3 eulerAnglesA = aQ.ToEulerXYZ();
Quat bQ = Quat::RotateAxisAngle(axisX, DegToRad(-150)) * Quat::RotateAxisAngle(axisY, DegToRad(120)) * Quat::RotateAxisAngle(axisZ, DegToRad(-140));
float3 eulerAnglesB = bQ.ToEulerXYZ();
Both to ToEulerXYZ get {x=58.675510 y=33.600880 z=38.327244 ...} (when converted to degrees).
The only difference I can see, is the quaternions are identical, but one is negative. The ToEulerXYZ is wrong though, as one should be the negative ({x=-58.675510 y=-33.600880 z=-38.327244 ...}) (bQ)
AQ is:
x 0.52576530 float
y 0.084034257 float
z 0.40772036 float
w 0.74180400 float
While bQ is:
x -0.52576530 float
y -0.084034257 float
z -0.40772036 float
w -0.74180400 float
Is this just an error with MathGeoLib, or some weird nuance, or maybe someone can explain to me what is going on logically.
There are additional scenarios that are not even negative
axisX:
-0.71492511 y=-0.69920099 z=0.00000000
axisY:
0.69920099 y=-0.71492511 z=0.00000000
axisZ:
x=0.00000000 y=0.00000000 z=1.0000000
Code:
Quat aQ = Quat::RotateAxisAngle(axisX, DegToRad(0)) * Quat::RotateAxisAngle(axisY, DegToRad(0)) * Quat::RotateAxisAngle(axisZ, DegToRad(-90));
float3 eulerAnglesA = aQ.ToEulerXYZ();
Quat bQ = Quat::RotateAxisAngle(axisX, DegToRad(-180)) * Quat::RotateAxisAngle(axisY, DegToRad(180)) * Quat::RotateAxisAngle(axisZ, DegToRad(90));
float3 eulerAnglesB = bQ.ToEulerXYZ();
These both yield the same quaternion!
x 0.00000000 float
y 0.00000000 float
z -0.70710677 float
w 0.70710677 float