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

Table of contents
Abstract
I/O
Parameters
Examples
Particulars
Exceptions
Files
Restrictions
Required_Reading
Literature_References
Author_and_Institution
Version
Index_Entries


Abstract


   CSPICE_VCRSS computes the cross product of two 3-dimensional vectors.

I/O


   Given:

      v1,
      v2       two 3-dimensional vectors.

               help, v1
                  DOUBLE = Array[3]
               help, v2
                  DOUBLE = Array[3]

               Typically, these might represent the (possibly unit) vector to
               a planet, Sun, or a star which defines the orientation of axes
               of some reference frame.

   the call:

      cspice_vcrss, v1, v2, vout

   returns:

      vout     the cross product of `v1' and `v2'.

               help, vout
                  DOUBLE = Array[3]

Parameters


   None.

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.

   1) Define two sets of vectors and compute the cross product of
      each vector in first set and the corresponding vector in
      the second set.


      Example code begins here.


      PRO vcrss_ex1

         ;;
         ;; Local parameters.
         ;;
         SETSIZ =   2L

         ;;
         ;; Define the two vector sets.
         ;;
         seta   = [ [ 0.D0,  1.D0,  0.D0 ], [  5.D0,  5.D0,  5.D0 ] ]

         setb   = [ [ 1.D0,  0.D0,  0.D0 ], [ -1.D0, -1.D0, -1.D0 ] ]

         ;;
         ;; Calculate the cross product of each pair of vectors
         ;;
         for i=0L, SETSIZ-1L do begin

            cspice_vcrss, seta[*,i], setb[*,i], vout

            print, format='(A,3F5.1)', 'Vector A     : ', seta[*,i]
            print, format='(A,3F5.1)', 'Vector B     : ', setb[*,i]
            print, format='(A,3F5.1)', 'Cross product: ', vout
            print, ' '

         endfor

      END


      When this program was executed on a Mac/Intel/IDL8.x/64-bit
      platform, the output was:


      Vector A     :   0.0  1.0  0.0
      Vector B     :   1.0  0.0  0.0
      Cross product:   0.0  0.0 -1.0

      Vector A     :   5.0  5.0  5.0
      Vector B     :  -1.0 -1.0 -1.0
      Cross product:   0.0  0.0  0.0


Particulars


   cspice_vcrss calculates the three dimensional cross product of two
   vectors according to the definition.

   If `v1' and `v2' are large in magnitude (taken together, their
   magnitude surpasses the limit allowed by the computer) then it
   may be possible to generate a floating point overflow from an
   intermediate computation even though the actual cross product may
   be well within the range of double precision numbers. cspice_vcrss does
   NOT check the magnitude of `v1' or `v2' to insure that overflow will
   not occur.

   Native IDL code to calculate the same vector result:

      vout = crossp(v1,v2)

   The native IDL function accepts arbitrary sized N vectors, but
   ignores all but the first three components of the vectors. Both
   vectors must consist of at least three elements.

Exceptions


   1)  If any of the input arguments, `v1' or `v2', is undefined, an
       error is signaled by the IDL error handling system.

   2)  If any of the input arguments, `v1' or `v2', is not of the
       expected type, or it does not have the expected dimensions and
       size, an error is signaled by the Icy interface.

   3)  If the output argument `vout' is not a named variable, an
       error is signaled by the Icy interface.

Files


   None.

Restrictions


   1)  No checking of `v1' or `v2' is done to prevent floating point
       overflow. The user is required to determine that the
       magnitude of each component of the vectors is within an
       appropriate range so as not to cause floating point overflow.
       In almost every case there will be no problem and no checking
       actually needs to be done.

Required_Reading


   ICY.REQ

Literature_References


   None.

Author_and_Institution


   J. Diaz del Rio     (ODC Space)
   E.D. Wright         (JPL)

Version


   -Icy Version 1.0.2, 10-AUG-2021 (JDR)

       Edited the header to comply with NAIF standard. Added complete
       code example.

       Added -Parameters, -Exceptions, -Files, -Restrictions,
       -Literature_References and -Author_and_Institution sections, and
       completed -Particulars section.

       Removed reference to the routine's corresponding CSPICE header from
       -Abstract section.

       Added arguments' type and size information in the -I/O section.

   -Icy Version 1.0.1, 09-DEC-2005 (EDW)

       Added -Examples section.

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

Index_Entries


   vector cross product



Fri Dec 31 18:43:08 2021