SpiceDouble vrel_c ( ConstSpiceDouble v1[3],
ConstSpiceDouble v2[3] )
Return the relative difference between two 3-dimensional vectors.
None.
MATH
VECTOR
Variable I/O Description
-------- --- --------------------------------------------------
v1,v2 I Input vectors.
v1, v2 are two 3-dimensional vectors for which the
relative difference is to be computed.
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.
None.
Error free.
If both v1 and v2 are zero vectors then vrel_c is defined
to be zero.
None.
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.
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, < );
vequ_c ( state, pos1 );
spkez_c ( IO, et, "J2000", "lt", VG2, state, < );
vequ_c ( state, pos2 );
/.
Call vrel_c to find the relative difference between the
two states.
./
diff = vrel_c ( pos1, pos2 );
.
.
.
None.
None.
J.M. Lynch (JPL)
E.D. Wright (JPL)
-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
relative difference of 3-dimensional vectors
Link to routine vrel_c source file vrel_c.c
|