odf opened this issue on Oct 27, 2008 ยท 13964 posts
odf posted Tue, 02 November 2021 at 5:22 PM
Quaternions or matrices is a matter of preference. Quaternions strike as more robust than Euler matrices because they do not have the gimbal lock and therefore also in general have less risk of bad condition.
For the record, there is no gimbal lock problem with general rotation matrices. Any matrix that has a positive determinant and whose inverse is the same as its transpose describes a rotation. Multiply two rotation matrices and you get another one. If you're worried about numerical issues, you can re-normalize the result via the Gram-Schmidt method as you would also have to normalize your quaternions. Gram-Schmidt is not the best way to get the "closest" rotation matrix to an arbitrary linear transformation, but it's good enough to deal with the miniscule numerical errors you'd get from floating point arithmetic. The one big advantage of quaternions I am aware of is that if you try to interpolate between two rotation matrices, e.g. for animation, you generally get rubbish, whereas quaternions are much better behaved.
-- I'm not mad at you, just Westphalian.