Hacker News new | ask | show | jobs
by Greek0 2119 days ago
A quick summary of the arguments:

Gimbal lock arises in graphics systems when you store the rotation state as 3 Euler angles:

   Internal State: AngleX, AngleY, AngleZ
   Update algorithm: AngleX + dx, AngleY + dy, AngleZ + dz
   Rotation = Rotationmatrix(AngleX) * Rotationmatrix(AngleY) * Rotationmatrix(AngleZ)
With this setup it is easy to come to a situation where AngleZ performs a rotation so that the X/Y rotation vectors coincide, and you lose one degree of freedom in the resulting rotation matrix.

How to fix this:

  Internal state: RotationMatrixOld
  Update: RotationMatrixOld * RotationMatrix(dx, dy, dz)
With this setup there is no chance of Gimbal lock, the dx/dy/dz matrix always retains its degrees of freedom.

Other notes:

* The above description applies irrespective of whether you use Quaternions or rotation matrices

* In higher dimension it's better to describe rotations by their rotation plane instead of the normal vector: in higher dimension there is no "normal vector". Rotation always works in ONE plane / two axis, so there are (N-2) "normal directions" in N dimensions.