Rotations

Rotations are the basic concept to understand crystal orientations and crystal symmetries.

Rotations are represented in MTEX by the class rotation which is inherited from the class quaternion and allow to work with rotations as with matrixes in MTEX.

On this page ...
Euler Angle Conventions
Other Ways of Defining a Rotation
Calculating with Rotations
Improper Rotations
Conversion into Euler Angles and Rodrigues Parametrisation
Plotting Rotations

Euler Angle Conventions

There are several ways to specify a rotation in MTEX. A well known possibility are the so called Euler angles. In texture analysis the following conventions are commonly used

Defining a Rotation by Bunge Euler Angles

The default Euler angle convention in MTEX are the Bunge Euler angles. Here a rotation is determined by three consecutive rotations, the first about the z-axis, the second about the y-axis, and the third again about the z-axis. Hence, one needs three angles to define an rotation by Euler angles. The following command defines a rotation by its three Bunge Euler angles

o = rotation('Euler',30*degree,50*degree,10*degree)
 
o = rotation  
  size: 1 x 1
 
  Bunge Euler angles in degree
  phi1  Phi phi2 Inv.
    30   50   10    0
 
 

Defining a Rotation by Other Euler Angle Conventions

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.

o = rotation('Euler',30*degree,50*degree,10*degree,'Roe')
 
o = rotation  
  size: 1 x 1
 
  Bunge Euler angles in degree
  phi1  Phi phi2 Inv.
   120   50  280    0
 
 

Changing the Default Euler Angle Convention

The default Euler angle convention can be changed by the command setpref, for a permanent change the mtex_settings should be edited. Compare

setMTEXpref('EulerAngleConvention','Roe')
o
 
o = rotation  
  size: 1 x 1
 
  Roe Euler angles in degree
  Psi Theta   Phi  Inv.
   30    50    10     0
 
 
setMTEXpref('EulerAngleConvention','Bunge')
o
 
o = rotation  
  size: 1 x 1
 
  Bunge Euler angles in degree
  phi1  Phi phi2 Inv.
   120   50  280    0
 
 

Other Ways of Defining a Rotation

The axis angle parametrisation

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

o = rotation('axis',xvector,'angle',30*degree)
 
o = rotation  
  size: 1 x 1
 
  Bunge Euler angles in degree
  phi1  Phi phi2 Inv.
     0   30    0    0
 
 

Four vectors defining a rotation

Given four vectors u1, v1, u2, v2 there is a unique rotation q such that q u1 = v1 and q u2 = v2.

o = rotation('map',xvector,yvector,zvector,zvector)
 
o = rotation  
  size: 1 x 1
 
  Bunge Euler angles in degree
  phi1  Phi phi2 Inv.
    90    0    0    0
 
 

If only two vectors are specified, then the rotation with the smallest angle is returned and gives the rotation from first vector onto the second one.

o = rotation('map',xvector,yvector)
 
o = rotation  
  size: 1 x 1
 
  Bunge Euler angles in degree
  phi1  Phi phi2 Inv.
    90    0    0    0
 
 

A fibre of rotations

The set of all rotations that rotate a certain vector u onto a certain vector v define a fibre in the rotation space. A discretisation of such a fibre is defined by

u = xvector;
v = yvector;
o = rotation('fibre',u,v)
 
o = rotation  
  size: 1 x 361
 

Defining an rotation by a 3 times 3 matrix

o = rotation('matrix',eye(3))
 
o = rotation  
  size: 1 x 1
 
  Bunge Euler angles in degree
  phi1  Phi phi2 Inv.
     0    0    0    0
 
 

Defining an rotation by a quaternion

A last possibility is to define a rotation by a quaternion, i.e., by its components a,b,c,d.

o = rotation('quaternion',1,0,0,0)
 
o = rotation  
  size: 1 x 1
 
  Bunge Euler angles in degree
  phi1  Phi phi2 Inv.
     0    0    0    0
 
 

Actually, MTEX represents internally every rotation as a quaternion. Hence, one can write

q = quaternion(1,0,0,0)
o = rotation(q)
 
q = Quaternion  
  size: 1 x 1
  a b c d
  1 0 0 0
 
o = rotation  
  size: 1 x 1
 
  Bunge Euler angles in degree
  phi1  Phi phi2 Inv.
     0    0    0    0
 
 

Calculating with Rotations

Rotating Vectors

Let

o = rotation('Euler',90*degree,90*degree,0*degree)
 
o = rotation  
  size: 1 x 1
 
  Bunge Euler angles in degree
  phi1  Phi phi2 Inv.
    90   90    0    0
 
 

a certain rotation. Then the rotation of the xvector is computed via

v = o * xvector
 
v = vector3d  
 size: 1 x 1
  x y z
  0 1 0

The inverse rotation is computed via the backslash operator

o \ v
 
ans = vector3d  
 size: 1 x 1
  x y z
  1 0 0

Concatenating Rotations

Let

rot1 = rotation('Euler',90*degree,0,0);
rot2 = rotation('Euler',0,60*degree,0);

be two rotations. Then the rotation defined by applying first rotation one and then rotation two is computed by

rot = rot2 * rot1
 
rot = rotation  
  size: 1 x 1
 
  Bunge Euler angles in degree
  phi1  Phi phi2 Inv.
     0   60   90    0
 
 

Computing the rotation angle and the rotational axis

Then rotational angle and the axis of rotation can be computed via then commands angle(rot) and axis(rot)

rot.angle / degree

rot.axis
ans =
  104.4775
 
ans = vector3d  
 size: 1 x 1
         x         y         z
  0.447214 -0.447214  0.774597

If two rotations are specifies the command angle(rot1,rot2) computes the rotational angle between both rotations

angle(rot1,rot2) / degree
ans =
  104.4775

The inverse Rotation

The inverse rotation you get from the command inv(rot)

inv(rot)
 
ans = rotation  
  size: 1 x 1
 
  Bunge Euler angles in degree
  phi1  Phi phi2 Inv.
    90   60  180    0
 
 

Improper Rotations

Improper rotations are coordinate transformations from a left hand into a right handed coordinate system as, e.g. mirroring or inversion. In MTEX the inversion is defined as the negative identy rotation

I = - rotation('Euler',0,0,0)
 
I = rotation  
  size: 1 x 1
 
  Bunge Euler angles in degree
  phi1  Phi phi2 Inv.
     0    0    0    1
 
 

Note that this is convenient as both groupings of the operations "-" and "*" should give the same result

- (rotation('Euler',0,0,0) * xvector)
(- rotation('Euler',0,0,0)) * xvector
 
ans = vector3d  
 size: 1 x 1
   x  y  z
  -1  0  0
 
ans = vector3d  
 size: 1 x 1
   x  y  z
  -1  0  0

Mirroring

As a mirroring is nothing else then a rotation about 180 degree about the normal of the mirroring plane followed by a inversion we can defined a mirroring about the axis (111) by

mir = -rotation('axis',vector3d(1,1,1),'angle',180*degree)
 
mir = rotation  
  size: 1 x 1
 
  Bunge Euler angles in degree
  phi1     Phi    phi2    Inv.
   135 109.471      45       1
 
 

A convenient shortcut is the command

mir = reflection(vector3d(1,1,1))
 
mir = rotation  
  size: 1 x 1
 
  Bunge Euler angles in degree
  phi1     Phi    phi2    Inv.
   135 109.471      45       1
 
 

To check whether a rotation is improper or not you can do

mir.isImproper
ans =
  logical
   1

Conversion into Euler Angles and Rodrigues Parametrisation

There are methods to transform quaternion in almost any other parameterization of rotations as they are:

[alpha,beta,gamma] = Euler(rot,'Matthies')
alpha =
    4.7124
beta =
    1.0472
gamma =
    3.1416

Plotting Rotations

The scatter function allows you to visualize a rotation in Rodriguez space.

% define 100 random rotations
rot = randq(100)

% and plot the Rodriguez space
scatter(rot)
 
rot = Quaternion  
  size: 100 x 1