1 /* pxfrm2.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 PXFRM2 ( Position Transform Matrix, Different Epochs ) */
pxfrm2_(char * from,char * to,doublereal * etfrom,doublereal * etto,doublereal * rotate,ftnlen from_len,ftnlen to_len)13 /* Subroutine */ int pxfrm2_(char *from, char *to, doublereal *etfrom,
14 doublereal *etto, doublereal *rotate, ftnlen from_len, ftnlen to_len)
15 {
16 /* Initialized data */
17
18 static logical first = TRUE_;
19
20 static char svto[32];
21 extern /* Subroutine */ int zznamfrm_(integer *, char *, integer *, char *
22 , integer *, ftnlen, ftnlen), zzctruin_(integer *);
23 integer fcode;
24 extern /* Subroutine */ int chkin_(char *, ftnlen);
25 integer tcode;
26 extern /* Subroutine */ int errch_(char *, char *, ftnlen, ftnlen);
27 doublereal jf[9] /* was [3][3] */;
28 static integer svctr1[2], svctr2[2];
29 doublereal tj[9] /* was [3][3] */;
30 extern /* Subroutine */ int refchg_(integer *, integer *, doublereal *,
31 doublereal *);
32 static integer svfcod, svtcde;
33 extern /* Subroutine */ int sigerr_(char *, ftnlen), chkout_(char *,
34 ftnlen), setmsg_(char *, ftnlen);
35 static char svfrom[32];
36 extern logical return_(void);
37 extern /* Subroutine */ int mxm_(doublereal *, doublereal *, doublereal *)
38 ;
39
40 /* $ Abstract */
41
42 /* Return the 3x3 matrix that transforms position vectors from one */
43 /* specified frame at a specified epoch to another specified */
44 /* frame at another specified epoch. */
45
46 /* $ Disclaimer */
47
48 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
49 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
50 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
51 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
52 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
53 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
54 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
55 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
56 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
57 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
58
59 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
60 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
61 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
62 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
63 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
64 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
65
66 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
67 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
68 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
69 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
70
71 /* $ Required_Reading */
72
73 /* FRAMES */
74
75 /* $ Keywords */
76
77 /* FRAMES */
78 /* TRANSFORM */
79
80 /* $ Declarations */
81 /* $ Abstract */
82
83 /* This include file defines the dimension of the counter */
84 /* array used by various SPICE subsystems to uniquely identify */
85 /* changes in their states. */
86
87 /* $ Disclaimer */
88
89 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
90 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
91 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
92 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
93 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
94 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
95 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
96 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
97 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
98 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
99
100 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
101 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
102 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
103 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
104 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
105 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
106
107 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
108 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
109 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
110 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
111
112 /* $ Parameters */
113
114 /* CTRSIZ is the dimension of the counter array used by */
115 /* various SPICE subsystems to uniquely identify */
116 /* changes in their states. */
117
118 /* $ Author_and_Institution */
119
120 /* B.V. Semenov (JPL) */
121
122 /* $ Literature_References */
123
124 /* None. */
125
126 /* $ Version */
127
128 /* - SPICELIB Version 1.0.0, 29-JUL-2013 (BVS) */
129
130 /* -& */
131
132 /* End of include file. */
133
134 /* $ Brief_I/O */
135
136 /* VARIABLE I/O DESCRIPTION */
137 /* -------- --- -------------------------------------------------- */
138 /* FROM I Name of the frame to transform from. */
139 /* TO I Name of the frame to transform to. */
140 /* ETFROM I Evaluation time of 'FROM' frame. */
141 /* ETTO I Evaluation time of 'TO' frame. */
142 /* ROTATE O A position transformation matrix from */
143 /* frame FROM to frame TO. */
144
145 /* $ Detailed_Input */
146
147 /* FROM is the name of a reference frame recognized by */
148 /* SPICELIB that corresponds to the input ETFROM. */
149
150
151 /* TO is the name of a reference frame recognized by */
152 /* SPICELIB that corresponds to the desired output */
153 /* at ETTO. */
154
155
156 /* ETFROM is the epoch in ephemeris seconds past the epoch */
157 /* of J2000 (TDB) corresponding to the FROM reference */
158 /* frame. */
159
160
161 /* ETTO is the epoch in ephemeris seconds past the epoch */
162 /* of J2000 (TDB) that corresponds to the TO reference */
163 /* frame. */
164
165
166 /* $ Detailed_Output */
167
168 /* ROTATE is the transformation matrix that relates the reference */
169 /* frame FROM at epoch ETFROM to the frame TO at epoch */
170 /* ETTO. */
171
172 /* If (x, y, z) is a position relative to the reference */
173 /* frame FROM at time ETFROM then the vector ( x', y', */
174 /* z') is the same position relative to the frame TO at */
175 /* epoch ETTO. Here the vector ( x', y', z' ) is defined */
176 /* by the equation: */
177
178 /* - - - - - - */
179 /* | x' | | | | x | */
180 /* | y' | = | ROTATE | | y | */
181 /* | z' | | | | z | */
182 /* - - - - - - */
183
184 /* $ Parameters */
185
186 /* None. */
187
188
189 /* $ Exceptions */
190
191 /* 1) If sufficient information has not been supplied via loaded */
192 /* SPICE kernels to compute the transformation between the */
193 /* two frames, the error will be diagnosed by a routine */
194 /* in the call tree to this routine. */
195
196 /* 2) If either frame FROM or TO is not recognized the error */
197 /* 'SPICE(UNKNOWNFRAME)' will be signaled. */
198
199 /* $ Files */
200
201 /* Appropriate kernels must be loaded by the calling program before */
202 /* this routine is called. Kernels that may be required include */
203 /* SPK files, PCK files, frame kernels, C-kernels, and SCLK kernels. */
204
205 /* Such kernel data are normally loaded once per program */
206 /* run, NOT every time this routine is called. */
207
208 /* $ Particulars */
209
210 /* PXFRM2 is most commonly used to transform a position between */
211 /* time-dependant reference frames. */
212
213 /* For more examples of where to use PXFRM2, please see: */
214
215 /* SINCPT */
216 /* SURFPT */
217 /* SUBSLR */
218 /* ILUMIN */
219
220 /* $ Examples */
221
222 /* The numerical results shown for these examples may differ across */
223 /* platforms. The results depend on the SPICE kernels used as */
224 /* input, the compiler and supporting libraries, and the machine */
225 /* specific arithmetic implementation. */
226
227 /* 1) Suppose that MGS has taken a picture of Mars at time ETREC with */
228 /* the MOC narrow angle camera. We want to know the latitude and */
229 /* longitude associated with two pixels projected to Mars' */
230 /* surface: the boresight and one along the boundary of the */
231 /* field of view (FOV). Due to light time, the photons taken in */
232 /* the picture left Mars at time ETEMIT, when Mars was at a */
233 /* different state than at time ETREC. */
234
235 /* In order to solve this problem, we could use the SINCPT */
236 /* routine for both pixels, but this would be slow. Instead, we */
237 /* will assume that the light time for each pixel is the same. We */
238 /* will call SINCPT once to get the light time and surface point */
239 /* associated with the boresight. Then, we will rotate one of the */
240 /* FOV boundary vectors from the camera frame at ETREC to the */
241 /* body-fixed Mars frame at ETEMIT, and call the faster routine */
242 /* SURFPT to retrieve the surface point for one of the FOV */
243 /* boundary vectors. */
244
245 /* This example problem could be extended to find the latitude */
246 /* and longitude associated with every pixel in an instrument's */
247 /* field of view, but this example is simplified to only solve */
248 /* for two pixels: the boresight and one along the boundary of */
249 /* the field of view. */
250
251 /* Assumptions: */
252
253 /* 1) The light times from the surface points in the camera's */
254 /* field of view to the camera are equal. */
255
256 /* 2) The camera offset from the center of gravity of the */
257 /* spacecraft is zero. If the data are more accurate */
258 /* and precise, this assumption can be easily discarded. */
259
260 /* 3) An ellipsoid shape model for the target body is */
261 /* sufficient. */
262
263 /* 4) The boundary field of view vector returned from GETFOV */
264 /* is associated with a boundary field of view pixel. If */
265 /* this example were extended to include a geometric camera */
266 /* model, this assumption would not be needed since the */
267 /* direction vectors associated with each pixel would be */
268 /* calculated from the geometric camera model. */
269
270 /* Use the meta-kernel shown below to load the required SPICE */
271 /* kernels. */
272
273 /* KPL/MK */
274
275 /* File name: mgs_ex.tm */
276
277 /* This is the meta-kernel file for the example problem for */
278 /* the subroutine PXFRM2. These kernel files can be found in */
279 /* the NAIF archives. */
280
281 /* In order for an application to use this meta-kernel, the */
282 /* kernels referenced here must be present in the user's */
283 /* current working directory. */
284
285 /* The names and contents of the kernels referenced */
286 /* by this meta-kernel are as follows: */
287
288 /* File name Contents */
289 /* --------- -------- */
290 /* de421.bsp Planetary ephemeris */
291 /* pck00009.tpc Planet orientation and */
292 /* radii */
293 /* naif0009.tls Leapseconds */
294 /* mgs_ext12_ipng_mgs95j.bsp MGS ephemeris */
295 /* mgs_moc_v20.ti MGS MOC instrument */
296 /* parameters */
297 /* mgs_sclkscet_00061.tsc MGS SCLK coefficients */
298 /* mgs_sc_ext12.bc MGS s/c bus attitude */
299
300 /* \begindata */
301
302 /* KERNELS_TO_LOAD = ( 'de421.bsp', */
303 /* 'pck00009.tpc', */
304 /* 'naif0009.tls', */
305 /* 'mgs_ext12_ipng_mgs95j.bsp', */
306 /* 'mgs_moc_v20.ti', */
307 /* 'mgs_sclkscet_00061.tsc', */
308 /* 'mgs_sc_ext12.bc' ) */
309
310 /* \begintext */
311
312 /* End of meta-kernel. */
313
314
315 /* Example code begins here. */
316
317 /* PROGRAM EX_PXFRM2 */
318 /* IMPLICIT NONE */
319 /* C */
320 /* C SPICELIB functions */
321 /* C */
322 /* C Degrees per radian */
323 /* C */
324 /* DOUBLE PRECISION DPR */
325 /* C */
326 /* C Distance between two vectors */
327 /* C */
328 /* DOUBLE PRECISION VDIST */
329 /* C */
330 /* C Local parameters */
331 /* C */
332 /* C ABCORR is the desired light time and stellar */
333 /* C aberration correction setting. */
334 /* C */
335 /* CHARACTER*(*) ABCORR */
336 /* PARAMETER ( ABCORR = 'CN+S' ) */
337 /* C */
338 /* C MGS_MOC_NA is the name of the camera that took */
339 /* C the picture being analyzed. */
340 /* C */
341 /* CHARACTER*(*) CAMERA */
342 /* PARAMETER ( CAMERA = 'MGS_MOC_NA' ) */
343
344 /* CHARACTER*(*) METAKR */
345 /* PARAMETER ( METAKR = 'mgs_ex.tm' ) */
346
347 /* INTEGER FRNMLN */
348 /* PARAMETER ( FRNMLN = 32 ) */
349
350 /* INTEGER NCORNR */
351 /* PARAMETER ( NCORNR = 4 ) */
352
353 /* INTEGER SHPLEN */
354 /* PARAMETER ( SHPLEN = 80 ) */
355
356 /* C */
357 /* C Local variables */
358 /* C */
359 /* C OBSREF is the observer reference frame on MGS. */
360 /* C */
361 /* CHARACTER*(FRNMLN) OBSREF */
362 /* CHARACTER*(SHPLEN) SHAPE */
363
364 /* DOUBLE PRECISION BOUNDS ( 3, NCORNR ) */
365 /* DOUBLE PRECISION BNDVEC ( 3 ) */
366 /* DOUBLE PRECISION BSIGHT ( 3 ) */
367 /* C */
368 /* C ETEMIT is the time at which the photons were */
369 /* C emitted from Mars. ETREC is the time at */
370 /* C which the picture was taken by MGS. */
371 /* C */
372 /* DOUBLE PRECISION ETREC */
373 /* DOUBLE PRECISION ETEMIT */
374 /* DOUBLE PRECISION DIST */
375 /* C */
376 /* C LAT and LON are the latitude and longitude */
377 /* C associated with one of the boundary FOV vectors. */
378 /* C */
379 /* DOUBLE PRECISION LAT */
380 /* DOUBLE PRECISION LON */
381 /* C */
382 /* C PMGSMR is the opposite of the apparent position of */
383 /* C Mars with respect to MGS. */
384 /* C */
385 /* DOUBLE PRECISION PMGSMR ( 3 ) */
386 /* C */
387 /* C RADII is a vector of the semi-axes of Mars. */
388 /* C */
389 /* DOUBLE PRECISION RADII ( 3 ) */
390 /* DOUBLE PRECISION RADIUS */
391 /* C */
392 /* C ROTATE is a position transformation matrix from */
393 /* C the camera frame at ETREC to the IAU_MARS frame */
394 /* C at ETEMIT. */
395 /* C */
396 /* DOUBLE PRECISION ROTATE ( 3, 3 ) */
397 /* DOUBLE PRECISION SPOINT ( 3 ) */
398 /* DOUBLE PRECISION SRFVEC ( 3 ) */
399 /* DOUBLE PRECISION TMP ( 3 ) */
400
401 /* INTEGER CAMID */
402 /* INTEGER DIM */
403 /* INTEGER N */
404
405 /* LOGICAL FOUND */
406 /* C */
407 /* C ------------------ Program Setup ------------------ */
408 /* C */
409 /* C Load kernel files via the meta-kernel. */
410 /* C */
411 /* CALL FURNSH ( METAKR ) */
412 /* C */
413 /* C Convert the time the picture was taken from a */
414 /* C UTC time string to seconds past J2000, TDB. */
415 /* C */
416 /* CALL STR2ET ( '2003 OCT 13 06:00:00 UTC', ETREC ) */
417 /* C */
418 /* C Assume the one-way light times from different */
419 /* C surface points on Mars to MGS within the camera's */
420 /* C FOV are equal. This means the photons that make */
421 /* C up different pixels were all emitted from Mars at */
422 /* C ETEMIT and received by the MGS MOC camera at ETREC. It */
423 /* C would be slow to process images using SINCPT for every */
424 /* C pixel. Instead, we will use SINCPT on the */
425 /* C boresight pixel and use SURFPT for one of the FOV */
426 /* C boundary pixels. If this example program were extended */
427 /* C to include all of the camera's pixels, SURFPT would */
428 /* C be used for the remaining pixels. */
429 /* C */
430 /* C Get the MGS MOC Narrow angle camera (MGS_MOC_NA) */
431 /* C ID code. Then look up the field of view (FOV) */
432 /* C parameters by calling GETFOV. */
433 /* C */
434 /* CALL BODN2C ( CAMERA, CAMID, FOUND ) */
435
436 /* IF ( .NOT. FOUND ) THEN */
437
438 /* CALL SETMSG ( 'Could not find ID code for ' // */
439 /* . 'instrument #.' ) */
440 /* CALL ERRCH ( '#', CAMERA ) */
441 /* CALL SIGERR ( 'SPICE(NOTRANSLATION)' ) */
442
443 /* END IF */
444 /* C */
445 /* C GETFOV will return the name of the camera-fixed frame */
446 /* C in the string OBSREF, the camera boresight vector in */
447 /* C the array BSIGHT, and the FOV corner vectors in the */
448 /* C array BOUNDS. */
449 /* C */
450 /* CALL GETFOV ( CAMID, NCORNR, SHAPE, OBSREF, */
451 /* . BSIGHT, N, BOUNDS ) */
452
453 /* WRITE (*,*) 'Observation Reference frame: ', OBSREF */
454
455 /* C */
456 /* C ----------- Boresight Surface Intercept ----------- */
457 /* C */
458 /* C Retrieve the time, surface intercept point, and vector */
459 /* C from MGS to the boresight surface intercept point */
460 /* C in IAU_MARS coordinates. */
461 /* C */
462 /* CALL SINCPT ( 'ELLIPSOID', 'MARS', ETREC, 'IAU_MARS', */
463 /* . ABCORR, 'MGS', OBSREF, BSIGHT, */
464 /* . SPOINT, ETEMIT, SRFVEC, FOUND ) */
465
466 /* IF ( .NOT. FOUND ) THEN */
467
468 /* CALL SETMSG ( 'Intercept not found for the ' // */
469 /* . 'boresight vector.' ) */
470 /* CALL SIGERR ( 'SPICE(NOINTERCEPT)' ) */
471
472 /* END IF */
473 /* C */
474 /* C Convert the intersection point of the boresight */
475 /* C vector and Mars from rectangular into latitudinal */
476 /* C coordinates. Convert radians to degrees. */
477 /* C */
478 /* CALL RECLAT ( SPOINT, RADIUS, LON, LAT ) */
479
480 /* LON = LON * DPR () */
481 /* LAT = LAT * DPR () */
482
483 /* WRITE (*,*) 'Boresight surface intercept ' // */
484 /* . 'coordinates:' */
485 /* WRITE (*,*) ' Radius (km) : ', RADIUS */
486 /* WRITE (*,*) ' Latitude (deg): ', LAT */
487 /* WRITE (*,*) ' Longitude (deg): ', LON */
488
489 /* C */
490 /* C --------- A Boundary FOV Surface Intercept (SURFPT) ------ */
491 /* C */
492 /* C Now we will transform one of the FOV corner vectors into the */
493 /* C IAU_MARS frame so the surface intercept point can be */
494 /* C calculated using SURFPT, which is faster than SUBPNT. */
495 /* C */
496 /* C If this example program were extended to include all */
497 /* C of the pixels in the camera's FOV, a few steps, such as */
498 /* C finding the rotation matrix from the camera frame to the */
499 /* C IAU_MARS frame, looking up the radii values for Mars, */
500 /* C and finding the position of MGS with respect to Mars could */
501 /* C be done once and used for every pixel. */
502 /* C */
503 /* C Find the rotation matrix from the ray's reference */
504 /* C frame at the time the photons were received (ETREC) */
505 /* C to IAU_MARS at the time the photons were emitted */
506 /* C (ETEMIT). */
507 /* C */
508 /* CALL PXFRM2 ( OBSREF, 'IAU_MARS', ETREC, ETEMIT, ROTATE ) */
509
510 /* C */
511 /* C Look up the radii values for Mars. */
512 /* C */
513 /* CALL BODVRD ( 'MARS', 'RADII', 3, DIM, RADII ) */
514
515 /* C */
516 /* C Find the position of the center of Mars with respect */
517 /* C to MGS. The position of the observer with respect */
518 /* C to Mars is required for the call to SURFPT. Note: */
519 /* C the apparent position of MGS with respect to Mars is */
520 /* C not the same as the negative of Mars with respect to MGS. */
521 /* C */
522 /* CALL VSUB ( SPOINT, SRFVEC, PMGSMR ) */
523
524 /* C */
525 /* C The selected boundary FOV pixel must be rotated into the */
526 /* C IAU_MARS reference frame. */
527 /* C */
528 /* CALL MXV ( ROTATE, BOUNDS(1,1), BNDVEC ) */
529
530 /* C */
531 /* C Calculate the surface point of the boundary FOV */
532 /* C vector. */
533 /* C */
534 /* CALL SURFPT ( PMGSMR, BNDVEC, RADII(1), RADII(2), */
535 /* . RADII(3), SPOINT, FOUND ) */
536
537 /* IF ( .NOT. FOUND ) THEN */
538
539 /* CALL SETMSG ( 'Could not calculate surface point.') */
540 /* CALL SIGERR ( 'SPICE(NOTFOUND)' ) */
541
542 /* END IF */
543
544 /* CALL VEQU ( SPOINT, TMP ) */
545 /* C */
546 /* C Convert the intersection point of the boundary */
547 /* C FOV vector and Mars from rectangular into */
548 /* C latitudinal coordinates. Convert radians */
549 /* C to degrees. */
550 /* C */
551 /* CALL RECLAT ( SPOINT, RADIUS, LON, LAT ) */
552
553 /* LON = LON * DPR () */
554 /* LAT = LAT * DPR () */
555
556 /* WRITE (*,*) 'Boundary vector surface intercept ' // */
557 /* . 'coordinates using SURFPT:' */
558 /* WRITE (*,*) ' Radius (km) : ', RADIUS */
559 /* WRITE (*,*) ' Latitude (deg): ', LAT */
560 /* WRITE (*,*) ' Longitude (deg): ', LON */
561 /* WRITE (*,*) ' Emit time using' */
562 /* WRITE (*,*) ' boresight LT(s): ', ETEMIT */
563
564 /* C */
565 /* C ------ A Boundary FOV Surface Intercept Verification ---- */
566 /* C */
567 /* C For verification only, we will calculate the surface */
568 /* C intercept coordinates for the selected boundary vector */
569 /* C using SINCPT and compare to the faster SURFPT method. */
570 /* C */
571 /* CALL SINCPT ( 'ELLIPSOID', 'MARS', ETREC, 'IAU_MARS', */
572 /* . ABCORR, 'MGS', OBSREF, BOUNDS(1,1), */
573 /* . SPOINT, ETEMIT, SRFVEC, FOUND ) */
574
575 /* IF ( .NOT. FOUND ) THEN */
576
577 /* CALL SETMSG ( 'Intercept not found for the ' // */
578 /* . 'boresight vector.' ) */
579 /* CALL SIGERR ( 'SPICE(NOINTERCEPT)' ) */
580
581 /* END IF */
582 /* C */
583 /* C Convert the intersection point of the selected boundary */
584 /* C vector and Mars from rectangular into latitudinal */
585 /* C coordinates. Convert radians to degrees. */
586 /* C */
587 /* CALL RECLAT ( SPOINT, RADIUS, LON, LAT ) */
588
589 /* LON = LON * DPR () */
590 /* LAT = LAT * DPR () */
591
592 /* WRITE (*,*) 'Boundary vector surface intercept ' // */
593 /* . 'coordinates using SINCPT:' */
594 /* WRITE (*,*) ' Radius (km) : ', RADIUS */
595 /* WRITE (*,*) ' Latitude (deg): ', LAT */
596 /* WRITE (*,*) ' Longitude (deg): ', LON */
597 /* WRITE (*,*) ' Emit time using' */
598 /* WRITE (*,*) ' boundary LT(s) : ', ETEMIT */
599
600 /* C */
601 /* C We expect this to be a very small distance. */
602 /* C */
603 /* DIST = VDIST ( TMP, SPOINT ) */
604
605 /* WRITE (*,*) 'Distance between surface points' */
606 /* WRITE (*,*) 'of the selected boundary vector using' */
607 /* WRITE (*,*) 'SURFPT and SINCPT:' */
608 /* WRITE (*,*) ' Distance (mm): ', DIST*(10**6) */
609
610 /* END */
611
612 /* When this program was executed using gfortran on a PC Linux */
613 /* 64 bit environment, the output was: */
614
615 /* Observation Reference frame: MGS_MOC_NA */
616 /* Boresight surface intercept coordinates: */
617 /* Radius (km) : 3384.9404101592791 */
618 /* Latitude (deg): -48.479579821639035 */
619 /* Longitude (deg): -123.43645396290199 */
620 /* Boundary vector surface intercept coordinates using SURFPT: */
621 /* Radius (km) : 3384.9411359300038 */
622 /* Latitude (deg): -48.477481877892437 */
623 /* Longitude (deg): -123.47407986665237 */
624 /* Emit time using */
625 /* boresight LT(s): 119296864.18105948 */
626 /* Boundary vector surface intercept coordinates using SINCPT: */
627 /* Radius (km) : 3384.9411359139663 */
628 /* Latitude (deg): -48.477481924252693 */
629 /* Longitude (deg): -123.47407904898704 */
630 /* Emit time using */
631 /* boundary LT(s) : 119296864.18105946 */
632 /* Distance between surface points */
633 /* of the selected boundary vector using */
634 /* SURFPT and SINCPT: */
635 /* Distance (mm): 32.139879867352690 */
636
637
638 /* $ Restrictions */
639
640 /* None. */
641
642 /* $ Literature_References */
643
644 /* None. */
645
646 /* $ Author_and_Institution */
647
648 /* S.C. Krening (JPL) */
649 /* B.V. Semenov (JPL) */
650 /* W.L. Taber (JPL) */
651
652 /* $ Version */
653
654 /* - SPICELIB Version 1.0.0, 23-SEP-2013 (SCK) (WLT) (BVS) */
655
656 /* -& */
657 /* $ Index_Entries */
658
659 /* Position transformation matrix for different epochs */
660
661 /* -& */
662 /* $ Revisions */
663
664 /* None. */
665
666 /* -& */
667
668 /* SPICELIB functions */
669
670
671 /* Local parameters */
672
673 /* JCODE represents the NAIF ID of the J2000 reference frame. */
674 /* The J2000 frame has a NAIF ID of 1. Any inertial reference */
675 /* frame could have been used for this program instead of J2000. */
676
677
678 /* Saved frame name length. */
679
680
681 /* Local variables */
682
683
684 /* Saved frame name/ID item declarations. */
685
686
687 /* Saved frame name/ID items. */
688
689
690 /* Initial values. */
691
692
693 /* Standard SPICE error handling. */
694
695 if (return_()) {
696 return 0;
697 }
698 chkin_("PXFRM2", (ftnlen)6);
699
700 /* Initialization. */
701
702 if (first) {
703
704 /* Initialize counters. */
705
706 zzctruin_(svctr1);
707 zzctruin_(svctr2);
708 first = FALSE_;
709 }
710
711 /* The frame names must be converted to their corresponding IDs. */
712
713 zznamfrm_(svctr1, svfrom, &svfcod, from, &fcode, (ftnlen)32, from_len);
714 zznamfrm_(svctr2, svto, &svtcde, to, &tcode, (ftnlen)32, to_len);
715
716 /* Only non-zero ID codes are legitimate frame ID codes. Zero */
717 /* indicates that the frame was not recognized. */
718
719 if (fcode != 0 && tcode != 0) {
720
721 /* The following three lines of code calculate the following: */
722
723 /* 1) [JF] The rotation matrix is calculated from the frame */
724 /* FROM to the inertial J2000 frame at ETFROM. */
725 /* 2) [TJ] The rotation matrix is calculated from the J2000 */
726 /* frame to the TO frame at ETTO. */
727 /* 3) [ROTATE] The rotation matrix from frame FROM at ETFROM to */
728 /* frame TO at ETTO is given by the following: */
729
730 /* [ROTATE] = [TF] = [TJ][JF] */
731
732 refchg_(&fcode, &c__1, etfrom, jf);
733 refchg_(&c__1, &tcode, etto, tj);
734 mxm_(tj, jf, rotate);
735 } else if (fcode == 0 && tcode == 0) {
736 setmsg_("Neither frame # nor # was recognized as a known reference f"
737 "rame. ", (ftnlen)65);
738 errch_("#", from, (ftnlen)1, from_len);
739 errch_("#", to, (ftnlen)1, to_len);
740 sigerr_("SPICE(UNKNOWNFRAME)", (ftnlen)19);
741 } else if (fcode == 0) {
742 setmsg_("The frame # was not recognized as a known reference frame. ",
743 (ftnlen)59);
744 errch_("#", from, (ftnlen)1, from_len);
745 sigerr_("SPICE(UNKNOWNFRAME)", (ftnlen)19);
746 } else {
747
748 /* TCODE is zero */
749
750 setmsg_("The frame # was not recognized as a known reference frame. ",
751 (ftnlen)59);
752 errch_("#", to, (ftnlen)1, to_len);
753 sigerr_("SPICE(UNKNOWNFRAME)", (ftnlen)19);
754 }
755 chkout_("PXFRM2", (ftnlen)6);
756 return 0;
757 } /* pxfrm2_ */
758
759