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
vdot_c

Table of contents
Procedure
Abstract
Required_Reading
Keywords
Brief_I/O
Detailed_Input
Detailed_Output
Parameters
Exceptions
Files
Particulars
Examples
Restrictions
Literature_References
Author_and_Institution
Version
Index_Entries

Procedure

   vdot_c ( Vector dot product, 3 dimensions ) 

   SpiceDouble vdot_c ( ConstSpiceDouble   v1[3],
                        ConstSpiceDouble   v2[3] )

Abstract

   Compute the dot product of two double precision, 3-dimensional
   vectors.

Required_Reading

   None.

Keywords

   VECTOR


Brief_I/O

   VARIABLE  I/O  DESCRIPTION
   --------  ---  --------------------------------------------------
   v1         I   First vector in the dot product.
   v2         I   Second vector in the dot product.

   The function returns the value of the dot product of `v1' and `v2'.

Detailed_Input

   v1,
   v2          are two arbitrary double precision 3-dimensional
               vectors.

Detailed_Output

   The function returns the value of the dot product (inner product)
   of `v1' and `v2':

      < v1, v2 >

Parameters

   None.

Exceptions

   Error free.

Files

   None.

Particulars

   vdot_c calculates the dot product of `v1' and `v2' by a simple
   application of the definition:

                   1
                .-----
                 \
      vdot_c  =   )  v1[i] * v2[i]
                 /
                '-----
                  i=0

   No error checking is performed to prevent or recover from numeric
   overflow.

Examples

   The numerical results shown for this example may differ across
   platforms. The results depend on the SPICE kernels used as
   input, the compiler and supporting libraries, and the machine
   specific arithmetic implementation.

   1) Suppose that you have a set of double precision 3-dimensional
      vectors. Check if they are orthogonal to the Z-axis.


      Example code begins here.


      /.
         Program vdot_ex1
      ./
      #include <stdio.h>
      #include "SpiceUsr.h"

      int main( )
      {

         /.
         Local parameters.
         ./
         #define SETSIZ       4

         /.
         Local variables.
         ./
         SpiceInt             i;

         /.
         Define the vector set.
         ./
         SpiceDouble          v1     [SETSIZ][3] = {
                                              { 1.0,  0.0,  0.0 },
                                              { 0.0, -6.0,  0.0 },
                                              {10.0,  0.0, -1.0 },
                                              { 0.0,  0.0,  1.0 } };

         SpiceDouble          z      [3]    = { 0.0,  0.0,  1.0 };

         /.
         Check the orthogonality with respect to `z' of each
         vector in `v1'.
         ./
         for ( i = 0; i < SETSIZ; i++ )
         {

            printf( "\n" );
            printf( "Input vector (V1):  %5.1f %5.1f %5.1f\n",
                              v1[i][0], v1[i][1], v1[i][2] );

            if ( vdot_c ( v1[i], z ) == 0.0 )
            {
               printf( "V1 and Z are orthogonal.\n" );
            }
            else
            {
               printf( "V1 and Z are NOT orthogonal.\n" );
            }

         }

         return ( 0 );
      }


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


      Input vector (V1):    1.0   0.0   0.0
      V1 and Z are orthogonal.

      Input vector (V1):    0.0  -6.0   0.0
      V1 and Z are orthogonal.

      Input vector (V1):   10.0   0.0  -1.0
      V1 and Z are NOT orthogonal.

      Input vector (V1):    0.0   0.0   1.0
      V1 and Z are NOT orthogonal.

Restrictions

   1)  The user is responsible for determining that the vectors `v1'
       and `v2' are not so large as to cause numeric overflow. In
       most cases this will not present a problem.

Literature_References

   None.

Author_and_Institution

   N.J. Bachman        (JPL)
   J. Diaz del Rio     (ODC Space)
   W.M. Owen           (JPL)
   E.D. Wright         (JPL)

Version

   -CSPICE Version 1.0.3, 10-AUG-2021 (JDR)

       Edited the header to comply with NAIF standard. Added complete
       code example. Improved -Particulars section.

   -CSPICE Version 1.0.2, 16-JAN-2008 (EDW)

       Corrected typos in header titles:

          Detailed Input to -Detailed_Input
          Detailed Output to -Detailed_Output

   -CSPICE Version 1.0.1, 12-NOV-2006 (EDW)

       Added -Parameters section header.

   -CSPICE Version 1.0.0, 16-APR-1999 (EDW) (WMO) (NJB)

Index_Entries

   dot product 3-dimensional vectors
Fri Dec 31 18:41:14 2021