By experiment, you can figure out q = (cos(yaw/2) + k sin(yaw/2)) * (cos(pitch/2) + i sin(pitch/2)) * (cos(roll/2) + j sin(roll/2)) where yaw and roll are in \([-\pi, \pi]\) and pitch is in \([-\pi/2, \pi/2]\).
Since quaternion <-> rotation matrix is not one-to-one, we have to play with original expression, matrix. As apple's rotation matrix is active rotation, (current rotation matrix) = (relative matrix) * (reference frame rotation matrix). This gives proper singular points, 90deg and -90deg pitch from the reference attitude. If you just use quaternion i.e. CMAttitude system API, singularities are at the fixed point, absolute 90, -90deg pitch point. 90deg pitch point is right at the attitude when you are holding phone right up, which is pretty annoying.
No comments:
Post a Comment