Page 2: Euler Angles Toys

CS559 Spring 2023 Sample Solution

This page has a series of demos I call the “Euler Toys” that are designed to help you build your intuitions about Euler Angles. Be sure to read things and play with the demos.

Toy 1: Euler Angles

We use the term “Euler Angles” to refer to the representation of a 3D rotation as a sequence of 3 rotations about fixed axes. For example, we can represent a rotation in 3D as a sequence of 3 rotations: one about the X axis, one about the Y axis, and one about the Z axis. The important point is these axes are fixed: we decide them ahead of time. We have chosen X, Y then Z. Once we’ve chosen them, we need to stick with these 3 axes in this order.

This representation comes from a theorem that mathematician Leonhard Euler had: any rotation in 3D can be represented as a sequence of rotations about fixed axes. The theorem is very general: any set of axes can work (providing no two consecutive axes are parallel).

Once we choose a convention (a set of axes and their order), we only need 3 numbers to represent an arbitrary 3D rotation: the amount of rotation around each axis.


Here is a first demo to try out Euler Angles. With this demo, you can try out different combinations of axes, and change the angles for each.

This demo lets you pick the order of rotations (there is a drop down at the bottom of the control panel - the default is “XYZ”). You can read that from left to right (as if it were programmed as 3 rotations). First apply an X rotation, then a Y rotation, then a Z rotation. The first rotation is in the “global” (world, Y up, X right, Z out from the screen) coordinate system.

Try the following to make sure you understand:

  1. See how you can rotate around any one axis, and what this means. Move one slider, see how the object rotates around that axis. Use the zero button to reset things before trying the next axis. Make sure you understand what a rotation about each axis does.

  2. The key thing that makes Euler Angles tricky is that the different rotations interact. The first rotation changes the coordinate system (frame) that the next rotation takes place in, so we need to interpret each of the angles with respect to the others.

    Experiment with rotating about one axis and then another. For example, change X and then Y. Then reset (press the zero button) and see what happens if you change Y then X. Try to understand what happens as we apply a sequence of rotations.

    Assuming we’re in the default (X,Y,Z) mode. This means that X is closest to the “global” frame and Z is closest to the object frame. Or if we were doing math we’d have result = $R_x R_y R_z \textrm{point}$. (points go in on the right).

  3. Try this experiment Be sure to reset to zero before doing each step. And when I say 45 degrees, it doesn’t have to be exact.

    1. Move Y - notice that this is a rotation about both the global Y (up vector) and object Y (green). With X and Z being 0, nothing has changed what the Y axis is.

    2. Move X (to say, 45 degrees). Notice how the object’s Y axis now points towards us. If you change the Y Slider, notice how things rotate around the object’s Y axis (since Z is 0, the object’s Y axis is the same as the “local” Y axis when we do the Y rotation).

    3. Move Z (to say, 45 degrees). Notice how the object’s Y axis now points to the left. If you move the Y slider notice that the object rotates around vertical (the global Y axis). When we do the Ry rotation, the local Y axis is aligned with the global Y axis. The Rz rotation (that makes the object’s axis point leftward) hasn’t happened yet (since Ry happens before Rz).

    4. Now, set both X and Z to some positive value (say 45 degrees). Move Y. Notice how the object doesn’t rotate around either the global (vertical) or object (green) axis. The local Y axis (at the time we do Ry) has been moved from the global (by Rx). The object Y axis (with the green) will not be the local Y (at the time we do Ry) since Rz will change it.

  4. Try different orders of Euler Angles. Try ZYX (opposite order of XYZ). Make sure you see how this is different. The first rotation is applied first.

    The “ZXZ” choice is not a mistake: this is a valid set of Euler Angles. As long as each consecutive axis is different from the previous one, Euler angles can represent all possible rotations. ZXZ is a common choice in physics.

Toy 2 - Two Sets of Euler Angles

In this next demo, we apply two sets of Euler Angles to one object. So, you can try out $R_{x1} R_{y1} R_{z1} R_{x2} R_{y2} R_{z2}$ and see how rotations combine. For example, is $R_{x1}(30^{\circ})R_{y1}(90^{\circ})R_{x2}(40^{\circ}) = R_{x1}(70^{\circ})R_{y1}(90^{\circ})$?

Toy 3 - Some problems

With Euler Angles, different orders do different things.

To try this out, set object #2 to ZYX (with object #1 as XYZ). Notice how they do different things. Start with just changing X and Y of each. See how the rotations “closer to the object” are object axes, while rotations “closer to the world” are world axes.

Another problem is gimbal lock.

In some circumstances, you can get into a configuration where there are only two possible directions to rotate (you can cause a particular change to happen). This is called gimbal lock. For XYZ Euler angles this occurs when the rotation about the Y axis is 90 degrees, causing the X axis to align with the Z axis (and perform the same motion).

To see gimbal lock in the demo, press the “Gimball Lock” button which will set Y to 90 degrees. Notice how X and Z do the same thing.

When Y is 90 degrees, there is no way to cause a rotation around the world-space Z axis! There are only 2 directions you can go (rotate around world space X, or rotate around world space Y). If you need to go in the third direction, you need to first make a change in one of the other directions.

Toy 4 - Interpolations

Different sets of angles may represent the same rotation. That means that interpolating between two close things might lead to weird paths, or that comparing sets of angles is hard. This next demo lets you play with this concept. The middle object interpolates linearly from Euler Angles 1 to Euler Angles 2 (this only works when the order of the angles is the same).

To see an example of bad interpolation, press the “Bad Interp” Button. You’ll see that the rotations are the same (the objects are in the same configuration), but the numbers are very different. If you interpolate between the two configurations that should be “the same”, you get a weird rotation.

Summary

We recommend that you spend some time playing with the Euler Angle toys to build up your intuitions about how Euler Angles work, and the problems they have.

Then you can move on to Page  3  (Axis Angle Representations) to consider some alternatives.

Page 2 Rubric (1 points total)
Points (1):
Page 2
1 pt
experimenting with the demos on page 2. (We’ll just trust that you’ve done it if you turn any other part in.)