1 /*
2  *  - - - - - - - - - - -
3  *   g a l _ c 2 t e q x
4  *  - - - - - - - - - - -
5  *
6  *  This routine is part of the General Astrodynamics Library
7  *
8  *  Description:
9  *
10  *  Assemble the celestial to terrestrial matrix from equinox-based
11  *  components (the celestial-to-true matrix, the Greenwich Apparent
12  *  Sidereal Time and the polar motion matrix).
13  *
14  *  This routine is an independent translation of a FORTRAN routine
15  *  that is part of IAU's SOFA software collection.
16  *
17  *  Status:
18  *
19  *     support routine.
20  *
21  *  Given:
22  *
23  *     rbpn             d[3][3]     celestial-to-true matrix
24  *     gst                 d        Greenwich (apparent) Sidereal Time
25  *     rpom             d[3][3]     polar-motion matrix
26  *
27  *  Returned:
28  *
29  *     rc2t             d[3][3]     celestial-to-terrestrial matrix (Note 2)
30  *
31  *  Notes:
32  *
33  *  1) This routine constructs the rotation matrix that transforms
34  *     vectors in the celestial system into vectors in the terrestrial
35  *     system.  It does so starting from precomputed components, namely
36  *     the matrix which rotates from celestial coordinates to the
37  *     true equator and equinox of date, the Greenwich Apparent Sidereal
38  *     Time and the polar motion matrix.  One use of the present routine
39  *     is when generating a series of celestial-to-terrestrial matrices
40  *     where only the Sidereal Time changes, avoiding the considerable
41  *     overhead of recomputing the precession-nutation more often than
42  *     necessary to achieve given accuracy objectives.
43  *
44  *  2) The relationship between the arguments is as follows:
45  *
46  *        [TRS]  =  rpom * R_3(gst) * rbpn * [CRS]
47  *
48  *               =  rc2t * [CRS]
49  *
50  *     where [CRS] is a vector in the Geocentric Celestial Reference
51  *     System and [TRS] is a vector in the International Terrestrial
52  *     Reference System (see IERS Conventions 2003).
53  *
54  *  Called:
55  *
56  *     gal_cr             copy r-matrix
57  *     gal_rz             rotate around Z-axis
58  *     gal_rxr            product of two r-matrices
59  *
60  *  References:
61  *
62  *     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
63  *     IERS Technical Note No. 32, BKG (2004)
64  *
65  *  This revision:
66  *
67  *     2006 November 13 ( c version 2008 January 18 )
68  *
69  *
70  *  Copyright (C) 2008 Paul C. L. Willmott. See notes at end.
71  *
72  *-----------------------------------------------------------------------
73  */
74 
75 #include "gal_c2teqx.h"
76 #include "gal_cr.h"
77 #include "gal_rz.h"
78 #include "gal_rxr.h"
79 
80 void
gal_c2teqx(double rbpn[3][3],double gst,double rpom[3][3],double rc2t[3][3])81 gal_c2teqx
82  (
83     double rbpn[3][3],
84     double gst,
85     double rpom[3][3],
86     double rc2t[3][3]
87  )
88 {
89 
90     double r[3][3] ;
91 
92 /*
93  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
94  */
95 
96 /*
97  * Construct the matrix.
98  */
99 
100     gal_cr ( rbpn, r ) ;
101     gal_rz ( gst, r ) ;
102     gal_rxr ( rpom, r, rc2t ) ;
103 
104 /*
105  * Finished.
106  */
107 
108 }
109 
110 /*
111  *  gal - General Astrodynamics Library
112  *  Copyright (C) 2008 Paul C. L. Willmott
113  *
114  *  This program is free software; you can redistribute it and/or modify
115  *  it under the terms of the GNU General Public License as published by
116  *  the Free Software Foundation; either version 2 of the License, or
117  *  (at your option) any later version.
118  *
119  *  This program is distributed in the hope that it will be useful,
120  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
121  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
122  *  GNU General Public License for more details.
123  *
124  *  You should have received a copy of the GNU General Public License along
125  *  with this program; if not, write to the Free Software Foundation, Inc.,
126  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
127  *
128  *  Contact:
129  *
130  *  Paul Willmott
131  *  vp9mu@amsat.org
132  */
133