1 /* zzrotgt1.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 integer c__1 = 1;
11
12 /* $Procedure ZZROTGT1 (Frame get transformation) */
zzrotgt1_(integer * infrm,doublereal * et,doublereal * rotate,integer * outfrm,logical * found)13 /* Subroutine */ int zzrotgt1_(integer *infrm, doublereal *et, doublereal *
14 rotate, integer *outfrm, logical *found)
15 {
16 /* System generated locals */
17 integer i__1;
18
19 /* Builtin functions */
20 /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);
21 integer s_rnge(char *, integer, char *, integer);
22
23 /* Local variables */
24 doublereal tipm[9] /* was [3][3] */;
25 integer type__, i__, j;
26 extern /* Subroutine */ int chkin_(char *, ftnlen), errch_(char *, char *,
27 ftnlen, ftnlen);
28 char versn[6];
29 extern /* Subroutine */ int xpose_(doublereal *, doublereal *);
30 extern logical failed_(void);
31 integer center;
32 extern /* Subroutine */ int tipbod_(char *, integer *, doublereal *,
33 doublereal *, ftnlen), namfrm_(char *, integer *, ftnlen),
34 frinfo_(integer *, integer *, integer *, integer *, logical *),
35 tkfram_(integer *, doublereal *, integer *, logical *), ckfrot_(
36 integer *, doublereal *, doublereal *, integer *, logical *),
37 sigerr_(char *, ftnlen);
38 integer typeid;
39 extern /* Subroutine */ int chkout_(char *, ftnlen), setmsg_(char *,
40 ftnlen), errint_(char *, integer *, ftnlen), irfrot_(integer *,
41 integer *, doublereal *);
42 extern logical return_(void);
43
44 /* $ Abstract */
45
46 /* SPICE Private routine intended solely for the support of SPICE */
47 /* routines. Users should not call this routine directly due */
48 /* to the volatile nature of this routine. */
49
50 /* Find the rotation from a user specified frame to */
51 /* another frame at a user specified epoch. */
52
53 /* $ Disclaimer */
54
55 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
56 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
57 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
58 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
59 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
60 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
61 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
62 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
63 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
64 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
65
66 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
67 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
68 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
69 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
70 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
71 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
72
73 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
74 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
75 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
76 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
77
78 /* $ Required_Reading */
79
80 /* None. */
81
82 /* $ Keywords */
83
84 /* FRAMES */
85
86 /* $ Declarations */
87 /* $ Abstract */
88
89 /* The parameters below form an enumerated list of the recognized */
90 /* frame types. They are: INERTL, PCK, CK, TK, DYN. The meanings */
91 /* are outlined below. */
92
93 /* $ Disclaimer */
94
95 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
96 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
97 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
98 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
99 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
100 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
101 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
102 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
103 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
104 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
105
106 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
107 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
108 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
109 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
110 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
111 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
112
113 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
114 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
115 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
116 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
117
118 /* $ Parameters */
119
120 /* INERTL an inertial frame that is listed in the routine */
121 /* CHGIRF and that requires no external file to */
122 /* compute the transformation from or to any other */
123 /* inertial frame. */
124
125 /* PCK is a frame that is specified relative to some */
126 /* INERTL frame and that has an IAU model that */
127 /* may be retrieved from the PCK system via a call */
128 /* to the routine TISBOD. */
129
130 /* CK is a frame defined by a C-kernel. */
131
132 /* TK is a "text kernel" frame. These frames are offset */
133 /* from their associated "relative" frames by a */
134 /* constant rotation. */
135
136 /* DYN is a "dynamic" frame. These currently are */
137 /* parameterized, built-in frames where the full frame */
138 /* definition depends on parameters supplied via a */
139 /* frame kernel. */
140
141 /* ALL indicates any of the above classes. This parameter */
142 /* is used in APIs that fetch information about frames */
143 /* of a specified class. */
144
145
146 /* $ Author_and_Institution */
147
148 /* N.J. Bachman (JPL) */
149 /* W.L. Taber (JPL) */
150
151 /* $ Literature_References */
152
153 /* None. */
154
155 /* $ Version */
156
157 /* - SPICELIB Version 4.0.0, 08-MAY-2012 (NJB) */
158
159 /* The parameter ALL was added to support frame fetch APIs. */
160
161 /* - SPICELIB Version 3.0.0, 28-MAY-2004 (NJB) */
162
163 /* The parameter DYN was added to support the dynamic frame class. */
164
165 /* - SPICELIB Version 2.0.0, 12-DEC-1996 (WLT) */
166
167 /* Various unused frames types were removed and the */
168 /* frame time TK was added. */
169
170 /* - SPICELIB Version 1.0.0, 10-DEC-1995 (WLT) */
171
172 /* -& */
173
174 /* End of INCLUDE file frmtyp.inc */
175
176 /* $ Brief_I/O */
177
178 /* VARIABLE I/O DESCRIPTION */
179 /* -------- --- -------------------------------------------------- */
180 /* INFRM I The integer code for a SPICE reference frame. */
181 /* ET I An epoch in seconds past J2000. */
182 /* ROTATE O A rotation matrix. */
183 /* OUTFRM O The frame that ROTATE transforms INFRM to. */
184 /* FOUND O TRUE if a rotation can be found. */
185
186 /* $ Detailed_Input */
187
188 /* INFRM is the SPICE id-code for some reference frame. */
189
190 /* ET is an epoch in ephemeris seconds past J2000 at */
191 /* which the user wishes to retrieve a transformation */
192 /* matrix. */
193
194 /* $ Detailed_Output */
195
196 /* ROTATE is a 3x3 matrix that transforms positions relative to */
197 /* INFRM to positions relative to OUTFRM. (Assuming such */
198 /* a rotation can be found.) */
199
200 /* OUTFRM is a reference frame. The 3x3 matrix ROTATE rotates */
201 /* positions relative to INFRM to positions relative */
202 /* to OUTFRM. */
203 /* The positions transformation is achieved by */
204 /* multiplying */
205 /* ROTATE on the right by a position relative to INFRM. */
206 /* This */
207 /* is easily accomplished via the subroutine call */
208 /* shown below. */
209
210 /* CALL MXV ( ROTATE, INPOS, OUTPOS ) */
211
212 /* FOUND is a logical flag indicating whether or not a */
213 /* rotation matrix could be found from INFRM */
214 /* to some other frame. If a rotation matrix */
215 /* cannot be found OUTFRM will be set to zero, FOUND */
216 /* will be set to FALSE and ROTATE will be returned */
217 /* as the zero matrix. */
218
219 /* $ Parameters */
220
221 /* None. */
222
223 /* $ Exceptions */
224
225 /* 1) If a rotation matrix cannot be located, then */
226 /* FOUND will be set to FALSE, OUTFRM will be set to zero */
227 /* and ROTATE will be set to the zero 3x3 matrix. */
228
229 /* 2) If the class of the requested frame is not recognized the */
230 /* exception 'SPICE(UNKNOWNFRAMETYPE)' will be signalled. */
231
232 /* 3) If the reference frame REF is dynamic, the error */
233 /* SPICE(RECURSIONTOODEEP) will be signaled. */
234
235 /* $ Files */
236
237 /* None. */
238
239 /* $ Particulars */
240
241 /* This is a low level routine used for determining a chain of */
242 /* position transformation matrices from one frame to another. */
243
244 /* $ Examples */
245
246 /* See FRMCHG. */
247
248 /* $ Restrictions */
249
250 /* 1) SPICE Private routine. */
251
252 /* $ Literature_References */
253
254 /* None. */
255
256 /* $ Author_and_Institution */
257
258 /* N.J. Bachman (JPL) */
259 /* W.L. Taber (JPL) */
260
261 /* $ Version */
262
263 /* - SPICELIB Version 1.0.1, 02-MAR-2010 (NJB) */
264
265 /* Order of header sections was corrected. */
266
267 /* - SPICELIB Version 1.0.0, 12-DEC-2004 (NJB) */
268
269 /* Based on SPICELIB Version 2.0.0, 21-JUN-2004 (NJB) */
270
271 /* -& */
272 /* $ Index_Entries */
273
274 /* Find a rotation matrix from a specified frame */
275
276 /* -& */
277
278 /* Spicelib Functions */
279
280
281 /* Local Variables */
282
283 s_copy(versn, "1.0.0", (ftnlen)6, (ftnlen)5);
284 *found = FALSE_;
285
286 /* Standard SPICE error handling. */
287
288 if (return_()) {
289 return 0;
290 }
291 chkin_("ZZROTGT1", (ftnlen)8);
292
293 /* Get all the needed information about this frame. */
294
295 frinfo_(infrm, ¢er, &type__, &typeid, found);
296 if (! (*found)) {
297 for (i__ = 1; i__ <= 3; ++i__) {
298 for (j = 1; j <= 3; ++j) {
299 rotate[(i__1 = i__ + j * 3 - 4) < 9 && 0 <= i__1 ? i__1 :
300 s_rnge("rotate", i__1, "zzrotgt1_", (ftnlen)204)] =
301 0.;
302 }
303 }
304 chkout_("ZZROTGT1", (ftnlen)8);
305 return 0;
306 }
307 if (type__ == 1) {
308 irfrot_(infrm, &c__1, rotate);
309 *found = TRUE_;
310 *outfrm = 1;
311 } else if (type__ == 2) {
312 tipbod_("J2000", &typeid, et, tipm, (ftnlen)5);
313 xpose_(tipm, rotate);
314 namfrm_("J2000", outfrm, (ftnlen)5);
315 *found = ! failed_();
316 } else if (type__ == 3) {
317 ckfrot_(&typeid, et, rotate, outfrm, found);
318 } else if (type__ == 4) {
319 tkfram_(&typeid, rotate, outfrm, found);
320 } else if (type__ == 5) {
321 setmsg_("The reference frame # is a dynamic frame. Dynamic frames ma"
322 "y not be used at recursion level 1.", (ftnlen)94);
323 errint_("#", infrm, (ftnlen)1);
324 sigerr_("SPICE(RECURSIONTOODEEP)", (ftnlen)23);
325 chkout_("ZZROTGT1", (ftnlen)8);
326 return 0;
327 } else {
328 setmsg_("The reference frame # has class id-code #. This form of ref"
329 "erence frame is not supported in version # of ZZROTGT1. You "
330 "need to update your version of SPICELIB to the latest versio"
331 "n in order to support this frame. ", (ftnlen)213);
332 errint_("#", infrm, (ftnlen)1);
333 errint_("#", &type__, (ftnlen)1);
334 errch_("#", versn, (ftnlen)1, (ftnlen)6);
335 sigerr_("SPICE(UNKNOWNFRAMETYPE)", (ftnlen)23);
336 chkout_("ZZROTGT1", (ftnlen)8);
337 return 0;
338 }
339 if (failed_() || ! (*found)) {
340 for (i__ = 1; i__ <= 3; ++i__) {
341 for (j = 1; j <= 3; ++j) {
342 rotate[(i__1 = i__ + j * 3 - 4) < 9 && 0 <= i__1 ? i__1 :
343 s_rnge("rotate", i__1, "zzrotgt1_", (ftnlen)268)] =
344 0.;
345 }
346 }
347 *found = FALSE_;
348 }
349 chkout_("ZZROTGT1", (ftnlen)8);
350 return 0;
351 } /* zzrotgt1_ */
352
353