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 vlcom3_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
       vlcom3_c ( Vector linear combination, 3 dimensions )

       void vlcom3_c ( SpiceDouble        a,
                       ConstSpiceDouble   v1 [3],
                       SpiceDouble        b,
                       ConstSpiceDouble   v2 [3],
                       SpiceDouble        c,
                       ConstSpiceDouble   v3 [3],
                       SpiceDouble        sum[3]  )
#### Abstract
       Compute the vector linear combination of three double precision
       3-dimensional vectors.
#### Required_Reading
       None.
#### Keywords
       VECTOR
#### Brief_I/O
       VARIABLE  I/O  DESCRIPTION
       --------  ---  --------------------------------------------------
       a          I   Coefficient of `v1'.
       v1         I   Vector in 3-space.
       b          I   Coefficient of `v2'.
       v2         I   Vector in 3-space.
       c          I   Coefficient of `v3'.
       v3         I   Vector in 3-space.
       sum        O   Linear vector combination a*v1 + b*v2 + c*v3.
#### Detailed_Input
       a           is the double precision scalar variable that multiplies
                   `v1'.

       v1          is an arbitrary, double precision 3-dimensional vector.

       b           is the double precision scalar variable that multiplies
                   `v2'.

       v2          is an arbitrary, double precision 3-dimensional vector.

       c           is the double precision scalar variable that multiplies
                   `v3'.

       v3          is a double precision 3-dimensional vector.
#### Detailed_Output
       sum         is the double precision 3-dimensional vector which
                   contains the linear combination

                      a * v1 + b * v2 + c * v3
#### Parameters
       None.
#### Exceptions
       Error free.
#### Files
       None.
#### Particulars
       The code reflects precisely the following mathematical expression

          For each value of the index `i', from 0 to 2:

       sum[i] = a * v1[i] + b * v2[i] + c * v3[i]

       No error checking is performed to guard against 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 you have an instrument with an elliptical field
          of view described by its angular extent along the semi-minor
          and semi-major axes.

          The following code example demonstrates how to create
          16 vectors aiming at visualizing the field-of-view in
          three dimensional space.

          Example code begins here.

          /.
             Program vlcom3_ex1
          ./
          #include <math.h>
          #include <stdio.h>
          #include "SpiceUsr.h"

          int main( )
          {

             /.
             Local parameters.

             Define the two angular extends, along the semi-major
             (u) and semi-minor (v) axes of the elliptical field
             of view, in radians.
             ./
             #define MAXANG       0.07
             #define MINANG       0.035

             /.
             Local variables.
             ./
             SpiceDouble          a;
             SpiceDouble          b;
             SpiceDouble          step;
             SpiceDouble          theta;
             SpiceDouble          vector [3];
             SpiceInt             i;

             /.
             Let `u' and `v' be orthonormal 3-vectors spanning the
             focal plane of the instrument, and `z' its
             boresight.
             ./
             SpiceDouble          u      [3] = { 1.0,  0.0,  0.0 };
             SpiceDouble          v      [3] = { 0.0,  1.0,  0.0 };
             SpiceDouble          z      [3] = { 0.0,  0.0,  1.0 };

             /.
             Find the length of the ellipse's axes. Note that
             we are dealing with unitary vectors.
             ./
             a = tan ( MAXANG );
             b = tan ( MINANG );

             /.
             Compute the vectors of interest and display them
             ./
             theta = 0.0;
             step  = twopi_c() / 16;

             for ( i = 0; i < 16; i++ )
             {

                vlcom3_c ( 1.0, z, a * cos(theta), u, b * sin(theta), v, vector );

                printf( "%2d: %9.6f %9.6f %9.6f\n",
                        (int)i, vector[0], vector[1], vector[2] );

                theta = theta + step;

             }

             return ( 0 );
          }

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

           0:  0.070115  0.000000  1.000000
           1:  0.064777  0.013399  1.000000
           2:  0.049578  0.024759  1.000000
           3:  0.026832  0.032349  1.000000
           4:  0.000000  0.035014  1.000000
           5: -0.026832  0.032349  1.000000
           6: -0.049578  0.024759  1.000000
           7: -0.064777  0.013399  1.000000
           8: -0.070115  0.000000  1.000000
           9: -0.064777 -0.013399  1.000000
          10: -0.049578 -0.024759  1.000000
          11: -0.026832 -0.032349  1.000000
          12: -0.000000 -0.035014  1.000000
          13:  0.026832 -0.032349  1.000000
          14:  0.049578 -0.024759  1.000000
          15:  0.064777 -0.013399  1.000000
#### Restrictions
       1)  No error checking is performed to guard against numeric
           overflow or underflow. The user is responsible for insuring
           that the input values are reasonable.
#### Literature_References
       None.
#### Author_and_Institution
       N.J. Bachman        (JPL)
       J. Diaz del Rio     (ODC Space)
       W.L. Taber          (JPL)
       E.D. Wright         (JPL)
#### Version
       -CSPICE Version 1.1.1, 10-AUG-2021 (JDR)

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

           Added -Restrictions #1.

       -CSPICE Version 1.1.0, 22-OCT-1998 (NJB)

           Made input vectors const.

       -CSPICE Version 1.0.0, 08-FEB-1998 (EDW) (WLT)
#### Index_Entries
       linear combination of three 3-dimensional vectors
#### Link to routine vlcom3_c source file vlcom3_c.c

    Fri Dec 31 18:41:14 2021