1 /* zzgfspq.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 /* Table of constant values */
9
10 static doublereal c_b12 = 1e-12;
11
12 /* $Procedure ZZGFSPQ ( GF, separation quantity ) */
zzgfspq_(doublereal * et,integer * targ1,integer * targ2,doublereal * r1,doublereal * r2,integer * obs,char * abcorr,char * ref,doublereal * value,ftnlen abcorr_len,ftnlen ref_len)13 /* Subroutine */ int zzgfspq_(doublereal *et, integer *targ1, integer *targ2,
14 doublereal *r1, doublereal *r2, integer *obs, char *abcorr, char *ref,
15 doublereal *value, ftnlen abcorr_len, ftnlen ref_len)
16 {
17 /* System generated locals */
18 doublereal d__1;
19
20 /* Local variables */
21 extern doublereal vsep_(doublereal *, doublereal *);
22 extern /* Subroutine */ int chkin_(char *, ftnlen);
23 doublereal theta;
24 extern /* Subroutine */ int errdp_(char *, doublereal *, ftnlen);
25 extern doublereal vnorm_(doublereal *);
26 doublereal range1, range2;
27 extern logical failed_(void);
28 doublereal lt;
29 extern doublereal dasine_(doublereal *, doublereal *), halfpi_(void);
30 extern /* Subroutine */ int sigerr_(char *, ftnlen), chkout_(char *,
31 ftnlen), setmsg_(char *, ftnlen), errint_(char *, integer *,
32 ftnlen), spkezp_(integer *, doublereal *, char *, char *, integer
33 *, doublereal *, doublereal *, ftnlen, ftnlen);
34 extern logical return_(void);
35 doublereal pv1[3], pv2[3], ang1, ang2;
36
37 /* $ Abstract */
38
39 /* SPICE Private routine intended solely for the support of SPICE */
40 /* routines. Users should not call this routine directly due */
41 /* to the volatile nature of this routine. */
42
43 /* Compute the angular separation between the limbs of two objects. */
44
45 /* $ Disclaimer */
46
47 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
48 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
49 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
50 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
51 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
52 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
53 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
54 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
55 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
56 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
57
58 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
59 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
60 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
61 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
62 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
63 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
64
65 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
66 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
67 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
68 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
69
70 /* $ Required_Reading */
71
72 /* None. */
73
74 /* $ Keywords */
75
76 /* GEOMETRY */
77 /* ANGLE */
78
79 /* $ Declarations */
80 /* $ Brief_I/O */
81
82 /* VARIABLE I/O DESCRIPTION */
83 /* -------- --- -------------------------------------------------- */
84 /* ET I Ephemeris seconds past J2000 TDB */
85 /* TARG1 I NAIF ID for first target */
86 /* TARG2 I NAIF ID for second target */
87 /* R1 I Radius of a spherical model for TARG1 */
88 /* R2 I Radius of a spherical model for TARG2 */
89 /* OBS I NAIF ID of observer */
90 /* ABCORR I Aberration correction flag */
91 /* REF I Reference frame of the angular separation */
92 /* VALUE O Value of angular separation between objects */
93
94 /* $ Detailed_Input */
95
96 /* ET is the time in ephemeris seconds past J2000 TDB at */
97 /* which the separation is to be measured. */
98
99 /* TARG1 */
100 /* TARG2 the NAIF IDs of the two objects for which to */
101 /* determine the angular separation. */
102
103 /* R1 */
104 /* R2 are the radii of the two objects TARG1 and TARG2 */
105 /* respectively. */
106
107 /* OBS the NAIF ID identifying the body observing */
108 /* TARG1 and TARG2. */
109
110 /* ABCORR the string description of the aberration corrections */
111 /* to apply to the state evaluations to account for */
112 /* one-way light time and stellar aberration. */
113
114 /* This routine accepts the same aberration corrections */
115 /* as does the SPICE routine SPKEZR. See the header of */
116 /* SPKEZR for a detailed description of the aberration */
117 /* correction options. For convenience, the options are */
118 /* listed below: */
119
120 /* 'NONE' Apply no correction. */
121
122 /* 'LT' "Reception" case: correct for */
123 /* one-way light time using a Newtonian */
124 /* formulation. */
125
126 /* 'LT+S' "Reception" case: correct for */
127 /* one-way light time and stellar */
128 /* aberration using a Newtonian */
129 /* formulation. */
130
131 /* 'CN' "Reception" case: converged */
132 /* Newtonian light time correction. */
133
134 /* 'CN+S' "Reception" case: converged */
135 /* Newtonian light time and stellar */
136 /* aberration corrections. */
137
138 /* 'XLT' "Transmission" case: correct for */
139 /* one-way light time using a Newtonian */
140 /* formulation. */
141
142 /* 'XLT+S' "Transmission" case: correct for */
143 /* one-way light time and stellar */
144 /* aberration using a Newtonian */
145 /* formulation. */
146
147 /* 'XCN' "Transmission" case: converged */
148 /* Newtonian light time correction. */
149
150 /* 'XCN+S' "Transmission" case: converged */
151 /* Newtonian light time and stellar */
152 /* aberration corrections. */
153
154 /* The ABCORR string lacks sensitivity to case, leading */
155 /* and trailing blanks. */
156
157 /* REF is the name of the reference frame relative to which */
158 /* the angular separation should be expressed. This may */
159 /* be any frame supported by the SPICE system, including */
160 /* built-in frames (documented in the Frames Required */
161 /* Reading) and frames defined by a loaded frame kernel. */
162
163 /* When REF designates a non-inertial frame, the */
164 /* orientation of the frame is evaluated at an epoch */
165 /* dependent on the selected aberration correction. */
166
167 /* $ Detailed_Output */
168
169 /* VALUE is the light-time (and stellar aberration corrected */
170 /* if this feature is enabled) separation of the two */
171 /* objects TARG1 and TARG2 as observed from OBS. */
172
173 /* $ Parameters */
174
175 /* None. */
176
177 /* $ Exceptions */
178
179 /* 1) SPICE(BADRADIUS) signals if either R1 or R2 have a negative */
180 /* value. */
181
182 /* 2) If the ephemeris data required to perform the needed state */
183 /* look-ups are not loaded, routines called by this routine */
184 /* will signal the error SPICE(SPKINSUFFDATA). */
185
186 /* $ Files */
187
188 /* None. */
189
190 /* $ Particulars */
191
192 /* This routine determines the apparent separation between the limbs */
193 /* of two objects as observed from a third. The value reported is */
194 /* corrected for light time. Moreover, if at the time this routine */
195 /* is called, stellar aberration corrections are enabled, this */
196 /* correction will also be applied to the apparent positions of the */
197 /* centers of the two objects. */
198
199 /* $ Examples */
200
201 /* None. */
202
203 /* $ Restrictions */
204
205 /* None. */
206
207 /* $ Literature_References */
208
209 /* None. */
210
211 /* $ Author_and_Institution */
212
213 /* W.L. Taber (JPL) */
214 /* L.S. Elson (JPL) */
215
216 /* $ Version */
217
218 /* - SPICELIB Version 1.0.1, 28-JUN-2012 (EDW) */
219
220 /* Minor edits to header, correcting spelling error and improving */
221 /* syntax of Exceptions. */
222
223 /* Corrected a typo in SETMSG error message where TARG1 was quoted */
224 /* twice instead of quoting TARG1 and TARG2. This edit does change */
225 /* the error message output. */
226
227 /* - SPICELIB Version 1.0.0, 03-MAR-2009 (EDW) */
228
229 /* -& */
230 /* $ Index_Entries */
231
232 /* compute the apparent relative angular separation */
233
234 /* -& */
235
236 /* SPICELIB functions. */
237
238
239 /* Local Variables. */
240
241
242 /* ATOL is a tolerance value for computing arc sine. */
243
244
245 /* Standard SPICE error handling. */
246
247 if (return_()) {
248 return 0;
249 }
250 chkin_("ZZGFSPQ", (ftnlen)7);
251
252 /* First check for bad inputs. */
253
254 if (*r1 < 0. || *r2 < 0.) {
255 setmsg_("A negative radius for a body was encountered. The radius fo"
256 "r body # was given as #, the radius of body # was given as #"
257 ". ", (ftnlen)121);
258 errint_("#", targ1, (ftnlen)1);
259 errdp_("#", r1, (ftnlen)1);
260 errint_("#", targ2, (ftnlen)1);
261 errdp_("#", r2, (ftnlen)1);
262 sigerr_("SPICE(BADRADIUS)", (ftnlen)16);
263 chkout_("ZZGFSPQ", (ftnlen)7);
264 return 0;
265 }
266
267 /* Get the state of the TARG1, TARG2 objects relative to OBS. */
268
269 spkezp_(targ1, et, ref, abcorr, obs, pv1, <, ref_len, abcorr_len);
270 if (failed_()) {
271 chkout_("ZZGFSPQ", (ftnlen)7);
272 return 0;
273 }
274 spkezp_(targ2, et, ref, abcorr, obs, pv2, <, ref_len, abcorr_len);
275 if (failed_()) {
276 chkout_("ZZGFSPQ", (ftnlen)7);
277 return 0;
278 }
279
280 /* Compute the range to the objects of interest. */
281
282 range1 = vnorm_(pv1);
283 range2 = vnorm_(pv2);
284
285 /* Compute the apparent angular radii as seen from OBS. */
286
287 if (range1 > *r1) {
288 d__1 = *r1 / range1;
289 ang1 = dasine_(&d__1, &c_b12);
290 if (failed_()) {
291 chkout_("ZZGFSPQ", (ftnlen)7);
292 return 0;
293 }
294 } else {
295 ang1 = halfpi_();
296 }
297 if (range2 > *r2) {
298 d__1 = *r2 / range2;
299 ang2 = dasine_(&d__1, &c_b12);
300 if (failed_()) {
301 chkout_("ZZGFSPQ", (ftnlen)7);
302 return 0;
303 }
304 } else {
305 ang2 = halfpi_();
306 }
307
308 /* Finally compute the apparent separation. */
309
310 theta = vsep_(pv1, pv2);
311 *value = theta - ang1 - ang2;
312 chkout_("ZZGFSPQ", (ftnlen)7);
313 return 0;
314 } /* zzgfspq_ */
315
316