Index Page
cspice_qxq
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

   CSPICE_QXQ returns the product of two quaternions.

-I/O
   
   Given:

      q1   is a double precision 4-vector representing a 
           SPICE-style quaternion.
 
           Note that multiple styles of quaternions are in use.
           This routine will not work properly if the input
           quaternions do not conform to the SPICE convention.
           See the Particulars section for details.
 
      q2   is a second double precision 4-vector SPICE
           quaternion. 

   the call:

      cspice_qxq, q1, q2, qout
   
   returns:

      qout   is a double precision 4-vector representing the
             quaternion product  
 
                     q1 * q2 
 
             Representing q(i) as the sums of scalar (real) 
             part s(i) and vector (imaginary) part v(i) 
             respectively, 
 
                     q1 = s1 + v1 
                     q2 = s2 + v2 
 
             'qout' has scalar part s3 defined by 
 
                     s3 = s1 * s2 - <v1, v2> 
 
             and vector part v3 defined by 
 
                     v3 = s1 * v2  +  s2 * v1  +  v1 x v2 
 
            where the notation < , > denotes the inner 
            product operator and x indicates the cross 
            product operator. 

-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.

      ;;
      ;; Let 'qid', 'qi', 'qj', 'qk' be the "basis" 
      ;; quaternions
      ;;
      qid  =  [ 1.d, 0.d, 0.d, 0.d ] 
      qi   =  [ 0.d, 1, 0, 0 ] 
      qj   =  [ 0.d, 0, 1, 0 ] 
      qk   =  [ 0.d, 0, 0, 1 ]
 
      ;;
      ;; respectively.  Then the calls 
      ;;
      cspice_qxq, qi, qj, ixj
      cspice_qxq, qj, qk, jxk
      cspice_qxq, qk, qi, kxi
 
      ;;
      ;; produce the results 
      ;;
      ;; ixj == qk 
      ;; jxk == qi 
      ;; kxi == qj 
      ;;
      print, 'qi x qj = ', ixj
      print, '     qk = ', qk
      print

      print, 'qj x qk = ', jxk
      print, '     qi = ', qi
      print

      print, 'qk x qi = ', kxi
      print, '     qj = ', qj
      print

      ;;
      ;; All of the calls 
      ;;
      cspice_qxq, qi, qi, qout
      cspice_qxq, qj, qj, qout
      cspice_qxq, qk, qk, qout

      ;;
      ;; produce the result 
      ;;
      ;; qout  ==  -qid
      ;;
      print, 'qi x qi = ', qout
      print, '   -qid = ', -qid
      print

      print, 'qj x qj = ', qout
      print, '   -qid = ', -qid
      print

      print, 'qk x qk = ', qout
      print, '   -qid = ', -qid
      print

      ;;
      ;; For any quaternion Q, the calls 
      ;;
      cspice_qxq, qid, qi , qout1
      cspice_qxq, qj,  qid, qout2
 
      ;;
      ;;  produce the result 
      ;;
      ;;    qout  ==  q 
      ;;
      print, 'qid x qi = ', qout1
      print, '      qi = ', qi
      print

      print, 'qj x qid = ', qout2
      print, '      qj = ', qj
      
   IDL outputs:
   
      qi x qj =   0.0000000   0.0000000   0.0000000   1.0000000
           qk =   0.0000000   0.0000000   0.0000000   1.0000000

      qj x qk =   0.0000000   1.0000000   0.0000000   0.0000000
           qi =   0.0000000   1.0000000   0.0000000   0.0000000

      qk x qi =   0.0000000   0.0000000   1.0000000   0.0000000
           qj =   0.0000000   0.0000000   1.0000000   0.0000000

      qi x qi =  -1.0000000   0.0000000   0.0000000   0.0000000
         -qid =  -1.0000000  -0.0000000  -0.0000000  -0.0000000

      qj x qj =  -1.0000000   0.0000000   0.0000000   0.0000000
         -qid =  -1.0000000  -0.0000000  -0.0000000  -0.0000000

      qk x qk =  -1.0000000   0.0000000   0.0000000   0.0000000
         -qid =  -1.0000000  -0.0000000  -0.0000000  -0.0000000

      qid x qi =  0.0000000   1.0000000   0.0000000   0.0000000
            qi =  0.0000000   1.0000000   0.0000000   0.0000000

      qj x qid =  0.0000000   0.0000000   1.0000000   0.0000000
            qj =  0.0000000   0.0000000   1.0000000   0.0000000
 
-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

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

   ICY.REQ
   ROTATIONS.REQ

-Version

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

-Index_Entries
 
   quaternion times quaternion 
   multiply quaternion by quaternion 



Tue Mar  4 10:11:43 2008