| 1 | #include "erfa.h" | 
|---|
| 2 |  | 
|---|
| 3 | void eraC2tpe(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 | **   e r a 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 | **  Given: | 
|---|
| 15 | **     tta,ttb    double        TT as a 2-part Julian Date (Note 1) | 
|---|
| 16 | **     uta,utb    double        UT1 as a 2-part Julian Date (Note 1) | 
|---|
| 17 | **     dpsi,deps  double        nutation (Note 2) | 
|---|
| 18 | **     xp,yp      double        coordinates of the pole (radians, Note 3) | 
|---|
| 19 | ** | 
|---|
| 20 | **  Returned: | 
|---|
| 21 | **     rc2t       double[3][3]  celestial-to-terrestrial matrix (Note 4) | 
|---|
| 22 | ** | 
|---|
| 23 | **  Notes: | 
|---|
| 24 | ** | 
|---|
| 25 | **  1) The TT and UT1 dates tta+ttb and uta+utb are Julian Dates, | 
|---|
| 26 | **     apportioned in any convenient way between the arguments uta and | 
|---|
| 27 | **     utb.  For example, JD(UT1)=2450123.7 could be expressed in any of | 
|---|
| 28 | **     these ways, among others: | 
|---|
| 29 | ** | 
|---|
| 30 | **             uta            utb | 
|---|
| 31 | ** | 
|---|
| 32 | **         2450123.7           0.0       (JD method) | 
|---|
| 33 | **         2451545.0       -1421.3       (J2000 method) | 
|---|
| 34 | **         2400000.5       50123.2       (MJD method) | 
|---|
| 35 | **         2450123.5           0.2       (date & time method) | 
|---|
| 36 | ** | 
|---|
| 37 | **     The JD method is the most natural and convenient to use in | 
|---|
| 38 | **     cases where the loss of several decimal digits of resolution is | 
|---|
| 39 | **     acceptable.  The J2000 and MJD methods are good compromises | 
|---|
| 40 | **     between resolution and convenience.  In the case of uta,utb, the | 
|---|
| 41 | **     date & time method is best matched to the Earth rotation angle | 
|---|
| 42 | **     algorithm used:  maximum precision is delivered when the uta | 
|---|
| 43 | **     argument is for 0hrs UT1 on the day in question and the utb | 
|---|
| 44 | **     argument lies in the range 0 to 1, or vice versa. | 
|---|
| 45 | ** | 
|---|
| 46 | **  2) The caller is responsible for providing the nutation components; | 
|---|
| 47 | **     they are in longitude and obliquity, in radians and are with | 
|---|
| 48 | **     respect to the equinox and ecliptic of date.  For high-accuracy | 
|---|
| 49 | **     applications, free core nutation should be included as well as | 
|---|
| 50 | **     any other relevant corrections to the position of the CIP. | 
|---|
| 51 | ** | 
|---|
| 52 | **  3) The arguments xp and yp are the coordinates (in radians) of the | 
|---|
| 53 | **     Celestial Intermediate Pole with respect to the International | 
|---|
| 54 | **     Terrestrial Reference System (see IERS Conventions 2003), | 
|---|
| 55 | **     measured along the meridians to 0 and 90 deg west respectively. | 
|---|
| 56 | ** | 
|---|
| 57 | **  4) The matrix rc2t transforms from celestial to terrestrial | 
|---|
| 58 | **     coordinates: | 
|---|
| 59 | ** | 
|---|
| 60 | **        [TRS] = RPOM * R_3(GST) * RBPN * [CRS] | 
|---|
| 61 | ** | 
|---|
| 62 | **              = rc2t * [CRS] | 
|---|
| 63 | ** | 
|---|
| 64 | **     where [CRS] is a vector in the Geocentric Celestial Reference | 
|---|
| 65 | **     System and [TRS] is a vector in the International Terrestrial | 
|---|
| 66 | **     Reference System (see IERS Conventions 2003), RBPN is the | 
|---|
| 67 | **     bias-precession-nutation matrix, GST is the Greenwich (apparent) | 
|---|
| 68 | **     Sidereal Time and RPOM is the polar motion matrix. | 
|---|
| 69 | ** | 
|---|
| 70 | **  5) Although its name does not include "00", This function is in fact | 
|---|
| 71 | **     specific to the IAU 2000 models. | 
|---|
| 72 | ** | 
|---|
| 73 | **  Called: | 
|---|
| 74 | **     eraPn00      bias/precession/nutation results, IAU 2000 | 
|---|
| 75 | **     eraGmst00    Greenwich mean sidereal time, IAU 2000 | 
|---|
| 76 | **     eraSp00      the TIO locator s', IERS 2000 | 
|---|
| 77 | **     eraEe00      equation of the equinoxes, IAU 2000 | 
|---|
| 78 | **     eraPom00     polar motion matrix | 
|---|
| 79 | **     eraC2teqx    form equinox-based celestial-to-terrestrial matrix | 
|---|
| 80 | ** | 
|---|
| 81 | **  Reference: | 
|---|
| 82 | ** | 
|---|
| 83 | **     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), | 
|---|
| 84 | **     IERS Technical Note No. 32, BKG (2004) | 
|---|
| 85 | ** | 
|---|
| 86 | **  Copyright (C) 2013-2017, NumFOCUS Foundation. | 
|---|
| 87 | **  Derived, with permission, from the SOFA library.  See notes at end of file. | 
|---|
| 88 | */ | 
|---|
| 89 | { | 
|---|
| 90 | double epsa, rb[3][3], rp[3][3], rbp[3][3], rn[3][3], | 
|---|
| 91 | rbpn[3][3], gmst, ee, sp, rpom[3][3]; | 
|---|
| 92 |  | 
|---|
| 93 |  | 
|---|
| 94 | /* Form the celestial-to-true matrix for this TT. */ | 
|---|
| 95 | eraPn00(tta, ttb, dpsi, deps, &epsa, rb, rp, rbp, rn, rbpn); | 
|---|
| 96 |  | 
|---|
| 97 | /* Predict the Greenwich Mean Sidereal Time for this UT1 and TT. */ | 
|---|
| 98 | gmst = eraGmst00(uta, utb, tta, ttb); | 
|---|
| 99 |  | 
|---|
| 100 | /* Predict the equation of the equinoxes given TT and nutation. */ | 
|---|
| 101 | ee = eraEe00(tta, ttb, epsa, dpsi); | 
|---|
| 102 |  | 
|---|
| 103 | /* Estimate s'. */ | 
|---|
| 104 | sp = eraSp00(tta, ttb); | 
|---|
| 105 |  | 
|---|
| 106 | /* Form the polar motion matrix. */ | 
|---|
| 107 | eraPom00(xp, yp, sp, rpom); | 
|---|
| 108 |  | 
|---|
| 109 | /* Combine to form the celestial-to-terrestrial matrix. */ | 
|---|
| 110 | eraC2teqx(rbpn, gmst + ee, rpom, rc2t); | 
|---|
| 111 |  | 
|---|
| 112 | return; | 
|---|
| 113 |  | 
|---|
| 114 | } | 
|---|
| 115 | /*---------------------------------------------------------------------- | 
|---|
| 116 | ** | 
|---|
| 117 | ** | 
|---|
| 118 | **  Copyright (C) 2013-2017, NumFOCUS Foundation. | 
|---|
| 119 | **  All rights reserved. | 
|---|
| 120 | ** | 
|---|
| 121 | **  This library is derived, with permission, from the International | 
|---|
| 122 | **  Astronomical Union's "Standards of Fundamental Astronomy" library, | 
|---|
| 123 | **  available from http://www.iausofa.org. | 
|---|
| 124 | ** | 
|---|
| 125 | **  The ERFA version is intended to retain identical functionality to | 
|---|
| 126 | **  the SOFA library, but made distinct through different function and | 
|---|
| 127 | **  file names, as set out in the SOFA license conditions.  The SOFA | 
|---|
| 128 | **  original has a role as a reference standard for the IAU and IERS, | 
|---|
| 129 | **  and consequently redistribution is permitted only in its unaltered | 
|---|
| 130 | **  state.  The ERFA version is not subject to this restriction and | 
|---|
| 131 | **  therefore can be included in distributions which do not support the | 
|---|
| 132 | **  concept of "read only" software. | 
|---|
| 133 | ** | 
|---|
| 134 | **  Although the intent is to replicate the SOFA API (other than | 
|---|
| 135 | **  replacement of prefix names) and results (with the exception of | 
|---|
| 136 | **  bugs;  any that are discovered will be fixed), SOFA is not | 
|---|
| 137 | **  responsible for any errors found in this version of the library. | 
|---|
| 138 | ** | 
|---|
| 139 | **  If you wish to acknowledge the SOFA heritage, please acknowledge | 
|---|
| 140 | **  that you are using a library derived from SOFA, rather than SOFA | 
|---|
| 141 | **  itself. | 
|---|
| 142 | ** | 
|---|
| 143 | ** | 
|---|
| 144 | **  TERMS AND CONDITIONS | 
|---|
| 145 | ** | 
|---|
| 146 | **  Redistribution and use in source and binary forms, with or without | 
|---|
| 147 | **  modification, are permitted provided that the following conditions | 
|---|
| 148 | **  are met: | 
|---|
| 149 | ** | 
|---|
| 150 | **  1 Redistributions of source code must retain the above copyright | 
|---|
| 151 | **    notice, this list of conditions and the following disclaimer. | 
|---|
| 152 | ** | 
|---|
| 153 | **  2 Redistributions in binary form must reproduce the above copyright | 
|---|
| 154 | **    notice, this list of conditions and the following disclaimer in | 
|---|
| 155 | **    the documentation and/or other materials provided with the | 
|---|
| 156 | **    distribution. | 
|---|
| 157 | ** | 
|---|
| 158 | **  3 Neither the name of the Standards Of Fundamental Astronomy Board, | 
|---|
| 159 | **    the International Astronomical Union nor the names of its | 
|---|
| 160 | **    contributors may be used to endorse or promote products derived | 
|---|
| 161 | **    from this software without specific prior written permission. | 
|---|
| 162 | ** | 
|---|
| 163 | **  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 
|---|
| 164 | **  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 
|---|
| 165 | **  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 
|---|
| 166 | **  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE | 
|---|
| 167 | **  COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | 
|---|
| 168 | **  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | 
|---|
| 169 | **  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 
|---|
| 170 | **  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | 
|---|
| 171 | **  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 
|---|
| 172 | **  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | 
|---|
| 173 | **  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 
|---|
| 174 | **  POSSIBILITY OF SUCH DAMAGE. | 
|---|
| 175 | ** | 
|---|
| 176 | */ | 
|---|