Help for OMC

PURPOSE

    "omc" converts camera pointing matrices (C matrices) and spacecraft 
vectors between Earth coordinates and planet coordinates.  The data are
in columns in an IBIS tabular file.  The rotation matrices are stored as
the three corresponding Eulerian angles (in degrees).


EXECUTION

  omc  A.INT B.INT  MECOL=11 RSCOL=5 OMCOL=8 VRCOL=14 CCOL=17 'FROMPLAN

  omc  B.INT C.INT  MECOL=11 VRCOL=14 CCOL=17 RSCOL=20 OMCOL=23 'TOPLANET



OPERATION

Note: all angles mentioned are measured in degrees.

    For each row in the IBIS tabular file the transformation is applied
to the data in the columns.  First the planet angles (ME angles) are 
converted into the 3 by 3 ME rotation matrix.  Depending on the transformation
direction the C angles or the OM angles (camera angles) are converted into
a rotation matrix.  Then to transform from Earth coordinates to planet
coordinates we multiply the VR vector by the transpose of the ME matrix to 
get the RS vector, and multiply the ME matrix by the C matrix to get 
the OM matrix:
		__     t __
		RS = ME *VR      OM = C*ME

Or, to transform from planet coordinates to Earth coordinates we multiply 
the RS vector by the ME matrix to get the VR vector, and multiply the 
transpose of the ME matrix by the OM matrix to get the C matrix:
		__      __               t
		VR = ME*RS      C = OM*ME

Finally the C or OM matrix is converted back into Eulerian angles, and 
the transformed spacecraft vector and camera pointing is stored in the 
output file.

    There are many ways to define the three Eulerian angles for a rotation
matrix.  The default definition used in this program of the Eulerian angles
is given implicitly by the following equations:

         |  1   4   7  |     | c(1,1)  c(1,2)  c(1,3) |
         |  2   5   8  |     | c(2,1)  c(2,2)  c(2,3) |    
         |  3   6   9  |     | c(3,1)  c(3,2)  c(3,3) |

    c(1,1) = -sin_alpha * cos_kappa - cos_alpha * sin_delta * sin_kappa
    c(1,2) =  cos_alpha * cos_kappa - sin_alpha * sin_delta * sin_kappa
    c(1,3) =  cos_delta * sin_kappa
    c(2,1) =  sin_alpha * sin_kappa - cos_alpha * sin_delta * cos_kappa
    c(2,2) = -cos_alpha * sin_kappa - sin_alpha * sin_delta * cos_kappa
    c(2,3) =  cos_delta * cos_kappa
    c(3,1) =  cos_alpha * cos_delta
    c(3,2) =  sin_alpha * cos_delta
    c(3,3) =  sin_delta

    where alpha is the first angle, delta is the second angle, and 
kappa is the third angle. This is the same method that is used in
"omcor", and "omcor2". The geometric interpretation of the rotation
based on alpha,delta and kappa is a bit nonstandard and is as follows:

  0) Start with standard right-handed coordinates x,y,z
  1) Rotate the z-y plane about the x-axis clockwise, by an
     an angle of 90-<delta>, forming x,y',z' (so that z' is
     at an angle of <delta away from y).
  2) Rotate the x,y',z' coordinate axes about the old z-axis,
     clockwise, by an angle of 90-<alpha>, forming x',y'',Z
  3) Rotate the x',y'' axis counter-clockwise about the Z axis,
     by an angle of <kappa>+180, forming axes X,Y
  4) The axes (X,Y,Z) form the new coordinate system.

It is nonstandard in that angles (0,0,0) effectively transform
(x,y,z) into (y,x,z), whereas normally this should be (x,y,z).
The system still works, however, since the rule is internally
consistent, and the TOPLANET conversion properly inverts the
FROMPLANET system. The identity matrix is (a,d,k) =(90,90,180).


If the keyword 'STANDARD is invoked, a more common. easily remembered,
system of euler angles may be used, with the following interpretation:

  0) Start with x,y,z as before
  1) Rotate the x,y,z   system counter-clockwise about the x-axis
     *by* an angle of <delta>, forming x,y',z'
  2) Rotate the x,y',z' system counter-clockwise about the z-axis 
     *by* an angle of <alpha>, forming x',y'',Z
  3) Rotate the x',y'',Z  system counter-clockwise about the Z-axis
     *by* an angle of <kappa, forming X,Y,Z.
  4) The axes (X,Y,Z) form the new coordinate system.

The matrix used for 'STANDARD is as follows:

	c(1,1) =  cos_alpha * cos_kappa - sin_alpha * cos_delta * sin_kappa
	c(1,2) =  sin_alpha * cos_kappa + cos_alpha * cos_delta * sin_kappa
	c(1,3) =  sin_delta * sin_kappa
	c(2,1) = -cos_alpha * sin_kappa - sin_alpha * cos_delta * cos_kappa
	c(2,2) = -sin_alpha * sin_kappa + cos_alpha * cos_delta * cos_kappa
	c(2,3) =  sin_delta * cos_kappa
	c(3,1) =  sin_alpha * sin_delta
	c(3,2) = -cos_alpha * sin_delta
	c(3,3) =  cos_delta


Original Programmer:  Frank Evans	June 1987

Cognizant Programmer: Niles Ritter

Documentation Author: Niles Ritter

Revision History:
      Rev. A    Frank Evans		June 1987
                Original Version
      Rev. B    Niles Ritter		Jan. 1995
                Added STANDARD Euler Angles, Test Procs.
      Rev. C    A Scop (CRI)            Mar. 1995
                Made portable for UNIX

PERFORMANCE

The unported version of "omc" is 28% faster than the ported version due to
the extensive changes to IBIS-2.  The old program read in each line in its
entirety, changed the desired columns, and then wrote the new data out to
the new file.  Due to the IBIS-2 changes, the new version must first copy
all the uninvolved columns to the output file and then work with a record
consisting of only the columns involved.  Also whereas the unported version
was limited to 40 columns, the ported version is not. 


PARAMETERS:


INP

The input IBIS tabular file.

OUT

The output IBIS tabular file.

NCOL

The number of columns in the output tabular file. (default - same as input).

MECOL

The starting column for the ME matrix angles (degrees).

OMCOL

The starting column for the OM matrix angles (degrees).

CCOL

The starting column for the C matrix angles (degrees).

RSCOL

The starting column for the RS vector.

VRCOL

The starting column for the VR vector.

MODE

'TOPLANET to convert from C and VR to OM and RS. 'FROMPLAN to convert from OM and RS to C and VR.

ANGLES

Use OMCOR style angles?

See Examples:


Cognizant Programmer: