MTEX offers the following functions to define rotations

At the end all functions return a variable of type `rotation`

which represents a list of rotations that are internally stored as quaternions. An overview of different rotation representations by three dimensional vectors and their properties can be found in the section Representations.

## Euler Angles

One of the most common ways to describe a rotation is as three subsequent rotations about fixed axes, e.g., first around the z axis, second around the x axis and third again around the z. The corresponding rotational angles are commonly called Euler angles. Beside the most common `ZXZ`

convention other choices of the axes are sometimes used. Sorted by popularity in the texture analysis community these are

- Bunge (phi1,Phi,phi2) - ZXZ
- Matthies (alpha,beta,gamma) - ZYZ
- Roe (Psi,Theta,Phi)
- Kocks (Psi,Theta,phi)
- Canova (omega,Theta,phi)

The default Euler angle convention in MTEX are the Bunge Euler angles, with axes Z, X, and Z. The following command defines a rotation by its three Bunge Euler angles

Note that the angles needs to be multiplied with **degree** since all commands in MTEX expect the input in radiant. Furthermore, the order of the first and the third Euler angle are interchanged in comparison to standard notation for reasons explained here.

In order to define a rotation by a Euler angle convention different to the default Euler angle convention you to specify the convention as an additional parameter, e.g.

This does not change the way MTEX displays the rotation on the screen. The default Euler angle convention for displaying a rotation can be changed by the command `setMTEXpref`

, for a permanent change the file `mtex_settings.m`

should be edited. Compare

## Axis angle parametrization and Rodrigues Frank vector

A very simple possibility to specify a rotation is to specify the rotation axis and the rotation angle.

Conversely, we can extract the rotational axis and the rotation angle of a rotation by

Closely related to the axis angle parametrization of a rotation is the Rodriguez Frank vector.

This is the rotational axis scaled by \(\tan \omega/2\), where \(\omega\) is the rotational angle.

We can also define a rotation by a Rodrigues Frank vector by

## Rotation Matrix

Another common way to represent rotations is by 3x3 matrices. The column of such a rotation matrix coincide with the new positions of the x, y and z vector after the rotation. For a given rotation we may compute the matrix by

Conversely, we may define a rotation by its matrix with the command

## Four vectors defining a rotation

Another useful method to define a rotation is by describing how in acts on two given directions. More precisely, given four vectors `u1`

, `v1`

, `u2`

, `v2`

there is a unique rotation `rot`

such that `rot * u1 = v1`

and `rot * u2 = v2`

. E.g., to find the rotation the maps the x-axis onto the y-axis and keeps the z-axis we do

The above definition require that the angle between u1 and u2 is the same as between v1 and v2. The function gives an error if this condition is not meet. If only two vectors are specified, then the rotation with the smallest angle is returned that rotates the first vector onto the second one.

More generally, one can fit a rotation `rot`

to a list of left and right vectors `l`

and `r`

such that `rot * l`

is the best approximation of `r`

. This is done by the function `rotation.fit`

## Random Rotations

MTEX offers several ways for generating random rotations. The most easiest way is to use the command `rotation.rand`

which generates an arbitrary number of random rotations

If you are interested in random rotations that follow a certain distribution have a look at random sampling.

## Quaternions

A last possibility to define a rotation is by quaternion coordinates a, b, c, d.