Previous: mateu Up: ../plot79_m.html Next: matgt


MATEUI

       SUBROUTINE  MATEUI (E1,E2,E3, T)
 C$    (Euler Rotation - Inverse)
 C$    Given a rotation matrix, find  the Euler angles which  will
 C$    reconstruct it.  Euler angles  have several definitions  in
 C$    the literature, and  the one  used here is  taken from  the
 C$    well-known   book   by   Herbert   Goldstein,    "Classical
 C$    Mechanics", Addison-Wesley (1950).
 C$
 C$    The input argument is:
 C$    T(4,4).........Matrix  in which  rotation is  stored.   The
 C$                   transformed   coordinates   are   given   by
 C$                   (x',y',z',h')   =    (x,y,z,h)T.     If    T
 C$                   corresponds to a true rotation matrix,  then
 C$                   it   will   satisfy   det(T)   =   +1,   and
 C$                   T(transpose) = T(inverse), so T(transpose)*T
 C$                   = unit matrix.
 C$
 C$    The output arguments are:
 C$    E1,E2,E3.......Euler  angles (degrees) of  rotation.  These
 C$                   are usually  called  (phi,  theta,  psi)  or
 C$                   (alpha, beta, gamma)  by most authors.   The
 C$                   angles  E1  and  E2  are  identical  to  the
 C$                   spherical polar  coordinate angles  phi  and
 C$                   theta.  The angles returned are in 0 .. 360.
 C$                   It  should  be  noted,  however,  that   the
 C$                   returned angles are not unique.
 C$
 C$    If there  is  doubt  about the  accuracy  of  the  rotation
 C$    matrix, then MATEU can be used to compute a new T from  the
 C$    returned angles, and this matrix  can be compared with  the
 C$    one presented to this routine.
 C$
 C$    Note also from the  following description of the  rotations
 C$    that if E2 =  0, the total rotation  is E1+E3 about Z.   In
 C$    such a case, E1 and E3 are arbitrary, so we set E3 = 0.
 C$
 C$    The rotations are made in  three steps to get from  (x,y,z)
 C$    coordinates  to  (x',y',z')  coordinates  in  the   rotated
 C$    system.   The  coordinate  systems  are  RIGHT-HANDED,  and
 C$    POSITIVE rotations about an axis are COUNTERCLOCKWISE  when
 C$    viewed down  the  POSITIVE  part of  the  axis  toward  the
 C$    origin.
 C$
 C$    In the first  step, a rotation  in the X-Y  plane by E1  is
 C$    made about the Z axis, transforming the (x,y,z) system into
 C$    (x1,y1,z).
 C$
 C$    In the second step, a rotation  in the Y1-Z plane by E2  is
 C$    made  about  the  X1  axis,  transforming  (x1,y1,z)   into
 C$    (x1,y2,z1).
 C$
 C$    In the third and final step, a rotation in the X1-Y2  plane
 C$    by E3 is  made about the  Z1 axis, transforming  (x1,y2,z1)
 C$    into (x3,y3,z1) = (x',y',z').
 C$
 C$    Since rotation matrices are orthogonal (i.e. T(transpose) =
 C$    T(inverse)), the inverse relation is given by
 C$
 C$    (x,y,z,h) = (x',y',z',h')T(transpose)
 C$
 C$    Some examples are:
 C$
 C$     E1  E2  E3     ( x'  y'  z' h')
 C$    =============   ================
 C$      0   0   0     ( x   y   z  h)
 C$     90   0   0     (-y   x   z  h)
 C$      0  90   0     ( x  -z   y  h)
 C$      0   0  90     (-y   x   z  h)  (same as 90 0 0)
 C$    -90   0   0     ( y  -x   z  h)
 C$      0 -90   0     ( x   z  -y  h)
 C$      0   0 -90     ( y  -x   z  h)  (same as -90 0 0)
 C$    =============   ================
 C$
 C$    (14-MAR-85)