## Gimbal Lock Version

### Starting Position

• X: 0
• Y: 0
• Z: 0
• X-Axis: 0 degress
• Y-Axis: 90 degrees
• Z-Axis: 0 degrees

### Ending Position

These we calculated by Maya. I dragged the cylinder to the horizontal position and it calculated the required change in angles

• X: 0
• Y: 0
• Z: 0
• X-Axis: 0 degress (calculated by Maya)
• Y-Axis: -90 degrees (calculated by Maya)
• Z-Axis: -90 degrees (calculated by Maya)

## Quaternion Version

### Starting Position

• X: 0
• Y: 0
• Z: 0
• X-Axis: 0 degress (calculated by Maya)
• Y-Axis: 90 degrees (calculated by Maya)
• Z-Axis: 0 degrees

### Ending Position

• X: 0
• Y: 0
• Z: 0
• X-Axis: -90 degress (calculated by Maya)
• Y-Axis: 90 degrees (calculated by Maya)
• Z-Axis: 0 degrees (calculated by Maya)

## Calculations

Again the issue is with the frame interpolation, not really with the representation, but...

### Euler:

Rotation in Euler Angles: (Yaw: 0, Pitch: -90, Roll: 0)

Rotation Matrix:

$\begin{pmatrix}&space;0&&space;0&&space;-1\\&space;0&&space;1&&space;0\\&space;1&&space;0&&space;0&space;\end{pmatrix}$

Rotation are applied to a pivot point in the object. In my case the pivot happens to be the center of the object, so rotation the object around it's center doesn't cause it's center to change (which is also how the position of the object is recorded).
Essentially the rotations don't direct change to posititon of the object, but here's how it would have change the position if it was applied to a dot on the top of the cylinder at the center.

$\begin{pmatrix}&space;0&&space;0&&space;-1\\&space;0&&space;1&&space;0\\&space;1&&space;0&&space;0&space;\end{pmatrix}*\begin{pmatrix}&space;0\\&space;0\\&space;4&space;\end{pmatrix}=\begin{pmatrix}&space;0\\&space;4\\&space;0&space;\end{pmatrix}$

Which makes sense as the top of the cylinder is now the front of the cylinder. Note this should be 2 in the actual rendering due to the pivot point (which is at (0, 0, 2)), which we have not accounted for, but our graphics engine will.

### Quaternion:

-90 degree rotation quaternion:

$q=\begin{pmatrix}&space;\frac{\sqrt{2}}{2}&&space;-\frac{\sqrt{2}}{2}&&space;0&&space;0&space;\end{pmatrix}$

$quaternion\begin{pmatrix}&space;\frac{\sqrt{2}}{2}&&space;-\frac{\sqrt{2}}{2}&&space;0&&space;0&space;\end{pmatrix}&space;\times&space;quaternion\begin{pmatrix}&space;0&&space;0&&space;0&&space;4\end{pmatrix}=\begin{pmatrix}&space;0\\&space;4\\&space;0&space;\end{pmatrix}$

Which is identical to Euler rotation in-terms of final position (as it should be).

## Notes

We can clearly see the Euler based animation adds unnecessary rotation.

We can also clearly see that the rotation itself is not the issue, it is the frame interpolation.
In the animation we see that the Euler interpolation adds unnecessary rotation, where as the quaternion based Spherical Linear Interpolation (Slerp) does not.