3 ms·
I was hoping your article would example how gimbal lock can occur with quaternions, but from a quick skim I can’t see any such paragraph. Would you mind elabor
by DecoPerson 5y ago
I was hoping your article would example how gimbal lock can occur with quaternions, but from a quick skim I can’t see any such paragraph.
Would you mind elaborating?
- OmarShehata 5y agoIt's at the bottom of the "What causes gimbal lock?" section, the final code snippet: ``` rotationAroundX = Quaternion.fromAxisAngle(angle1, Xaxis); rotationAroundY = Quaternion.fromAxisAngle(angle2, Yaxis); rotationAroundZ = Quaternion.fromAxisAngle(angle3, Zaxis); cubeRotation = rotationAroundX * rotationAroundY * rotationAroundZ; ``` Basically, you store 3 quaternions, representing 3 angles, and combine them to get the final rotation. You might say "This is just quaternions emulating Euler angles!" and my answer is, sure. You can say the same about rotation matrices. There's nothing inherent about rotation matrices that makes them susceptible to gimbal lock. You can implement them as representing 3 fixed angles, thus gimbal lock, or you can implement them as accumulating rotations, thus no gimbal lock. Same is true of quaternions. The fact that you can get gimbal lock with quaternions is a feature, not a bug. Quaternions are just one way to describe rotations. Gimbal lock is a natural phenomenon of certain physical rotation systems, and can be described whether you use quaternions, or matrices etc.