Quaternion Description
======================
The components of the QUATERNION keyword in a data label rotate
a vector defined in the instrument frame into the Earth Mean Equator
J2000 (EME J2000) frame.
The QUATERNION keyword provides an ordered list of the four components
of the quaternion, zero through three, with the zeroeth component as
the scalar and the first, second and third as the vector components,
where q0 = cos(a/2), q1 = -sin(a/2)*u1, q2 = -sin(a/2)*u2,
q3 = -sin(a/2)*u3, a is the angle (radians) representing the
magnitude of the rotation, and u1, u2, u3 are components of
the unit vector representing 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 C-Kernels and Toolkit
subroutines, and is the PDS recommended structure. The SPICE Toolkit
provides an assortment of routines for applying quaternions.
In the SPICE context, the equations for forming a rotation matrix
(a C-inverse matrix) 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) |
+- -+
The C-inverse matrix is a 3x3 matrix that transforms Cartesian coordinates
referenced to the instrument frame to coordinates in the EME J2000 frame.
The matrix transforms coordinates as follows: if a vector v has
coordinates (x, y, z) in instrument-fixed reference frame,
then v has coordinates (x', y', z') in EME J2000 frame, where
[ ] [ x ] [ x']
| CMAT | | y | = | y'|
[ ] [ z ] [ z']