1 #include "sofa.h"
2 
iauC2tpe(double tta,double ttb,double uta,double utb,double dpsi,double deps,double xp,double yp,double rc2t[3][3])3 void iauC2tpe(double tta, double ttb, double uta, double utb,
4               double dpsi, double deps, double xp, double yp,
5               double rc2t[3][3])
6 /*
7 **  - - - - - - - - -
8 **   i a u C 2 t p e
9 **  - - - - - - - - -
10 **
11 **  Form the celestial to terrestrial matrix given the date, the UT1,
12 **  the nutation and the polar motion.  IAU 2000.
13 **
14 **  This function is part of the International Astronomical Union's
15 **  SOFA (Standards Of Fundamental Astronomy) software collection.
16 **
17 **  Status:  support function.
18 **
19 **  Given:
20 **     tta,ttb    double        TT as a 2-part Julian Date (Note 1)
21 **     uta,utb    double        UT1 as a 2-part Julian Date (Note 1)
22 **     dpsi,deps  double        nutation (Note 2)
23 **     xp,yp      double        coordinates of the pole (radians, Note 3)
24 **
25 **  Returned:
26 **     rc2t       double[3][3]  celestial-to-terrestrial matrix (Note 4)
27 **
28 **  Notes:
29 **
30 **  1) The TT and UT1 dates tta+ttb and uta+utb are Julian Dates,
31 **     apportioned in any convenient way between the arguments uta and
32 **     utb.  For example, JD(UT1)=2450123.7 could be expressed in any of
33 **     these ways, among others:
34 **
35 **             uta            utb
36 **
37 **         2450123.7           0.0       (JD method)
38 **         2451545.0       -1421.3       (J2000 method)
39 **         2400000.5       50123.2       (MJD method)
40 **         2450123.5           0.2       (date & time method)
41 **
42 **     The JD method is the most natural and convenient to use in
43 **     cases where the loss of several decimal digits of resolution is
44 **     acceptable.  The J2000 and MJD methods are good compromises
45 **     between resolution and convenience.  In the case of uta,utb, the
46 **     date & time method is best matched to the Earth rotation angle
47 **     algorithm used:  maximum precision is delivered when the uta
48 **     argument is for 0hrs UT1 on the day in question and the utb
49 **     argument lies in the range 0 to 1, or vice versa.
50 **
51 **  2) The caller is responsible for providing the nutation components;
52 **     they are in longitude and obliquity, in radians and are with
53 **     respect to the equinox and ecliptic of date.  For high-accuracy
54 **     applications, free core nutation should be included as well as
55 **     any other relevant corrections to the position of the CIP.
56 **
57 **  3) The arguments xp and yp are the coordinates (in radians) of the
58 **     Celestial Intermediate Pole with respect to the International
59 **     Terrestrial Reference System (see IERS Conventions 2003),
60 **     measured along the meridians 0 and 90 deg west respectively.
61 **
62 **  4) The matrix rc2t transforms from celestial to terrestrial
63 **     coordinates:
64 **
65 **        [TRS] = RPOM * R_3(GST) * RBPN * [CRS]
66 **
67 **              = rc2t * [CRS]
68 **
69 **     where [CRS] is a vector in the Geocentric Celestial Reference
70 **     System and [TRS] is a vector in the International Terrestrial
71 **     Reference System (see IERS Conventions 2003), RBPN is the
72 **     bias-precession-nutation matrix, GST is the Greenwich (apparent)
73 **     Sidereal Time and RPOM is the polar motion matrix.
74 **
75 **  5) Although its name does not include "00", This function is in fact
76 **     specific to the IAU 2000 models.
77 **
78 **  Called:
79 **     iauPn00      bias/precession/nutation results, IAU 2000
80 **     iauGmst00    Greenwich mean sidereal time, IAU 2000
81 **     iauSp00      the TIO locator s', IERS 2000
82 **     iauEe00      equation of the equinoxes, IAU 2000
83 **     iauPom00     polar motion matrix
84 **     iauC2teqx    form equinox-based celestial-to-terrestrial matrix
85 **
86 **  Reference:
87 **
88 **     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
89 **     IERS Technical Note No. 32, BKG (2004)
90 **
91 **  This revision:  2021 May 11
92 **
93 **  SOFA release 2021-05-12
94 **
95 **  Copyright (C) 2021 IAU SOFA Board.  See notes at end.
96 */
97 {
98    double epsa, rb[3][3], rp[3][3], rbp[3][3], rn[3][3],
99           rbpn[3][3], gmst, ee, sp, rpom[3][3];
100 
101 
102 /* Form the celestial-to-true matrix for this TT. */
103    iauPn00(tta, ttb, dpsi, deps, &epsa, rb, rp, rbp, rn, rbpn);
104 
105 /* Predict the Greenwich Mean Sidereal Time for this UT1 and TT. */
106    gmst = iauGmst00(uta, utb, tta, ttb);
107 
108 /* Predict the equation of the equinoxes given TT and nutation. */
109    ee = iauEe00(tta, ttb, epsa, dpsi);
110 
111 /* Estimate s'. */
112    sp = iauSp00(tta, ttb);
113 
114 /* Form the polar motion matrix. */
115    iauPom00(xp, yp, sp, rpom);
116 
117 /* Combine to form the celestial-to-terrestrial matrix. */
118    iauC2teqx(rbpn, gmst + ee, rpom, rc2t);
119 
120 /* Finished. */
121 
122 /*----------------------------------------------------------------------
123 **
124 **  Copyright (C) 2021
125 **  Standards Of Fundamental Astronomy Board
126 **  of the International Astronomical Union.
127 **
128 **  =====================
129 **  SOFA Software License
130 **  =====================
131 **
132 **  NOTICE TO USER:
133 **
134 **  BY USING THIS SOFTWARE YOU ACCEPT THE FOLLOWING SIX TERMS AND
135 **  CONDITIONS WHICH APPLY TO ITS USE.
136 **
137 **  1. The Software is owned by the IAU SOFA Board ("SOFA").
138 **
139 **  2. Permission is granted to anyone to use the SOFA software for any
140 **     purpose, including commercial applications, free of charge and
141 **     without payment of royalties, subject to the conditions and
142 **     restrictions listed below.
143 **
144 **  3. You (the user) may copy and distribute SOFA source code to others,
145 **     and use and adapt its code and algorithms in your own software,
146 **     on a world-wide, royalty-free basis.  That portion of your
147 **     distribution that does not consist of intact and unchanged copies
148 **     of SOFA source code files is a "derived work" that must comply
149 **     with the following requirements:
150 **
151 **     a) Your work shall be marked or carry a statement that it
152 **        (i) uses routines and computations derived by you from
153 **        software provided by SOFA under license to you; and
154 **        (ii) does not itself constitute software provided by and/or
155 **        endorsed by SOFA.
156 **
157 **     b) The source code of your derived work must contain descriptions
158 **        of how the derived work is based upon, contains and/or differs
159 **        from the original SOFA software.
160 **
161 **     c) The names of all routines in your derived work shall not
162 **        include the prefix "iau" or "sofa" or trivial modifications
163 **        thereof such as changes of case.
164 **
165 **     d) The origin of the SOFA components of your derived work must
166 **        not be misrepresented;  you must not claim that you wrote the
167 **        original software, nor file a patent application for SOFA
168 **        software or algorithms embedded in the SOFA software.
169 **
170 **     e) These requirements must be reproduced intact in any source
171 **        distribution and shall apply to anyone to whom you have
172 **        granted a further right to modify the source code of your
173 **        derived work.
174 **
175 **     Note that, as originally distributed, the SOFA software is
176 **     intended to be a definitive implementation of the IAU standards,
177 **     and consequently third-party modifications are discouraged.  All
178 **     variations, no matter how minor, must be explicitly marked as
179 **     such, as explained above.
180 **
181 **  4. You shall not cause the SOFA software to be brought into
182 **     disrepute, either by misuse, or use for inappropriate tasks, or
183 **     by inappropriate modification.
184 **
185 **  5. The SOFA software is provided "as is" and SOFA makes no warranty
186 **     as to its use or performance.   SOFA does not and cannot warrant
187 **     the performance or results which the user may obtain by using the
188 **     SOFA software.  SOFA makes no warranties, express or implied, as
189 **     to non-infringement of third party rights, merchantability, or
190 **     fitness for any particular purpose.  In no event will SOFA be
191 **     liable to the user for any consequential, incidental, or special
192 **     damages, including any lost profits or lost savings, even if a
193 **     SOFA representative has been advised of such damages, or for any
194 **     claim by any third party.
195 **
196 **  6. The provision of any version of the SOFA software under the terms
197 **     and conditions specified herein does not imply that future
198 **     versions will also be made available under the same terms and
199 **     conditions.
200 *
201 **  In any published work or commercial product which uses the SOFA
202 **  software directly, acknowledgement (see www.iausofa.org) is
203 **  appreciated.
204 **
205 **  Correspondence concerning SOFA software should be addressed as
206 **  follows:
207 **
208 **      By email:  sofa@ukho.gov.uk
209 **      By post:   IAU SOFA Center
210 **                 HM Nautical Almanac Office
211 **                 UK Hydrographic Office
212 **                 Admiralty Way, Taunton
213 **                 Somerset, TA1 2DN
214 **                 United Kingdom
215 **
216 **--------------------------------------------------------------------*/
217 }
218