- Calculates the pitch angle and the yaw angle, that a direction you give and another direction of the quaternion make. (Ignores Z-ROLL)
- Gives two vectors that are the front direction and the up direction, makes a projection and calculates pitch, yaw and roll angle.
On the other hand, here is an expression to get angles from x, y, z and w of the quaternion:
return atan2(2*(y*z + w*x), w*w - x*x - y*y + z*z);
return asin(-2*(x*z - w*y));
return atan2(2*(x*y + w*z), w*w + x*x - y*y - z*z);
The angles gotten by this expression are the shortest possible path. These may be not the value that you hope and not good for re-calculation. But, it's useful for dump and monitor.