Index Page
cspice_m2q
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X 

Abstract
I/O
Examples
Particulars
Required Reading
Version
Index_Entries

Abstract


   CSPICE_M2Q calculates a unit quaternion corresponding to a 
   specified 3x3 double precision, rotation matrix.

   For important details concerning this module's function, please refer to
   the CSPICE routine m2q_c.

I/O

   
   Given:
   
      r   a 3x3 double precision rotation matrix
      
   the call:
   
      cspice_m2q, r, q
   
   returns:
   
      q   a double precision 4-vector, the quaternion 
          representation of the matrix 'r'
          
          Note that multiple styles of quaternions are in use.
          This routine returns a quaternion that conforms to
          the SPICE convention. See the Particulars section 
          for details.

Examples


   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.

   
      ;;
      ;; Create a rotation matrix of 90 degrees about the Z axis.
      ;;
      cspice_rotate, cspice_halfpi(), 3, r
      print,r
   
   IDL outputs:
   
      6.1232340e-17       1.0000000       0.0000000
         -1.0000000   6.1232340e-17       0.0000000
          0.0000000       0.0000000       1.0000000
   
      ;;
      ;; Convert the matrix to a quaternion.
      ;;
      cspice_m2q, r, q
      print, q
   
   IDL outputs:   0.70710678   0.0000000   0.0000000  -0.70710678
   
   
      ;;
      ;; Confirm || q || = 1.
      ;;
      print, q ## transpose(q)
   
   IDL outputs:  1.0000000
   
   Please note, the call sequence:
   
      cspice_m2q, r, q
      cspice_q2m, q,r
   
   preserves 'r' except for round-off error. Yet, the call sequence:
   
      cspice_q2m, q,r
      cspice_m2q, r, q
   
   may preserve 'q' or return '-q'.

Particulars


   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. 

Required Reading


   ICY.REQ
   ROTATION.REQ

Version


   -Icy Version 1.0.1, 06-NOV-2005, EDW (JPL)

      Updated Particulars section to include the 
      "About SPICE Quaternions" description. Recast
      the I/O section to meet Icy format standards.

   -Icy Version 1.0.0, 16-JUN-2003, EDW (JPL)

Index_Entries


   matrix to quaternion




Wed Apr  5 17:58:02 2017