rsspice/generated/spicelib/vzero.rs
1//
2// GENERATED FILE
3//
4
5use super::*;
6use crate::SpiceContext;
7use f2rust_std::*;
8
9/// Is a vector the zero vector?
10///
11/// Indicate whether a 3-vector is the zero vector.
12///
13/// # Brief I/O
14///
15/// ```text
16///  VARIABLE  I/O  DESCRIPTION
17///  --------  ---  --------------------------------------------------
18///  V          I   Vector to be tested.
19///
20///  The function returns the value .TRUE. if and only if V is the
21///  zero vector.
22/// ```
23///
24/// # Detailed Input
25///
26/// ```text
27///  V        is a vector in 3-space.
28/// ```
29///
30/// # Detailed Output
31///
32/// ```text
33///  The function returns the value .TRUE. if and only if V is the
34///  zero vector.
35/// ```
36///
37/// # Exceptions
38///
39/// ```text
40///  Error free.
41/// ```
42///
43/// # Particulars
44///
45/// ```text
46///  This function has the same truth value as the logical expression
47///
48///     VNORM ( V )  .EQ.  0.D0
49///
50///  Replacing the above expression by
51///
52///     VZERO ( V )
53///
54///  has several advantages: the latter expresses the test more
55///  clearly, looks better, and doesn't go through the work of scaling,
56///  squaring, taking a square root, and re-scaling (all of which
57///  VNORM must do) just to find out that a vector is non-zero.
58///
59///  A related function is VZEROG, which accepts vectors of arbitrary
60///  dimension.
61/// ```
62///
63/// # Examples
64///
65/// ```text
66///  1)  When testing whether a vector is the zero vector, one
67///      normally constructs tests like
68///
69///         IF (  VNORM ( V )  .EQ.  0.D0  ) THEN
70///                     .
71///                     .
72///                     .
73///
74///
75///      These can be replaced with the code
76///
77///         IF (  VZERO ( V )  ) THEN
78///                     .
79///                     .
80///                     .
81///
82///
83///   2)  Check that a normal vector is non-zero before creating
84///      a plane with PNV2PL:
85///
86///      IF (  VZERO ( NORMAL )  )  THEN
87///
88///         [ handle error ]
89///
90///      ELSE
91///
92///         CALL PNV2PL ( POINT, NORMAL, PLANE )
93///                       .
94///                       .
95///                       .
96/// ```
97///
98/// # Author and Institution
99///
100/// ```text
101///  N.J. Bachman       (JPL)
102///  J. Diaz del Rio    (ODC Space)
103///  W.L. Taber         (JPL)
104///  I.M. Underwood     (JPL)
105/// ```
106///
107/// # Version
108///
109/// ```text
110/// -    SPICELIB Version 1.1.0, 05-JUL-2021 (JDR)
111///
112///         Added IMPLICIT NONE statement.
113///
114///         Edited the header to comply with NAIF standard.
115///
116/// -    SPICELIB Version 1.0.1, 10-MAR-1992 (WLT)
117///
118///         Comment section for permuted index source lines was added
119///         following the header.
120///
121/// -    SPICELIB Version 1.0.0, 17-JUL-1990 (NJB) (IMU)
122/// ```
123pub fn vzero(v: &[f64; 3]) -> bool {
124    let ret = VZERO(v);
125    ret
126}
127
128//$Procedure VZERO    ( Is a vector the zero vector? )
129pub fn VZERO(V: &[f64]) -> bool {
130    let V = DummyArray::new(V, 1..=3);
131    let mut VZERO: bool = false;
132
133    //
134    // `Just do it'.
135    //
136    //
137    VZERO = (((V[1] == 0.0) && (V[2] == 0.0)) && (V[3] == 0.0));
138
139    VZERO
140}