Question

Is there a formula to convert a quaternion to an angle?

Looking to do something on the iPhone using the Core Motion API and the gyro so that based on data I receive from it (in the form of quaternions) I can project a UIView on the screen.

Thanks

Was it helpful?

Solution

Yes, see Quaternions and spatial rotation. The unit quaternion (w, x, y, z) represents a rotation about the axis (x, y, z) of an angle of 2*cos-1(w).

Note that this is only true of unit quaternions. Non-unit quaternions do not represent rotations.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top