When coding rotation in 3D graphics/games, is it computationally more efficient to use quaternions in all circumstances? Say I'm not rotating an airplane or something prone to gimbal lock. Maybe I just want to rotate a 3D character along one axis (y, a shooter for example) or make a 2D character rotate along the Z axis. Should I stick to quaternions or is there a case where I should use a rotation matrix based on trig identities?
For the rotation matrices based on trig identities I mean: Rotation about each axis in 3D
Quaternions are computationally more efficient than rotation matrices since 4 scalars comprise each quaternion and must be stored. In contrast, a rotation matrix has 9 scalars (3x3 matrix). In terms of chained 3D rotations, a rotation matrix needs 45 operations (multiplications, additions, and subtractions), while the quaternions require just 28. Keep in mind that both solutions need to be orthogonalized at some point to avoid the computation of scaled rotations.
Look here for a more detailed answer.