### Euler Angles

Although our emphasis in this article is on quaternions, there are of course other ways to approach the subject of rotations and we would like to briefly mention rotations via Euler angles. The standard add-on package `Geometry`Rotations`` provides us with the function `Rotate3D`. More specifically, `Rotate3D[`vec`,` phi`,` theta`,` psi`,` `(`pt`:`{a`,`b`,`c}`)]` rotates the vector vec by specified Euler angles about point pt. The rotation given by the Euler angles phi, theta, and psi can be decomposed into a sequence of three successive rotations:

This version of Euler angles is not unique and definitions vary.

For an interesting in-depth article on rotation techniques in the context of commercial computer game software confer [10]. Bobick's paper provides numerous technical reasons why quaternions are a must in many three-dimensional applications as he compares and contrasts various techniques.

In our article we shall show a simple way to make an Euler-to-quaternion conversion and produce some examples. First load some useful standard add-on packages.

Noting the definition of Euler angles used in the `Rotations` package, and using some of the theory of quaternions previously discussed, we can construct a single quaternion that is equivalent to a given Euler angles rotation. The negative signs make the rotation choices (CW, CC) about the axes consistent with the choices made in the add-on package. The function `etoq[` phi`,` theta`,` psi `]` creates the desired quaternion.

The first three basic equivalences are obviously correct, while the fourth is more complicated.

Next we can use the quaternion created by `etoq` to carry out a rotation of vector vec about point pt that is equivalent to the Euler rotation. The function is `etoqrot[`vec`,` phi`,` theta`,` psi`,` pt`]`.

Now compare `etoqrot` and `Rotate3D` by rotating the vector (1, 1, 5) about the point (2, -1, -3) with Euler triple (, -10° , ). We see that the rotation, as applied to vec-pt, involves an angle of about 60.7° around the axis 0.166486 +0.0446097 J-0.985034 K and the final position (after translating) is (3.13382,0.499433,5.33798).