CSPICE_M2EUL factors a rotation matrix into a product of
three rotations about specified coordinate axes.
For important details concerning this module's function, please refer to
the CSPICE routine m2eul_c.
Given:
r a 3x3 double precision rotation matrix to factor as
a product of three rotations about a specified
coordinate axes. The angles of these rotations are
called "Euler angles".
axis3
axis2
axis1 are the indices of the rotation axes of the
"factor" rotations, whose product is 'r'. 'r' is
factored as
r = [ angle3 ] [ angle2 ] [ angle1 ]
axis3 axis2 axis1
The axis numbers must belong to the set {1, 2, 3}.
The second axis number MUST differ from the first
and third axis numbers.
the call:
cspice_m2eul, r, axis3, axis2, axis1, angle3, angle2, angle1
returns:
angle3
angle2
angle1 a set of double precision Euler angles
measured where the angle satisfy
r = [ angle3 ] [ angle2 ] [ angle1 ]
axis3 axis2 axis1
The range of 'angle3' and 'angle1' is (pi, pi].
The range of 'angle2' depends on the exact set of
axes used for the factorization. For
factorizations in which the first and third axes
are the same,
r = [R] [S] [T]
a b a
the range of 'angle2' is [0, pi].
For factorizations in which the first and third
axes are different,
r = [R] [S] [T] ,
a b c
the range of angle2 is [pi/2, pi/2].
For rotations such that 'angle3' and 'angle1' are not
uniquely determined, 'angle3' will always be set to
zero; 'angle1' is then uniquely determined.
Note, the call sequence:
cspice_m2eul, r, axis3, axis2, axis1, angle3, angle2, angle1
cspice_eul2m, angle3, angle2, angle1, axis3, axis2, axis1, r
preserves 'r' to roundoff error.
Yet, the call sequence:
cspice_eul2m, angle3, angle2, angle1, axis3, axis2, axis1, r
cspice_m2eul, r, axis3, axis2, axis1, angle3, angle2, angle1
preserves 'angle3', 'angle2', and 'angle1' only if the initial
values of the angle existed within the range of cspice_m2eul's
output.
;;
;; Conversion of instrument pointing from a matrix representation
;; to Euler angles:
;;
;; Suppose we want to find camera pointing in alpha, delta, and
;; kappa, given the inertialtocamera coordinate transformation
;;
ticam = [ $
[ 0.49127379678135830d, 0.50872620321864170d, 0.70699908539882417d], $
[ 0.50872620321864193d, 0.49127379678135802d, 0.70699908539882428d], $
[ 0.70699908539882406d, 0.70699908539882439d, 0.01745240643728360d] ]
;;
;; We want to find angles alpha, delta, kappa such that
;;
;;
;; ticam = [ kappa ] [ pi/2  delta ] [ pi/2 + alpha ]
;; 3 1 3
;;
cspice_m2eul, ticam, 3, 1, 3, kappa, ang2, ang1
alpha = ang1  cspice_halfpi()
delta = cspice_halfpi()  ang2
;;
;; calculates the desired angles. If we wish to make sure that
;; alpha, delta, and kappa are in the ranges [0, 2pi),
;; [pi/2, pi/2], and [0, 2pi) respectively, we may add the code
;;
if ( alpha LT 0.d ) then begin
alpha = alpha + cspice_twopi()
endif
if ( kappa LT 0.d ) then begin
kappa = kappa + cspice_twopi()
endif
print, cspice_dpr() * alpha, cspice_dpr() * delta, cspice_dpr() * kappa
IDL outputs:
315.00000 1.0000000 45.000000
None.
ICY.REQ
ROTATION.REQ
Icy Version 1.0.2, 25JUN2006, EDW (JPL)
Added example code and output to Examples section.
Expanded I/O section.
Icy Version 1.0.1, 09DEC2005, EDW (JPL)
Added Examples section.
Icy Version 1.0.0, 16JUN2003, EDW (JPL)
matrix to euler angles
