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
vrel_c

 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

```   vrel_c ( Vector relative difference, 3 dimensions )

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

```

#### Abstract

```   Return the relative difference between two 3-dimensional vectors.
```

```   None.
```

#### Keywords

```   MATH
VECTOR

```

#### Brief_I/O

```   VARIABLE  I/O  DESCRIPTION
--------  ---  --------------------------------------------------
v1,
v2         I   Input vectors.

The function returns the relative difference between two
3-dimensional vectors.
```

#### Detailed_Input

```   v1,
v2          are two 3-dimensional vectors for which the relative
difference is to be computed.
```

#### Detailed_Output

```   The function returns the relative difference between the two input
3-dimensional vectors `v1' and `v2'.

It is defined as:

|| v1 - v2 ||
vrel_c   =   ------------------------
max ( ||v1||, ||v2|| )

where ||x|| indicates the Euclidean norm of the vector `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.

1)  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

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

#### Version

```   -CSPICE Version 1.1.1, 09-APR-2021 (JDR)

Edited the header to comply with NAIF standard.

-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)

```   relative difference of 3-dimensional vectors
`Fri Dec 31 18:41:15 2021`