CSPICE_Q2M calculates the rotation matrix corresponding to a
specified unit quaternion.
q an array of unit-length SPICE-style quaternion(s).
[4,n] = size(q); double = class(q)
Note that multiple styles of quaternions are in use.
This routine returns a quaternion that conforms to
the SPICE convention. See the Particulars section
r = cspice_q2m(q)
r the rotation matrix/matrices corresponding to 'q'
If [4,1] = size(q) then [3,3] = size(r)
If [4,n] = size(q) then [3,3,n] = size(r)
double = class(r)
Any numerical results shown for this example may differ between
platforms as the results depend on the SPICE kernels used as input
and the machine specific arithmetic implementation.
About SPICE quaternions
There are (at least) two popular "styles" of quaternions; these
differ in the layout of the quaternion elements, the definition
of the multiplication operation, and the mapping between the set
of unit quaternions and corresponding rotation matrices.
SPICE-style quaternions have the scalar part in the first
component and the vector part in the subsequent components. The
SPICE convention, along with the multiplication rules for SPICE
quaternions, are those used by William Rowan Hamilton, the
inventor of quaternions.
Another common quaternion style places the scalar component
last. This style is often used in engineering applications.
For important details concerning this module's function, please refer to
the CSPICE routine q2m_c.
-Mice Version 1.0.1, 09-MAR-2015, EDW (JPL)
Edited I/O section to conform to NAIF standard for Mice documentation.
-Mice Version 1.0.0, 10-JAN-2006, EDW (JPL)
quaternion to matrix