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

vzero_c ( Is a vector the zero vector? )

SpiceBoolean vzero_c ( ConstSpiceDouble v[3] )

Abstract

Indicate whether a 3-vector is the zero vector.

None.

MATH
VECTOR

Brief_I/O

VARIABLE  I/O  DESCRIPTION
--------  ---  --------------------------------------------------
v          I   Vector to be tested.

The function returns the value SPICETRUE if and only if `v' is the
zero vector.

Detailed_Input

v           is a vector in 3-space.

Detailed_Output

The function returns the value SPICETRUE if and only if `v' is the
zero vector.

None.

Error free.

None.

Particulars

This function has the same truth value as the logical expression

vnorm_c ( v )  ==  0.

Replacing the above expression by

vzero_c ( v );

has several advantages: the latter expresses the test more
clearly, looks better, and doesn't go through the work of scaling,
squaring, taking a square root, and re-scaling (all of which
vnorm_c must do) just to find out that a vector is non-zero.

A related function is vzerog_c, which accepts vectors of arbitrary
dimension.

Examples

1)  When testing whether a vector is the zero vector, one
normally constructs tests like

if (  vnorm_c ( v ) ==  0.  )
{
.
.
.

These can be replaced with the code

if (  vzero_c ( v )  )
{
.
.
.

2) Check that a normal vector is non-zero before creating
a plane with pnv2pl_c:

if (  vzero_c ( NORMAL )  )
{
[ handle error ]
}

else
{
pnv2pl_c ( POINT, NORMAL, PLANE )
.
.
.
}

None.

None.

Author_and_Institution

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

Version

-CSPICE Version 1.1.1, 05-JUL-2021 (JDR)

Edited the header to comply with NAIF standard.

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

Made input vector const. Removed #include of SpiceZfc.h.

-CSPICE Version 1.0.0, 08-FEB-1998 (EDW) (IMU)

Index_Entries

test whether a 3-dimensional vector is the zero vector
Fri Dec 31 18:41:15 2021