Frame transformation matrix to Euler or Cardan rotation angles
[angles1,angles2,Inok] = CL_rot_matrix2angles(M,naxes)
Given a frame transformation matrix, this function computes the rotation angles (Euler or Cardan) that correspond to the combination of 3 elementary rotations, each being described by an axis number (1=x-axis, 2=y-axis, 3=z-axis).
There are 6 Cardan rotations: XYZ, XZY, YXZ, YZX, ZXY and ZYX; and 6 Euler rotations: XYX, XZX, YXY, YZY, ZXZ and ZYZ.
Notes:
1) There are 2 sets of solutions:
- For Cardan angles, angles1 is the solution for which the second rotation angle is between -pi/2 and pi/2.
- For Euler angles, angles1 is the solution for which the second rotation angle is between 0 and pi.
2) Cardan and Euler angles have singularities.
- For Cardan angles, singularities occur when the second angle is close to -pi/2 or +pi/2
- For Euler angles, singularities occur when the second angle is close to 0 or pi (which implies that the identity rotation is always singular for Euler angles!)
3) The returned angles for cases close to singularities are approximate. The corresponding indices are returned in Inok.
Frame transformation matrix (3x3xN).
Successive axes numbers : 1=x-axis, 2=y-axis or 3=z-axis (1x3 or 3x1)
First set of rotation angles [rad] (3xN)
Second set of rotation angles [rad] (3xN)
Indices for which singularities occur (1xP)
CNES - DCT/SB