1 /* irftrn.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      IRFTRN ( Inertial reference frame transformation ) */
irftrn_(char * refa,char * refb,doublereal * rotab,ftnlen refa_len,ftnlen refb_len)9 /* Subroutine */ int irftrn_(char *refa, char *refb, doublereal *rotab,
10 	ftnlen refa_len, ftnlen refb_len)
11 {
12     integer codea, codeb;
13     extern /* Subroutine */ int chkin_(char *, ftnlen), chkout_(char *,
14 	    ftnlen), irfnum_(char *, integer *, ftnlen), irfrot_(integer *,
15 	    integer *, doublereal *);
16     extern logical return_(void);
17 
18 /* $ Abstract */
19 
20 /*     Return the matrix that transforms vectors from one specified */
21 /*     inertial reference frame to another. */
22 
23 /* $ Disclaimer */
24 
25 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
26 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
27 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
28 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
29 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
30 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
31 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
32 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
33 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
34 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
35 
36 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
37 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
38 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
39 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
40 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
41 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
42 
43 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
44 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
45 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
46 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
47 
48 /* $ Required_Reading */
49 
50 /*     SPK */
51 
52 /* $ Keywords */
53 
54 /*     CONVERSION */
55 /*     COORDINATES */
56 /*     FRAMES */
57 /*     MATRIX */
58 /*     ROTATION */
59 /*     TRANSFORMATION */
60 
61 /* $ Declarations */
62 /* $ Brief_I/O */
63 
64 /*     Variable  I/O  Description */
65 /*     --------  ---  -------------------------------------------------- */
66 /*     REFA       I   Name of reference frame to transform vectors FROM. */
67 /*     REFB       I   Name of reference frame to transform vectors TO. */
68 /*     ROTAB      O   REFA-to-REFB transformation matrix. */
69 
70 /* $ Detailed_Input */
71 
72 /*     REFA, */
73 /*     REFB           Names of two inertial reference frames.  Any names */
74 /*                    accepted by the routine IRFNUM may be used.  See */
75 /*                    $Particulars for a list of some of the more */
76 /*                    commonly used inertial reference frame names. */
77 
78 /* $ Detailed_Output */
79 
80 /*     ROTAB          is a rotation matrix that transforms the */
81 /*                    coordinates of a vector V relative to the */
82 /*                    reference frame specified by REFA to the */
83 /*                    coordinates of V relative to the reference frame */
84 /*                    specified by REFB.  The transformation is carried */
85 /*                    out by the matrix multiplication */
86 
87 /*                       V = ROTAB * V. */
88 /* $ Parameters */
89 
90 /*     None. */
91 
92 /* $ Exceptions */
93 
94 /*     1)  If either of the input reference frame names is invalid, the */
95 /*         error will be diagnosed by routines called by this routine. */
96 
97 /* $ Files */
98 
99 /*     None. */
100 
101 /* $ Particulars */
102 
103 /*     Normally applications should call the more general, higher level */
104 /*     routine PXFORM instead of this routine. */
105 
106 /*     This routine is a macro that replaces the code fragment */
107 
108 /*        CALL IRFNUM ( REFA,  CODEA        ) */
109 /*        CALL IRFNUM ( REFB,  CODEB        ) */
110 /*        CALL IRFROT ( CODEA, CODEB, ROTAB ) */
111 
112 
113 /*     Among the reference frame names accepted by IRFNUM are: */
114 
115 /*        'J2000' */
116 /*        'B1950' */
117 /*        'FK4' */
118 /*        'DE-96' */
119 /*        'DE-102' */
120 /*        'DE-108' */
121 /*        'DE-111' */
122 /*        'DE-114' */
123 /*        'DE-118' */
124 /*        'DE-122' */
125 /*        'DE-125' */
126 /*        'DE-130' */
127 /*        'DE-200' */
128 /*        'DE-202' */
129 /*        'GALACTIC' */
130 
131 /*     See the SPICELIB routine GHGIRF for details. */
132 
133 
134 /* $ Examples */
135 
136 /*     1)  Transform a vector V1950 from the B1950 to the J2000 */
137 /*         reference frame. */
138 
139 /*            C */
140 /*            C     Ask IRFTRN for the matrix that transforms vectors */
141 /*            C     from the B1950 to the J2000 reference frame. */
142 /*            C */
143 /*                  CALL IRFTRN ( 'B1950', 'J2000', TRANS ) */
144 
145 /*            C */
146 /*            C     Now transform V1950 to the J2000 reference frame. */
147 /*            C */
148 /*                  CALL MXV ( TRANS, V1950, V2000 ) */
149 
150 /* $ Restrictions */
151 
152 /*     None. */
153 
154 /* $ Literature_References */
155 
156 /*     None. */
157 
158 /* $ Author_and_Institution */
159 
160 /*     N.J. Bachman   (JPL) */
161 
162 /* $ Version */
163 
164 /* -    SPICELIB Version 1.0.2, 28-SEP-2004 (NJB) */
165 
166 /*        Corrected comment in code example in header.  Made other minor */
167 /*        updates to header. */
168 
169 /* -    SPICELIB Version 1.0.1, 10-MAR-1992 (WLT) */
170 
171 /*        Comment section for permuted index source lines was added */
172 /*        following the header. */
173 
174 /* -    SPICELIB Version 1.0.0, 30-AUG-1991 (NJB) */
175 
176 /* -& */
177 /* $ Index_Entries */
178 
179 /*     tranformation from one inertial frame to another */
180 
181 /* -& */
182 
183 /*     SPICELIB functions */
184 
185 
186 /*     Local variables */
187 
188 
189 /*     Standard SPICE error handling. */
190 
191     if (return_()) {
192 	return 0;
193     } else {
194 	chkin_("IRFTRN", (ftnlen)6);
195     }
196 
197 /*     Encode the reference frame names, and find the transformation */
198 /*     matrix. */
199 
200     irfnum_(refa, &codea, refa_len);
201     irfnum_(refb, &codeb, refb_len);
202     irfrot_(&codea, &codeb, rotab);
203     chkout_("IRFTRN", (ftnlen)6);
204     return 0;
205 } /* irftrn_ */
206 
207