1 /* wnelmd.f -- translated by f2c (version 19980913).
2    You must link the resulting object file with the libraries:
3 	-lf2c -lm   (in that order)
4 */
5 
6 #include "f2c.h"
7 
8 /* $Procedure            WNELMD ( Element of a DP window ) */
wnelmd_(doublereal * point,doublereal * window)9 logical wnelmd_(doublereal *point, doublereal *window)
10 {
11     /* System generated locals */
12     integer i__1;
13     logical ret_val;
14 
15     /* Local variables */
16     integer card, i__;
17     extern integer cardd_(doublereal *);
18     extern /* Subroutine */ int chkin_(char *, ftnlen), chkout_(char *,
19 	    ftnlen);
20     extern logical return_(void);
21 
22 /* $ Abstract */
23 
24 /*     Determine whether a point is an element of a double precision */
25 /*     window. */
26 
27 /* $ Disclaimer */
28 
29 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
30 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
31 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
32 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
33 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
34 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
35 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
36 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
37 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
38 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
39 
40 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
41 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
42 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
43 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
44 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
45 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
46 
47 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
48 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
49 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
50 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
51 
52 /* $ Required_Reading */
53 
54 /*     WINDOWS */
55 
56 /* $ Keywords */
57 
58 /*     WINDOWS */
59 
60 /* $ Declarations */
61 /* $ Brief_I/O */
62 
63 /*      VARIABLE  I/O  DESCRIPTION */
64 /*      --------  ---  -------------------------------------------------- */
65 /*      POINT      I   Input point. */
66 /*      WINDOW     I   Input window. */
67 
68 /*      The function returns TRUE if POINT is an element of WINDOW. */
69 
70 /* $ Detailed_Input */
71 
72 /*      POINT       is a point, which may or may not be contained in */
73 /*                  one of the intervals in WINDOW. */
74 
75 /*      WINDOW      is a window containing zero or more intervals. */
76 
77 /* $ Detailed_Output */
78 
79 /*      The function returns TRUE if the input point is an element of */
80 /*      the input window---that is, if */
81 
82 /*            a(i)  <  POINT  <  b(i) */
83 /*                  -         - */
84 
85 /*      for some interval [ a(i), b(i) ] in WINDOW---and returns FALSE */
86 /*      otherwise. */
87 
88 /* $ Parameters */
89 
90 /*     None. */
91 
92 /* $ Particulars */
93 
94 /*      None. */
95 
96 /* $ Examples */
97 
98 /*      Let A contain the intervals */
99 
100 /*            [ 1, 3 ]  [ 7, 11 ]  [ 23, 27 ] */
101 
102 /*      Then the following expressions are true */
103 
104 /*            WNELMD ( 1, WINDOW ) */
105 /*            WNELMD ( 9, WINDOW ) */
106 
107 /*      and the following expressions are false. */
108 
109 /*            WNELMD (  0, WINDOW ) */
110 /*            WNELMD ( 13, WINDOW ) */
111 /*            WNELMD ( 29, WINDOW ) */
112 
113 /* $ Exceptions */
114 
115 /*     None. */
116 
117 /* $ Files */
118 
119 /*      None. */
120 
121 /* $ Restrictions */
122 
123 /*      None. */
124 
125 /* $ Literature_References */
126 
127 /*      None. */
128 
129 /* $ Author_and_Institution */
130 
131 /*      H.A. Neilan     (JPL) */
132 /*      W.L. Taber      (JPL) */
133 /*      I.M. Underwood  (JPL) */
134 
135 /* $ Version */
136 
137 /* -     SPICELIB Version 1.1.0, 17-MAY-1994 (HAN) */
138 
139 /*        If the value of the function RETURN is TRUE upon execution of */
140 /*        this module, this function is assigned a default value of */
141 /*        either 0, 0.0D0, .FALSE., or blank depending on the type of */
142 /*        the function. */
143 
144 /* -     SPICELIB Version 1.0.1, 10-MAR-1992 (WLT) */
145 
146 /*         Comment section for permuted index source lines was added */
147 /*         following the header. */
148 
149 /* -     SPICELIB Version 1.0.0, 31-JAN-1990 (WLT) (IMU) */
150 
151 /* -& */
152 /* $ Index_Entries */
153 
154 /*     element of a d.p. window */
155 
156 /* -& */
157 /* $ Revisions */
158 
159 /* -     Beta Version 1.2.0, 24-FEB-1989  (HAN) */
160 
161 /*         Added calls to CHKIN and CHKOUT. */
162 
163 /* -& */
164 
165 /*     SPICELIB functions */
166 
167 
168 /*     Local variables */
169 
170 
171 /*     Standard SPICE error handling. */
172 
173     if (return_()) {
174 	ret_val = FALSE_;
175 	return ret_val;
176     } else {
177 	chkin_("WNELMD", (ftnlen)6);
178     }
179 
180 /*     How many endpoints in the window? */
181 
182     card = cardd_(window);
183 
184 /*     Check the point against every interval in the window. Quit if */
185 /*     we find an interval that contains it. Inefficient, but it works. */
186 
187     i__1 = card;
188     for (i__ = 1; i__ <= i__1; i__ += 2) {
189 	if (*point >= window[i__ + 5] && *point <= window[i__ + 6]) {
190 	    ret_val = TRUE_;
191 	    chkout_("WNELMD", (ftnlen)6);
192 	    return ret_val;
193 	}
194     }
195     ret_val = FALSE_;
196     chkout_("WNELMD", (ftnlen)6);
197     return ret_val;
198 } /* wnelmd_ */
199 
200