Dear Antonio,

The 3D coordinate system (*X*, *Y*, *Z*) is a **right-handed** coordinate system and the corresponding rotation transformation parameters (*Rx*, *Ry*, and *Rz*) are according to the **right-hand-rule**, i.e., positive in the counterclockwise direction. Is this correct?

CoordTrans transforms points from one system to another one, if both systems are left-handed or right-handed systems. The rotation sequence is parameterized by an axis of rotation and a rotation angle expressed by a quaternion. The basic transformation equations are published in:

Lösler, M., Eschelbach, C.: *Zur Bestimmung der Parameter einer räumlichen Affintransformation.* avn - Zeitschrift für alle Bereiche der Geodäsie und Geoinformation, 121(7), S. 273-277, 2014.

The PDF is freely available.

A quaternion can be expressed as a rotation matrix. Having such a matrix, it is possible to determine Euler-angles. However, 12 rotation sequences exist, for instance, X-Y-Z, X-Y-X, etc. For that reason, the angles are useless without knowing the underlying sequence. CoordTrans obtains the angles from the quaternion using the following equations:

$r_x = \arctan2(r_{23}, r_{33}),$

$r_y = \arcsin(-r_{13}),$

$r_z = \arctan2(r_{12}, r_{11}).$

Here, $r_{ij}$ is an element of the rotation sequence defined by the quaternion, i.e.,

$r_{11} = 2 q0^2-1+2q1^2,$

$r_{12} = 2(q1q2-q0q3),$

$r_{13} = 2(q1q3+q0q2),$

$r_{23} = 2(q2q3-q0q1),$

$r_{33} = 2q0^2-1+2q3^2.$

Kind regards

Micha