Quaternion Description                                                        
======================                                                        
                                                                              
In the context of a PDS data label of a New Horizons project data set, the    
four elements of the QUATERNION keyword define a transformation of the        
components of a 3-element vector, referenced to the instrument-fixed reference
frame, into the components of an equivalent vector referenced to the Earth    
Mean Equator J2000 reference frame (EME J2000).  Such a transformation is     
represented as a rotation by a scalar angle around a vector common to both    
reference frames.  The single scalar plus the three elements of the vector    
compose the four-element quaternion.                                          
                                                                              
The QUATERNION keyword in PDS labels provides an ordered list of the four     
components of the quaternion, numbered zero through three, with the zeroeth   
component (q0) representing the scalar angle and the first, second and third  
components (q1, q2, q3) representing the vector, where                        
                                                                              
  q0 = cos(a/2)                                                               
                                                                              
  q1 = sin(a/2)*u1                                                            
  q2 = sin(a/2)*u2                                                            
  q3 = sin(a/2)*u3                                                            
                                                                              
   a = the angular magnitude of the rotation                                  
                                                                              
  u1,u2,u3 = unit vector components parallel to the axis of rotation          
                                                                              
The order of the components in the QUATERNION keyword is (q0, q1, q2, q3).    
This is the structure employed in SPICE Toolkit subroutines.  The SPICE       
Toolkit provides an assortment of routines for applying quaternions;          
specifically, the Q2M() SPICE routine will take a quaternion as input and     
output a transformation matrix equivalent to the rotation represented by the  
quaternion.                                                                   
                                                                              
In the SPICE context, the formulae that form an equivalent 3x3 transformation 
matrix (C-matrix or CMAT) from the four quaternion elements are:              
                                                                              
         +-                                                       -+          
         | 1-2*(q2*q2+q3*q3)  2*(q1*q2-q0*q3)    2*(q1*q3+q0*q2)   |          
         |                                                         |          
  CMAT = | 2*(q1*q2+q0*q3)    1-2*(q1*q1+q3*q3)  2*(q2*q3-q0*q1)   |          
         |                                                         |          
         | 2*(q1*q3-q0*q2)    2*(q2*q3 + q0*q1)  1-2*(q1*q1+q2*q2) |          
         +-                                                       -+          
                                                                              
In this matrix, the left, middle and right columns are the +X, +Y, and +Z     
(primary) axes, respectively, of the instrument fixed frame expressed using   
components in the EME J2000 frame.  That is, the right column comprises the   
XYZ components in the EME J2000 frame of the instrument-fixed frame +Z axis   
[0,0,1].  Conversely, the top, middle and bottom rows of the matrix are the   
+X, +Y, and +Z axes, respectively, of the EME J2000 frame expressed using     
components in the instrument-fixed frame.                                     
                                                                              
This CMAT is a 3x3 matrix that transforms Cartesian vectors referenced to the 
instrument-fixed reference frame into equivalent vectors in the EME J2000     
reference frame.  The matrix transforms coordinates as follows: if a vector v 
has coordinates (x, y, z) in the instrument-fixed reference frame, then the   
coordinates of v in the EME J2000 reference frame                             
are (x', y', z') according to the following formula:                          
                                                                              
             [      ] [ x ]     [ x']                                         
             | CMAT | | y |  =  | y'|                                         
             [      ] [ z ]     [ z']                                         
                                                                              
In other words, the inner (dot) products of v with the top, middle, and bottom
ROWS of the matrix are equivalent to the x', y' and z' coordinates,           
respectively, of a parallel vector in the EME J2000 frame.  Conversely, the   
inner products of v' with the left, middle and right COLUMNS yield the x, y,  
and z components, respectively, in the instrument-fixed frame of a vector     
parallel to v'.