GEOMETRY

Euler Angles

Overview

Euler angles is a way of describing the rotation in 3D space using three separate rotations around an axes.

Syntax

Euler angles are usually defined one of the two symbol sets:

• $$\alpha, \beta, \gamma$$ (Alpha, Beta, Gamma). These are usually used with proper Euler angles (see below).
• $$\Phi, \Theta, \Psi$$ (Phi, Theta, Psi). These are usually used with Tait-Bryan angles (see below).

Proper Euler Angles vs. Tait-Bryan Angles

Euler angles can be split into two categories based on the axis used:

• Proper Euler Angles: These use the same axis for both the first and third rotations, e.g. x-y-x, x-z-x, y-x-y, y-z-y, z-x-z, z-y-z
• Tait-Bryan Angles: These use all three axis (no axis is used twice), e.g. x-y-z, x-z-y, y-x-z, y-z-x, z-x-y, z-y-x

Proper Euler angles are also called classic Euler angles.

The classic roll, pitch, yaw (RPY) terminology is a Tait-Bryan angle. Tait-Bryan angles are also called Cardan angles, nautical angles, or heading, elevation and bank.

The axes of the initial frame (also called the reference frame) is denoted with x, y, z. The rotated frame is denoted with X, Y, Z.

The line of nodes is the line (or vector) made by the intersection of the xy and XY planes.

Calculating Euler Angles Between Two 3D Vectors

First we calculate the cross-product of the two vectors, which gives us the vector of rotation:

$$\mathbf{N} = \mathbf{a} \times \mathbf{b}$$
$$\cos{\theta} = \frac{a \cdot b}{length(a)*length(b)}$$

If you are using unit vectors, you can ignore the lengths (this would just divide by 1).

Conversion To Rotation Matrices

Euler angles can be converted to rotation matrices.

$$\mathbf{R_x(\gamma)} = \begin{bmatrix} 1 & 0 & 0 \\ 0 & \cos{\gamma} & -\sin{\gamma} \\ 0 & \sin{\gamma} & \cos{\gamma} \end{bmatrix}$$
$$\mathbf{R_y(\beta)} = \begin{bmatrix} \cos{\beta} & 0 & \sin{\beta} \\ 0 & 1 & 0 \\ -\sin{\beta} & 0 & \cos{\beta} \end{bmatrix}$$
$$\mathbf{R_z(\alpha)} = \begin{bmatrix} \cos{\alpha} & -\sin{\alpha} & 0 \\ \sin{\alpha} & \cos{\alpha} & 0 \\ 0 & 0 & 1 \end{bmatrix}$$

We can combine these to form a single rotation matrix:

$$\mathbf{R(\alpha, \beta, \gamma)} = \mathbf{R_z(\alpha)} \mathbf{R_y(\beta)} \mathbf{R_x(\gamma)}$$
$$\begin{bmatrix}x_1 \\ y_1 \\ z_1\end{bmatrix} = \mathbf{R} \begin{bmatrix}x_0 \\ y_0 \\ z_0\end{bmatrix}$$

Conversion From Rotation Matrices

$$\alpha = atan2{r_{32}, r_{33}} \\ \beta = -a \sin{r_{31}} \\ \gamma = atan2{r_{21}, r_{11}}$$

where $$atan2(y, x)$$ returns the principle angle.