es

This section is divided into a number of subsections, links to which are:

Rotations

2D Rotations

3D Rotations

3D Rotation vs Shearing

Quaternions

Compositions

Cayley Representation

Python:
http://www.kostasalexis.com/frame-rotations-and-representations.html
https://github.com/joycesudi/quaternion/blob/main/quaternion.py

A common method of representing orientation and rotation is known as Euler angles. (Remember, Euler is pronounced “oiler,” not “yoolur.”)

 

Euler Rotation Theorem

A two-dimensional x-y coordinate frame can be considered to be a part of the three-dimensional coordinate frame by adding a z-axis perpendicular to the x- and y-axes. However, there are two orientations for this line: one in which the positive direction of the axis is out of the paper and another where the positive direction of the axis is into the paper. It doesn’t matter which one we choose as long as the choice is consistent.

Consistency is made more difficult when the sciences do not agree. Elsewhere we have made a point about how physicists and mathematicians do not agree on a notation for the imaginary unit in the complex plane ℂ. Similarly, and confusingly, geometers and topologists cannot agree on a convention for numbering coordinates in space underlying equations. A useful article covering this may be found in the Hypersphere section of Wolfram MathWorld at this link. The message here is that you must adapt your consistency to the context and conform to parochial rules laid down by those who passed before you.

The conventional choice for labeling (orientation) axes is the right hand rule. Curl the fingers of your right hand so that they go by the shortest path from the one axis to another axis. Your thumb now points in the positive direction of the third axis. For the familiar x- and y-axes on paper, curl your fingers on the short 90° path from the x-axis to the y-axis (not on the long 270° path from the x-axis to the y-axis). When you do so your thumb points out of the paper and this is taken as the positive direction of the z-axis.

The following diagram shows the right-hand coordinate system. Note that the arrow is a semi-circle that begins and ends touching the y plane. The arrow direction is the same as the curl of your fingers.

  • x-axis (abscissa) forward the index finger;
  • y-axis (ordinate)up from the middle finger;
  • z-axis up, from the thumb (applicate).
  • Roll ϕ about x-axis;
  • Pitch θ about y-axis;
  • Yaw ψ about z-axis.

Figure 1: Right-handed system
     
Figure 2: Aircraft rotations

   
Example 1:
x1 = {1, 0, 0}; y1 = {0, 1, 0}; z1 = {0, 0, 1}; baseCase = {x1, y1, z1}; baseLabels = {"x", "y", "z"};
All vectors, of course, have unit norms because they are unit vectors.
TrueQ[Norm[x1] == Norm[y1] == Norm[z1] == 1]
True
All columns are orthonormal.
TrueQ[x1\[Transpose] . y1 == x1\[Transpose] . z1 == y1\[Transpose] . z1 == 0]
True
The following function takes two strings as arguments. The first is the axis ("x", "y", or "z"); the second is the direction of the rotation arrow (default is "T"=True and may be left blank to produce counterclockwise as you are looking down the axis at the origin; "F" if you want clockwise)
arrows2[axis_String, dir_String : "T"] := Module[{x1, y1, z1, rotPlt, arcX, arcY, arcZ, arrowX, arrowY, arrowZ, dirX, dirY, dirZ, x0 = .5, y0 = .5, z0 = .5}, (*basis vectors and plot*) x1 = {1, 0, 0}; y1 = {0, 1, 0}; z1 = {0, 0, 1}; rotPlt = Graphics3D[ { {Red, Thickness[0.01], Arrowheads[0.08], Arrow[{{0, 0, 0}, x1}]},(* x-axis *) {Green, Thickness[0.01], Arrowheads[0.08], Arrow[{{0, 0, 0}, y1}]},(* y-axis *) {Blue, Thickness[0.01], Arrowheads[0.08], Arrow[{{0, 0, 0}, z1}]}(* z-axis *) , Text[Style["x", Bold, FontSize -> 18], x1 + {0, 0, .1}] , Text[Style["y", Bold, FontSize -> 18], y1 + {0, .1, .07}] , Text[Style["z", Bold, FontSize -> 18], z1 + {0, 0, .07}] } , Boxed -> False , Axes -> False , Ticks -> False , ViewPoint -> {-2, 2., 1.6} , PlotRange -> {{-.2, 1.1}, {-.2, 1.1}, {-.2, 1.1}} ]; (*semi-circles*) arcX = ParametricPlot3D[{x0, .1 Cos[\[Theta]], .1 Sin[\[Theta]]}, {\ \[Theta], 0, \[Pi]} , PlotStyle -> Red , Axes -> True , Boxed -> False , ViewPoint -> {-2, 2., 1.6}]; arcY = ParametricPlot3D[{.1 Cos[\[Theta]], y0, .1 Sin[\[Theta]]}, {\[Theta], 0, \[Pi]} , PlotStyle -> Green , Axes -> False , Boxed -> False , ViewPoint -> {-2, 2., 1.6}]; arcZ = ParametricPlot3D[{.1 Cos[\[Theta]], .1 Sin[\[Theta]], z0}, {\[Theta], 0, \[Pi]} , PlotStyle -> Blue , Axes -> False , Boxed -> False , ViewPoint -> {-2, 2., 1.6}]; (*arrows with direction - first is always counterclockwise*) dirX = If[dir == "T",(*ctrcw=*) Arrow[Tube[{{x0, -.1, 0}, {x0, -.1, -.05}}, .0045]], Arrow[Tube[{{x0, .1, 0}, {x0, .1, -.05}}, .0045]] ]; arrowX = Show[arcX, Graphics3D[{Red, Arrowheads[0.03], dirX} , Axes -> False , ViewPoint -> {-2, 2., 1.6}]]; dirY = If[dir == "T",(*ctrcw=*) Arrow[Tube[{{.1, y0, 0}, {.1, y0, -.05}}, .0045]], Arrow[Tube[{{-.1, y0, 0}, {-.1, y0, -.05}}, .0045]]]; arrowY = Show[arcY, Graphics3D[{Green, Arrowheads[0.03], dirY} , Axes -> False , ViewPoint -> {-2, 2., 1.6}]]; dirZ = If[dir == "T",(*ctrcw=*) Arrow[Tube[{{-.1, 0, z0}, {-.1, -.05, z0}}, .0045]], Arrow[Tube[{{.1, 0, z0}, {.1, -.1, z0}}, .0045]]]; arrowZ = Show[arcZ, Graphics3D[{Blue, Arrowheads[.03], dirZ} , Axes -> False , ViewPoint -> {-2, 2., 1.6} , PlotRange -> {{-.2, 1}, {-.2, 1}, {-.2, 1}}]]; (*final plot*) Show[rotPlt, Switch[axis, "x", arrowX, "y", arrowY, "z", arrowZ, _, Print["Invalid input"] ], PlotRange -> {{-.2, 1.1}, {-.2, 1.1}, {-.2, 1.1}}] ]
arrows2["x", "T"]
Rotate the coordinate frame counterclockwise around x-axis.
Labeled[Grid[{arrows2[#] & /@ {"x", "y", "z"}}, Frame -> All], "Counterclockwise rotation for each axis", Top]

Right-hand frames with counterclockwise around x-axis.
 
Right-hand frames with counterclockwise around y-axis.
 
Right-hand frames with counterclockwise around z-axis.

   ■
End of Example 1

Leonhard Euler
Leonhard Euler (1707--1783) is held to be one of the greatest mathematicians in history and the greatest of the 18th century. Euler was born in Basel (Swiss Confederacy), but at age of 18, he left for Russia and never returned. There is a rumor that all mathematical problems would have been solved by Leonhard Euler if he had been acquainted with a computer algebra system.

Leonhard Euler proved the following theorem in 1775 that states that in three-dimensional space, any displacement of a rigid body such that a point on the rigid body remains fixed, is equivalent to a single rotation about some axis that runs through the fixed point.

Euler's Rotation Theorem: A rotation by θ about an arbitrary line L through the origin can be decomposed into the concatenation of rotations about the x, y, and z axes \[ \mathbf{R}[\theta , L] = \mathbf{R}_z \left( \theta_z \right) \mathbf{R}_y \left( \theta_y \right) \mathbf{R}_x \left( \theta_x \right) , \] where θx, θy, θz are called the Euler angles.
Since I don't have time to type a proof of Euler's Rotation Theorem, I have no other choice as to refer the reader to the resources:
  1. Anderson, R.U., Elementary geometric proof of Euler's rotation theorem, 2019.

The parameterization of rotation through Euler angles is probably the most commonly employed in both education and engineering applications. There are three axes in three dimensional space, so there should be 3³ = 27 sequences of Euler angles. However, there is no point in rotating around the same axis twice in succession because the same result can be obtained by rotating once by the sum of the angles, so there are only 3 · 2 · 2 = 12 different Euler angle sequences:

xyx    xyz    xzx    xzy
yxy    yxz    yzx    yzy
zxy    zxz    zyx    zyz

We refer to this class of 12 sequences of three partial rotations as Eulerian angle parametrizations. As you see, there is no constraint to use the same axis twice interrupted by rotation with respect to another axis. Euler angles express a rotation as a sequence of three standard rotations about a predefined set of coordinate axes, in a predefined order. These standard rotations are either by convention extrinsic about the fixed global x, y, and z-axes, or intrinsic about the local x, y, and z-axes of the coordinate frame being rotated. For each of these two types, the order of axis rotations leads to six possible conventions where the first and third axes of rotation are the same, referred to as proper Euler angles:

xyx    xzx    yxy    yzy    zxz    zyz

Another six possible conventions where each axis is used only once, referred to as Tait-Bryan angles:

XYZ    XZY    YXZ    YZX    ZXY    ZYX
   
Example 2: For example, let us start rotation with respect to vertical z-axis.
   ■
End of Example 2
   
Example 3: For example, let us start rotation with respect to vertical z-axis.
   ■
End of Example 3

Classic Euler's angles usually take the inclination angle in such a way that zero degrees represent the vertical orientation. Alternative forms were later introduced by a Scottish mathematical physicist Peter Guthrie Tait (1831--1901) and an English applied mathematician George H. Bryan (1864--1928) intended for use in aeronautics and engineering in which zero degrees represent the horizontal position.

   

Example 4: Let {G} denote a global reference frame, and {B} be the frame of which the orientation is being expressed. The intrinsic ZYX Euler angles representation consists of the following three sequential rotations: first a rotation by the Euler yaw ψ about the z-axis, then by the Euler pitch θ about the new y-axis, and then by the Euler roll φ about the newest x-axis, as illustrated in Fig. 2

\[ \left( \psi, \ \theta , \ \phi \right) \in (-\pi , \pi ] \times \left[ - \frac{\pi}{2} , \frac{\pi}{2} \right] \times ( -\pi , \pi ] . \]

The representation is unique, except at gimbal lock, which is when θ = ± π/2 . The rotation matrix R corresponding to the Euler angles rotation E = (ψ, θ, φ) is given by \begin{align*} {\bf R} &= {\bf R}_z (\psi )\,{\bf R}_y (\theta ) \, {\bf R}_x (\phi ) \\ &= \end{align*} For example, let us start rotation with respect to vertical z-axis.

To be checked ????

Example 1 allowed rotations of a vector around the axes zyx by 90° each. The matrix for arbitrary rotations around these axes is obtained by multiplying the matrices for each axis using arbitrary angles: a rotation of ψ around the z-axis, a rotation of θ around the y-axis and a rotation of φ around the x-axis. The resulting matrix is computed as follows. First multiply the rotation around the x-axis by the rotation around the y-axis:
\begin{align*} \mathbf{R}_{y(\theta )} \mathbf{R}_{x(\phi )} &= \begin{bmatrix} \cos\theta &0&\sin\theta \\ 0&1&0 \\ -\sin\theta &0&\cos\theta \end{bmatrix} \begin{bmatrix} 1&0&0 \\ 0&\cos\phi &-\sin\phi \\ 0&\sin\phi &\cos\phi \end{bmatrix} \\ &= \begin{bmatrix} \cos\theta & \sin\theta \,\sin\phi & \sin\theta \,\cos\phi \\ 0& \cos\phi & \sin\phi \\ -\sin\theta & \cos\theta \,\sin\phi & \cos\theta \,\cos\phi \end{bmatrix} . \end{align*}
Then, multiply the result by the rotation around the z-axis:
\[ \mathbf{R}_{z(\psi )} \mathbf{R}_{y(\theta )} \mathbf{R}_{x(\phi )} = \begin{bmatrix} \cos\psi & -\sin\psi & 0 \\ \sin\psi & \cos\psi & 0 \\ 0&0&1 \end{bmatrix} \mathbf{R}_{y(\theta )} \mathbf{R}_{x(\phi )} \]
\[ = \begin{bmatrix} \cos\psi\,\cos\theta & \cos\psi \,\sin\theta \,\sin\phi - \sin\psi\,\cos\phi & \cos\psi\,\sin\theta \,\cos\phi + \sin\psi\,\sin\phi \\ \sin\psi\,\cos\theta & \sin\psi \,\sin\theta \,\sin\phi + \cos\psi\,\cos\phi & \sin\psi\,\sin\theta \,\cos\phi - \cos\psi\,\sin\phi \\ -\sin\theta & \cos\theta\,\sin\phi & \cos\theta\,\cos\phi \end{bmatrix} . \]
   ■
End of Example 4
   
Example 5: For example, let us start rotation with respect to vertical z-axis.
   ■
End of Example 5

    Unfortunately, there are dozens of mutually exclusive ways to define Euler angles. Different authors are likely to use different conventions, often without clearly stating the underlying assumptions, which makes it difficult to combine equations and code from more than one source. In this tutorial, we mostly use classical Yaw-pitch-roll rotation order, rotating around the z, y and x axes respectively. There are some others:
  • The three elemental rotations may be extrinsic (rotations about the axes xyz of the original coordinate system, which is assumed to remain motionless), or intrinsic (rotations about the axes of the rotating coordinate system XYZ, solidary with the moving body, which changes its orientation with respect to the extrinsic rotation. So in intrinsic system axes move with each rotation. In an extrinsic system, each rotation is performed around the axes of the world coordinate system, which does not move. As an example, suppose the three angles of the Euler triplet specify rotations around the z, y, and x axes respectively, and in that order. The first elemental rotation around the z axis will be identical for both intrinsic and extrinsic conventions. However, for the intrinsic convention the second elemental rotation is performed around the y axis in its new position resulting from the first rotation, while in the extrinsic convention it is performed around the original (unrotated) y axis. Similarly, the final rotation around the x axis will be performed around the x axis as rotated by the first two operations in the intrinsic system, and around the original (unrotated) x axis in the extrinsic system. It can be shown that all extrinsic Euler's angles conventions are completely equivalent to the corresponding intrinsic Euler's angles conventions, just with the order of rotations reversed. In this section we will adhere to the intrinsic convention: i.e., the axes move with each rotation.
  • Active (otherwise known as alibi) rotation when the point is rotated, not the coordinate system.
  • Passive rotation—also known as alias rotation—is when the coordinate system rotates with respect to the point . The two conventions produce opposite rotations.
  • Right-handed coordinate system with right-handed rotations. We will use a right-handed Cartesian coordinate system with right-handed rotations. In a right-handed coordinate system, if x̂, ŷ, and ẑ̂ are unit vectors along each of the three axis, then x̂ cross ŷ = ẑ. Right-handed rotation means rotations are positive clockwise when looking in the positive direction of any of the three axes.

The matrix for an arbitrary rotation

The order in which the rotations are performed is significant. The primary problem with Euler angles is that they contain singularities at 0 or 90 degrees that lead to gimbal lock. When this occurs, 2 axes are parallel and it is not possible to rotate independently about a third “locked” axis. For example, if using Euler angles to describe an airplane that is rotated upward 90 degrees about it’s pitch axis so that it is pointing straight up, the yaw and roll axes become the same, and one degree of freedom is lost or “locked”. In this case, it’s not possible to independently describe tilt towards the left or right wings.

https://www.sagemotion.com/blog/how-do-euler-angles-work https://danceswithcode.net/engineeringnotes/rotations_in_3d/rotations_in_3d_part1.html

Figure 3: Euler's angles
     
Axis of
Rotation
Euler's Angle
Name
Euler's Angle
Symbol
x Roll ϕ
y Pitch θ
z Yaw ψ

If the application of Euler angles doesn’t involve angles at or near the singularities, then this problem goes away (e.g., commercial airplanes don’t fly vertically). Euler angles can also be computed by converting from 3D rotation matrix:

\[ \mathbf{R} = \begin{bmatrix} r_{11} & r_{12} & r_{13} \\ r_{21} & r_{22} & r_{23} \\ r_{31} & r_{32} & r_{33} \end{bmatrix} . \]
Then Euler's angles (α, β, γ) can be computed as
\begin{equation} \label{EqEuler.1} \alpha = \arctan \left( \frac{r_{31}}{r_{32}} \right) , \quad \beta = \mbox{arcos} \left( r_{33} \right) , \quad \gamma = - \arctan \left( \frac{r_{13}}{r_{23}} \right) . \end{equation}
When Euler's angles are determined, the components of the rotation matrix R can be calculated as
\begin{align*} r_{11} &= \cos\gamma \,\cos\alpha - \cos\beta\, \sin\alpha\,\sin\gamma , \\ r_{12} &= \cos\gamma \,\sin\alpha + \cos\beta\, \sin\alpha\,\sin\gamma , \\ r_{13} &= \sin\gamma \,\sin\beta , \\ r_{21} &= - \sin\gamma \,\cos\alpha - \cos\beta \,\sin\alpha \,\cos\gamma , \\ r_{22} &= - \sin\gamma \,\sin\alpha + \cos\beta \,\cos\alpha\, \cos\gamma , \\ r_{23} &= \cos\gamma \, \sin\beta , \\ r_{31} &= \sin\beta \,\sin\gamma , \\ r_{32} &= - \sin\beta \,\sin\gamma , \\ r_{33} &= \cos\beta . \end{align*}
   
Example 6: Here is an example of three successive rotations of a coordinate frame: first, 90◦ around the z-axis, then 90◦ around the y-axis and finally 90◦ around the x-axis:
Ben-Azi, page 10
   ■
End of Example 6

Euler--Rodrigues' rotation formula

Olinde Rodrigues
This formula is variously credited to Leonhard Euler (see historical notes by Cheng & Gupta, 1989). However, this formula was independently rediscovered in nineteen century by O. Rodrigues who demonstrated its usefulness in many applications. Olinde Rodrigues (1795--1851) was a French banker, mathematician, and social reformer of Portuguese-Jewish descent. Besides other achievements in mathematics, he use Euler rotation formula for applications by compositions of rotation operations.

If v is a vector in ℝ³ and n is a unit vector describing an axis of rotation about which v rotates by an angle θ according to the right hand rule, the Euler--Rodrigues formula for the rotated vector vrot is

\begin{equation} \label{EqEuler.2} \mathbf{v}_{rot} = \mathbf{v}\,\cos\theta + \left( \mathbf{n} \times \mathbf{v} \right) \sin\theta + \mathbf{n} \left( \mathbf{n} \bullet \mathbf{v} \right) \left( 1 - \cos\theta \right) . \end{equation}

The rotation matrix can be expressed through the cross-product matrix:

\begin{equation} \label{EqEuler.3} \mathbf{R} (\hat{\bf n} , \theta ) = e^{\theta{\bf K}} = \mathbf{I} + \left( \sin\theta \right) \mathbf{K} + \left( 1 - \cos\theta \right) \mathbf{K}^2 , \end{equation}
or equivalently,
\begin{equation} \label{EqEuler.4} \cosh \left( \theta{\bf K} \right) = \mathbf{I} + \left( 1 - \cos\theta \right) \mathbf{K}^2 , \qquad \sinh \left( \theta{\bf K} \right) = \left( \sin\theta \right) \mathbf{K} , \end{equation}
where K represents the cross-product matrix n × v = K v. Here \( \displaystyle \quad \hat{\bf n} = ( n_x , n_y , n_z ) \quad \) is a unit vector along the axis of rotation. So
\[ \mathbf{K} = \begin{bmatrix} 0&-n_z & n_y \\ n_z & 0 & -n_x \\ -n_y & n_x & 0 \end{bmatrix} , \quad \mathbf{K}^2 = \begin{bmatrix} -n_y^2 - n_z^2 & n_x n_y & n_x n_z \\ n_x n_y & -n_x^2 - n_z^2 & n_y n_z \\ n_x n_z & n_y n_z & -n_x^2 - n_y^2 \end{bmatrix} , \]
K = {{0, -nz, ny}, {nz, 0, -nx}, {-ny, nx, 0}}; K . K
{{-ny^2 - nz^2, nx ny, nx nz}, {nx ny, -nx^2 - nz^2, ny nz}, {nx nz, ny nz, -nx^2 - ny^2}}
where
\[ \begin{bmatrix} \left( \mathbf{n} \times \mathbf{v} \right)_x \\ \left( \mathbf{n} \times \mathbf{v} \right)_y \\ \left( \mathbf{n} \times \mathbf{v} \right)_z \end{bmatrix} = \begin{bmatrix} n_y v_z - n_z v_y \\ n_z v_x - n_x v_z \\ n_x v_y - n_y v_x \end{bmatrix} = \begin{bmatrix} 0& - n_z & n_y \\ n_z & 0& -n_x \\ -n_y & n_x &0 \end{bmatrix} \begin{bmatrix} x_x \\ v_y \\ v_z \end{bmatrix} = \mathbf{K} \begin{bmatrix} v_x \\ v_y \\ v_z \end{bmatrix} . \]
Using matrix K, we derive the rotation matrix
\[ \mathbf{R} \left( \hat{\bf n} = \left[ n_x, n_y , n_z \right] , \theta \right) = \]
\begin{equation} \label{EqEuler.5} \begin{bmatrix} n_x^2 + \left( 1 - n_x^2 \right) c & n_x n_y \left( 1 - c \right) - n_z s & n_x n_z \left( 1 - c \right) + n_y s \\ n_x n_y \left( 1 - c \right) + n_z s & n_y^2 + \left( 1 - n_y^2 \right) c & n_y n_z \left( 1- c \right) - n_x s \\ n_x n_z \left( 1 - c \right) - n_y s & n_y n_z \left( 1 - c \right) + n_x s & n_z^2 + \left( 1- n_z^2 \right) c \end{bmatrix} , \end{equation}
where c = cosθ and s = sinθ.

For derivation of the exponential formula \eqref{EqEuler.3}, we need the characteristic polynomial of matrix K:

\[ \det\left( \lambda{\bf I} - {\bf K} \right) = \lambda^3 + \lambda \qquad \Longrightarrow \qquad {\bf K}^3 = -{\bf K} . \]
Given point in ℝ³ that is identified by vector v, we decompose it into components parallel and perpendicular to the rotation axis: \[ {\bf v} = {\bf v}_{\|} + {\bf v}_{\perp} = \left( \hat{\bf n} \bullet {\bf v} \right) \hat{\bf n} - \hat{\bf n} \times \left( \hat{\bf n} \times {\bf v} \right) , \] because of the vector triple product formula: \[ {\bf a} \times \left( {\bf b} \times {\bf c} \right) = \left( {\bf a} \bullet {\bf c} \right) {\bf b} - \left( {\bf a} \bullet {\bf b} \right) {\bf c} . \] Using this vector triple product with a = b = n and c = v, we get \[ \hat{\bf n} \times \left( \hat{\bf n} \times {\bf v} \right) = \left( \hat{\bf n} \bullet {\bf v} \right) \hat{\bf n} - \left( \hat{\bf n} \bullet \hat{\bf n} \right) {\bf v} = {\bf v}_{\|} - {\bf v} \] because vector n has unit length, nn = 1. Here ab and a × b denote dot product and cross product, respectively. We know that \[ {\bf v}_{\perp} = {\bf v} - {\bf v}_{\|} = {\bf v} - \left( \hat{\bf n} \bullet {\bf v} \right) \hat{\bf n} = - \hat{\bf n} \times \left( \hat{\bf n} \times {\bf v} \right) . \] Note that \( \displaystyle \quad \hat{\bf n} \times {\bf v} = \hat{\bf n} \times {\bf v}_{\perp} \quad \) is a copy of v rotated 90° around n. Thus the three vectors \[ \hat{\bf n} , \quad {\bf v}_{\perp} , \quad \hat{\bf n} \times {\bf v}_{\perp} \] form a right-handed orthogonal basis of ℝ³, with the last two vectors of equal length.

Under the rotation, the component v parallel to the axis will not change magnitude nor direction: \( \displaystyle \quad {\bf v}_{\parallel\,rot} = {\bf v}_{\parallel} ; \quad \) while the perpendicular component will retain its magnitude but rotate its direction in the perpendicular plane spanned by v and n × v, according to \[ {\bf v}_{\perp\,rot} = {\bf v}_{\perp} \cos\theta + \left( \hat{\bf n} \times {\bf v} \right) \sin\theta = {\bf v}\, \cos\theta + \left( \hat{\bf n} \times {\bf v} \right) \sin\theta , \] in analogy with the planar polar coordinates (r, θ) in the Cartesian basis ex = i, ey = j: \[ {\bf r} = r\,\cos\theta \,{\bf e}_x + r\,\sin\theta\, {\bf e}_y = r\,\cos\theta \,{\bf i} + r\,\sin\theta\, {\bf j} . \] Now the full rotated vector is: \[ {\bf r}_{rot} = {\bf v}_{\parallel\,rot} + {\bf v}_{\perp\,rot} = {\bf v}_{\parallel} + {\bf v}_{\perp} \cos\theta + \left( \hat{\bf n} \times {\bf v} \right) \sin\theta . \] substituting \( \displaystyle \quad {\bf v}_{\perp} = {\bf v} - {\bf v}_{\parallel} \quad\mbox{or} \quad {\bf v}_{\parallel} = {\bf v} - {\bf v}_{\perp} \quad \) in the last expression gives respectively: \begin{align*} {\bf v}_{rot} &= {\bf v}\,\cos\theta + \left( 1 - \cos\theta \right) \left( \bullet {\bf v} \right) \hat{\bf n} + \left( \hat{\bf n} \times {\bf v} \right) \sin\theta , \\ {\bf v}_{rot} &= {\bf v} + \left( 1 - \cos\theta \right) \left( \bullet {\bf v} \right) \hat{\bf n} \times \left(\hat{\bf n} \times {\bf v} \right) + \left( \hat{\bf n} \times {\bf v} \right) \sin\theta . \end{align*}

The Euler--Rodrigues formula (2) can be rewritten in matrix form using cross product matrix K: \[ \hat{\bf n} \times {\bf v} = {\bf K}\,{\bf v}, \qquad \hat{\bf n} \times \left( \hat{\bf n} \times {\bf v} \right) = {\bf K} \left( {\bf K}\,{\bf v} \right) = {\bf K}^2 {\bf v} . \] Therefore, Eq.(2) can be written as \[ {\bf v}_{rot} = {\bf v} + \left( \sin\theta \right) {\bf K}\,{\bf v} + \left( 1 - \cos\theta \right) {\bf K}^2 {\bf v} . \] Collecting terms allows the compact expression \[ {\bf v}_{rot} = {\bf R}\,{\bf v} , \] where \[ {\bf R} (\theta ) = {\bf I} + \left( \sin\theta \right) {\bf K} + \left( 1 - \cos\theta \right) {\bf K}^2 \] is the rotation matrix through an angle θ counterclockwise about the axis n, and I the 3 × 3 identity matrix. This matrix R is an element of the rotation group SO(3) of ℝ³.

Regarding exponential matrix \( \displaystyle \quad {\bf R} (\theta ) = e^{\theta{\bf K}} , \quad \) we can show that R(θ) is the unique solution of the initial value problem \[ \frac{\text d}{{\text d}\theta}\,{\bf R}(\theta ) = {\bf K}\,{\bf R} , \qquad {\bf R}(0) = {\bf I} . \] The initial condition follows immediately. Differentiating R(θ), we get \[ \frac{\text d}{{\text d}\theta}\,{\bf R}(\theta ) = \cos\theta \,{\bf K} + \sin\theta \,{\bf K}^2 = {\bf K} \left( \cos\theta \,{\bf I} + \sin\theta \,{\bf K} \right) . \] Hence, we need to show that \[ \cos\theta \,{\bf I} = {\bf I} + \left( 1 - \cos\theta \right) {\bf K}^2 \qquad \Longrightarrow \quad {\bf I} = {\bf K}^2 , \] which cannot be correct because factoring K out, we loose an annihilator of it.

Instead, we expand the exponential function into Taylor's series \[ e^{\theta{\bf K}} = \sum_{k\ge 0} \frac{(\theta{\bf K})^k}{k!} = {\bf I} + \theta\,{\bf K} + \frac{\theta^2}{2}\,{\bf K}^2 + \frac{\theta^3}{3!}\, {\bf K}^3 + \cdots . \] From characteristic polynomial, we know that K³ = −K, which leads to K4 = −K², K5 = K, K6 = K², and so on. This cyclic pattern continues indefinitely, and so all higher powers of K can be expressed in terms of K and K². Thus, from the above equation, it follows that \[ {\bf R} (\hat{\bf n}, \theta ) = {\bf I} + \left( \theta - \frac{\theta^3}{3!} + \frac{\theta^5}{5!} - \cdots\right) {\bf K} + \left( \frac{\theta^2}{2!} - \frac{\theta^4}{4!} + \frac{\theta^6}{6!} - \cdots \right) {\bf K}^2 , \] that is, \[ {\bf R} (\hat{\bf n}, \theta ) = {\bf I} + \left( \sin\theta \right) {\bf K} + \left( 1 - \cos\theta \right) {\bf K}^2 . \]

   
Example 7:    ■
End of Example 7

A common variation of Rodrigues’s formula is based on cross products:

\begin{equation} \label{EqEuler.6} \mathbf{y} = \hat{\bf n} \left( \hat{\bf n} \bullet {\bf x} \right) + \sin\theta \left( \hat{\bf n} \times {\bf x} \right) - \cos\theta \, \hat{\bf n} \times \left( \hat{\bf n} \times {\bf x} \right) , \end{equation}
or
\begin{equation} \label{EqEuler.7} \mathbf{y} = \mathbf{x} + \left( \sin \theta \right) \hat{\bf n} \times {\bf x} + \left( 1 - \cos\theta \right) \hat{\bf n} \times \left( \hat{\bf n} \times {\bf x} \right) . \end{equation}
   
Example 8:    ■
End of Example 8

Gimbal Lock

https://www.gathering4gardner.org/g4g13gift/math/BickfordNeil-GiftExchange-WhyDoTheUnitQuaternionsDoubleCoverTheSpaceOfRotations-G4G13.pdf
When, for instance, the pitch angle θ = +90° or −90°, both of these conditions, cos(θ) = 0, and we can see that r1,1, r2,1, r3,2, and r3,3 must all equal zero. Since the arctan function is not defined at (0,0), equations for Euler's angles are not valid when the pitch angle θ = ±90°.

It is worth noting that in the regions near the two gimbal lock points, the mapping from rotation-space to Euler angles is not continuous, meaning very small changes in orientation can result in discontinuous jumps in the corresponding Euler angles. For example, the Euler angles (0°,89°,0°) and (90°, 89°, 90°) represent orientations that are only about a degree apart, despite their very different numerical values. A good analogy is the way an aircraft’s longitude jumps discontinuously as it flies over the North or South Pole. This behavior causes problem when trying to interpolate between orientations, or find the average of multiple orientations (see below).

   
Example 8:    ■
End of Example 8


  1. Allgeuer, P., Behnke, S., Fused Angles and the Deficiencies of Euler Angles, arXive, 1809, 10651v1, International Conference on Intelligent Robots and Systems (IROS), Madrid, Spain, 2018; doi: https://doi.org/10.48550/arXiv.1809.10651
  2. Anderson, R.U., Elementary geometric proof of Euler's rotation theorem, 2019.
  3. Ben-Ari, M., A Tutorial on Euler Angles and Quaternions, Weizmann Institute of Science.
  4. Cheng, Hui; Gupta, K. C. (March 1989). An Historical Note on Finite Rotations. Journal of Applied Mechanics. 56 (1). American Society of Mechanical Engineers: 139–145. Retrieved 2022-04-11. doi:10.1115/1.3176034
  5. Dunn, F. and Parberry, I. (2002). 3D math primer for graphics and game development A K Peters/ CRC Press, second edition,
  6. Euler, L., Problema algebraicum ob affectiones prorsus singulares memorabile", Commentatio 407 Indicis Enestoemiani, Novi Comm. Acad. Sci. Petropolitanae 15 (1770), 75–106.
  7. Foley, James D.; van Dam, Andries; Feiner, Steven K.; Hughes, John F. (1991), Computer Graphics: Principles and Practice (2nd ed.), Reading: Addison-Wesley, ISBN 0-201-12110-7
  8. Fraiture, Luc (2009). "A History of the Description of the Three-Dimensional Finite Rotation". The Journal of the Astronautical Sciences. 57 (1–2). Springer: 207–232. doi:10.1007/BF03321502. Retrieved 2022-04-15.
  9. Grassia, F. S., Practical parameterization of rotations using the exponential map, Journal of Graphics Tools 3(3) 29-48 (1998).
  10. Haber, A., Clear Explanation of Euler angles
  11. Matrices and Linear Transformations
  12. Mebius, J.E., Derivation of the Euler--Rodrigues formula for three dimensional rotations from the general formula for four dimensional rotation, arViv
  13. Nikravesh, P. E., Wehage, R. A., and Kwon, O. K., Euler parameters in computational kinematics and dynamics. Part 1, ASME Journal of Mechanisms, Transmissions, and Automation in Design 107(3) 358-365 (1985).
  14. Norris, A. N., Euler-Rodrigues and Cayley formulae for rotation of elasticity tensors, Mathematics and Mechanics of Solids 13(6) 465-498 (2008).
  15. Palais B. and Palais, R., “Euler’s fixed point theorem: The axis of a rotation,” J. of Fixed Point Theory and App., vol. 2, no. 2, 2007.
  16. Palais, B., Palais, R., and Rodi, S., A Disorienting Look at Euler’s Theorem on the Axis of a Rotation, The American Mathematical Monthly, pp. 892–909, 2009.
  17. Faruk Senan, A. F., and O’Reilly, O. M., On the use of quaternions and Euler-Rodrigues symmetric parameters with moments and moment potential, International Journal of Engineering Science, 47(4) 595-609 (2009).
  18. Rodrigues, O., Des lois géométriques qui régissent les déplacements d'un système solide dans l'espace, et de la variation des coordonnées provenant de ces déplacements considérés indépendants des causes qui peuvent les produire, Journal de Mathématiques Pures et Appliquées, 5 (1840), 380–440.
  19. Rogers, D.F., Adams, J. A., Mathematical Elements for Computer Graphics, McGraw-Hill Science/Engineering/Math, 1989.
  20. Shuster. M.D., A survey of attitude representations, The Journal of the Astronautical Science, Vol.41, No. 4, pp. 439–517, 1993.
  21. Stuelpnagel, J., On the parameterization of the three-dimensional rotation group, SIAM Review 6(4) 422-430 (1964).
  22. Trainelli, L. and Croce, A., “A comprehensive view of rotation param- eterization,” in Proceedings of ECCOMAS, 2004.
  23. Watt, A., 3D Computer Graphics, Addison-Wesley; 3rd edition, 1999.