Index Page vrel_c
A B C D E F G H I J K L M N O P Q R S T U V W X
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
       SpiceDouble vrel_c ( ConstSpiceDouble v1[3],
                            ConstSpiceDouble v2[3]  )
#### Abstract
       Return the relative difference between two 3-dimensional vectors.
#### Required_Reading
       None.
#### Keywords
       MATH
       VECTOR
#### Brief_I/O
       Variable  I/O  Description
       --------  ---  --------------------------------------------------
        v1,v2     I   Input vectors.
#### Detailed_Input
        v1, v2        are two 3-dimensional vectors for which the
                      relative difference is to be computed.
#### Detailed_Output
        vrel_c        the relative difference between V1 and V2.
                      It is defined as:
                                                  || v1 - v2 ||
                                vrel_c   =   ----------------------
                                           max ( ||v1||, ||v2|| )

                      where || x || indicates the Euclidean norm of
                      the vector x ( ||x|| = sqrt( x . x ) ).

                      vrel_c assumes values in the range [0,2]. If both
                      v1 and v2 are zero vectors then vrel_c is defined
                      to be zero.
#### Parameters
       None.
#### Exceptions
       Error free.

       If both v1 and v2 are zero vectors then vrel_c is defined
       to be zero.
#### Files
       None.
#### Particulars
       This function computes the relative difference between two
       3-dimensional vectors as defined above.

       The function vrelg_c may be used to find the relative difference
       for two vectors of general dimension.
#### Examples
       This example code fragment computes the relative difference
       between the geometric and light time corrected state of Io
       with respect to Voyager 2 at a given UTC time.

             #include "SpiceUsr.h"
                   .
                   .
                   .
             /.
             The NAIF integer code for Io is 501 and the code for
             Voyager 2 is -32.
             ./

             #define           IO    501
             #define           VG2   -32

             /.
             Local variables
             ./
             SpiceDouble       state [ 6 ];
             SpiceDouble       pos1  [ 3 ];
             SpiceDouble       pos2  [ 3 ];
             SpiceDouble       diff;
             SpiceDouble       lt;
             SpiceDouble       et;

             SpiceChar       * utc = "1979 JUN 25 12:00:00";

             /.
             Load the sample SPK ephemeris file.
            ./
             furnsh_c ( "VG2_JUP.BSP" );

             /.
             Convert the UTC time string to ephemeris time.
             ./
             utc2et_c ( utc, &et );

             /.
             First calculate the geometric state and then the light
             time corrected state.
             ./
             spkez_c ( IO, et, "J2000", "none", VG2, state, &lt );

             vequ_c  ( state, pos1 );

             spkez_c ( IO, et, "J2000", "lt", VG2, state, &lt );

             vequ_c  ( state, pos2 );

             /.
             Call vrel_c to find the relative difference between the
             two states.
             ./
             diff = vrel_c ( pos1, pos2 );

             .
             .
             .
#### Restrictions
       None.
#### Literature_References
       None.
#### Author_and_Institution
       J.M. Lynch     (JPL)
       E.D. Wright    (JPL)
#### Version
       -CSPICE Version 1.1.0, 28-AUG-2001 (NJB)

          Include interface macro definition file SpiceZim.h.

       -CSPICE Version 1.0.1, 13-APR-2000 (NJB)

          Made some minor updates and corrections in the code example.

       -CSPICE Version 1.0.0, 6-JUL-1999
#### Index_Entries
       relative difference of 3-dimensional vectors
#### Link to routine vrel_c source file vrel_c.c

    Wed Jun  9 13:05:32 2010