SpiceDouble vdist_c ( ConstSpiceDouble v1,
ConstSpiceDouble v2 )
Return the distance between two three-dimensional vectors.
Variable I/O Description
-------- --- --------------------------------------------------
v2 I Two 3-vectors.
The function returns the distance between v1 and v2.
v2 are two vectors in three-dimensional space, the
distance between which is desired.
The function returns the distance between v1 and v2. This is
|| v1 - v2 ||,
where || x || indicates the Euclidean norm of the vector x.
This function is simply shorthand for the code
vsub_c ( v1, v2, diff );
dist = vnorm_c ( diff );
Using this function saves you the annoyance of declaring local
storage for the difference vector diff.
The Euclidean norm of a three-dimensional vector (x, y, z) is
2 2 2
( x + y + z ).
This number is the distance of the point (x, y, z) from the
origin. If A and B are two vectors whose components are
( A(1), A(2), A(3) ) and ( B(1), B(2), B(3) ),
then the distance between A and B is the norm of the difference
A - B, which has components
( A(1) - B(1), A(2) - B(2), A(3) - B(3) ).
A related routine is vdistg_, which computes the distance between
two vectors of general dimension.
1) If v1 is
( 2.0, 3.0, 0. )
and v2 is
( 5.0, 7.0, 12. ),
vdist_c (v1, v2) will be 13..
2) If VGR2 and NEP are states of the Voyager 2 spacecraft and
Neptune with respect to some common center at a given time
vdist_c ( VGR2, NEP )
yields the distance between the spacecraft and Neptune at time
N.J. Bachman (JPL)
-CSPICE Version 1.2.0, 22-OCT-1998 (NJB)
Made input vectors const. Removed #include of SpiceZfc.h.
-CSPICE Version 1.1.0, 06-MAR-1998 (EDW)
Removed non printing character.
-CSPICE Version 1.0.0, 08-FEB-1998 (EDW)
distance between 3-dimensional vectors