<< CL_rot_pvJacobian Coordinates and frames CL_rot_quat2axAng >>

CelestLab >> Coordinates and frames > CL_rot_quat2angles

CL_rot_quat2angles

Quaternion to Euler or Cardan rotation angles

Calling Sequence

[angles1,angles2,Inok] = CL_rot_quat2angles(q,naxes)

Description

Parameters

q :

Quaternion that defines the rotation (dim N).

naxes :

Successive axes numbers : 1=x-axis, 2=y-axis or 3=z-axis (1x3 or 3x1)

angles1 :

First set of rotation angles [rad] (3xN)

angles2 :

Second set of rotation angles [rad] (3xN)

Inok :

Indices for which singularities occur (1xP)

Authors

See also

Examples

// Cardan angles (XYZ), second rotation angle < %pi/2
naxes = [1,2,3];
angles = [0.1;0.4;0.5];
q = CL_rot_angles2quat(naxes,angles);
[angles1,angles2,Inok] = CL_rot_quat2angles(q,naxes);
angles1 - angles  // => 0

// Cardan angles (XYZ), second rotation angle > %pi/2
angles = [0.1;2.4;0.5];
q = CL_rot_angles2quat(naxes,angles);
[angles1,angles2,Inok] = CL_rot_quat2angles(q,naxes);
angles2 - angles // => 0

// Euler angles (ZXZ), second rotation angle close to 0 : singularity
naxes = [3,1,3];
angles = [0.1;0;0.5];
q = CL_rot_angles2quat(naxes,angles);
[angles1,angles2,Inok] = CL_rot_quat2angles(q,naxes);
Inok // => not empty
q1 = CL_rot_angles2quat(naxes,angles1);
q1*q'  // => identity

Report an issue
<< CL_rot_pvJacobian Coordinates and frames CL_rot_quat2axAng >>