| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | #include "erfa.h" | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 0 |  |  |  |  |  | void eraLtpequ(double epj, double veq[3]) | 
| 4 |  |  |  |  |  |  | /* | 
| 5 |  |  |  |  |  |  | **  - - - - - - - - - - | 
| 6 |  |  |  |  |  |  | **   e r a L t p e q u | 
| 7 |  |  |  |  |  |  | **  - - - - - - - - - - | 
| 8 |  |  |  |  |  |  | ** | 
| 9 |  |  |  |  |  |  | **  Long-term precession of the equator. | 
| 10 |  |  |  |  |  |  | ** | 
| 11 |  |  |  |  |  |  | **  Given: | 
| 12 |  |  |  |  |  |  | **     epj     double         Julian epoch (TT) | 
| 13 |  |  |  |  |  |  | ** | 
| 14 |  |  |  |  |  |  | **  Returned: | 
| 15 |  |  |  |  |  |  | **     veq     double[3]      equator pole unit vector | 
| 16 |  |  |  |  |  |  | ** | 
| 17 |  |  |  |  |  |  | **  Notes: | 
| 18 |  |  |  |  |  |  | ** | 
| 19 |  |  |  |  |  |  | **  1) The returned vector is with respect to the J2000.0 mean equator | 
| 20 |  |  |  |  |  |  | **     and equinox. | 
| 21 |  |  |  |  |  |  | ** | 
| 22 |  |  |  |  |  |  | **  2) The Vondrak et al. (2011, 2012) 400 millennia precession model | 
| 23 |  |  |  |  |  |  | **     agrees with the IAU 2006 precession at J2000.0 and stays within | 
| 24 |  |  |  |  |  |  | **     100 microarcseconds during the 20th and 21st centuries.  It is | 
| 25 |  |  |  |  |  |  | **     accurate to a few arcseconds throughout the historical period, | 
| 26 |  |  |  |  |  |  | **     worsening to a few tenths of a degree at the end of the | 
| 27 |  |  |  |  |  |  | **     +/- 200,000 year time span. | 
| 28 |  |  |  |  |  |  | ** | 
| 29 |  |  |  |  |  |  | **  References: | 
| 30 |  |  |  |  |  |  | ** | 
| 31 |  |  |  |  |  |  | **    Vondrak, J., Capitaine, N. and Wallace, P., 2011, New precession | 
| 32 |  |  |  |  |  |  | **    expressions, valid for long time intervals, Astron.Astrophys. 534, | 
| 33 |  |  |  |  |  |  | **    A22 | 
| 34 |  |  |  |  |  |  | ** | 
| 35 |  |  |  |  |  |  | **    Vondrak, J., Capitaine, N. and Wallace, P., 2012, New precession | 
| 36 |  |  |  |  |  |  | **    expressions, valid for long time intervals (Corrigendum), | 
| 37 |  |  |  |  |  |  | **    Astron.Astrophys. 541, C1 | 
| 38 |  |  |  |  |  |  | ** | 
| 39 |  |  |  |  |  |  | **  Copyright (C) 2013-2019, NumFOCUS Foundation. | 
| 40 |  |  |  |  |  |  | **  Derived, with permission, from the SOFA library.  See notes at end of file. | 
| 41 |  |  |  |  |  |  | */ | 
| 42 |  |  |  |  |  |  | { | 
| 43 |  |  |  |  |  |  | /* Polynomial coefficients */ | 
| 44 |  |  |  |  |  |  | enum { NPOL = 4 }; | 
| 45 |  |  |  |  |  |  | static const double xypol[2][NPOL] = { | 
| 46 |  |  |  |  |  |  | {  5453.282155, | 
| 47 |  |  |  |  |  |  | 0.4252841, | 
| 48 |  |  |  |  |  |  | -0.00037173, | 
| 49 |  |  |  |  |  |  | -0.000000152}, | 
| 50 |  |  |  |  |  |  | {-73750.930350, | 
| 51 |  |  |  |  |  |  | -0.7675452, | 
| 52 |  |  |  |  |  |  | -0.00018725, | 
| 53 |  |  |  |  |  |  | 0.000000231} | 
| 54 |  |  |  |  |  |  | }; | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | /* Periodic coefficients */ | 
| 57 |  |  |  |  |  |  | static const double xyper[][5] = { | 
| 58 |  |  |  |  |  |  | { 256.75, -819.940624,75004.344875,81491.287984, 1558.515853}, | 
| 59 |  |  |  |  |  |  | { 708.15,-8444.676815,  624.033993,  787.163481, 7774.939698}, | 
| 60 |  |  |  |  |  |  | { 274.20, 2600.009459, 1251.136893, 1251.296102,-2219.534038}, | 
| 61 |  |  |  |  |  |  | { 241.45, 2755.175630,-1102.212834,-1257.950837,-2523.969396}, | 
| 62 |  |  |  |  |  |  | {2309.00, -167.659835,-2660.664980,-2966.799730,  247.850422}, | 
| 63 |  |  |  |  |  |  | { 492.20,  871.855056,  699.291817,  639.744522, -846.485643}, | 
| 64 |  |  |  |  |  |  | { 396.10,   44.769698,  153.167220,  131.600209,-1393.124055}, | 
| 65 |  |  |  |  |  |  | { 288.90, -512.313065, -950.865637, -445.040117,  368.526116}, | 
| 66 |  |  |  |  |  |  | { 231.10, -819.415595,  499.754645,  584.522874,  749.045012}, | 
| 67 |  |  |  |  |  |  | {1610.00, -538.071099, -145.188210,  -89.756563,  444.704518}, | 
| 68 |  |  |  |  |  |  | { 620.00, -189.793622,  558.116553,  524.429630,  235.934465}, | 
| 69 |  |  |  |  |  |  | { 157.87, -402.922932,  -23.923029,  -13.549067,  374.049623}, | 
| 70 |  |  |  |  |  |  | { 220.30,  179.516345, -165.405086, -210.157124, -171.330180}, | 
| 71 |  |  |  |  |  |  | {1200.00,   -9.814756,    9.344131,  -44.919798,  -22.899655} | 
| 72 |  |  |  |  |  |  | }; | 
| 73 |  |  |  |  |  |  | static const int NPER = (int) ( sizeof xyper / 5 / sizeof (double) ); | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | /* Miscellaneous */ | 
| 76 |  |  |  |  |  |  | int i; | 
| 77 |  |  |  |  |  |  | double t, x, y, w, a, s, c; | 
| 78 |  |  |  |  |  |  |  | 
| 79 |  |  |  |  |  |  |  | 
| 80 |  |  |  |  |  |  | /* Centuries since J2000. */ | 
| 81 | 0 |  |  |  |  |  | t  = ( epj - 2000.0 ) / 100.0; | 
| 82 |  |  |  |  |  |  |  | 
| 83 |  |  |  |  |  |  | /* Initialize X and Y accumulators. */ | 
| 84 |  |  |  |  |  |  | x = 0.0; | 
| 85 |  |  |  |  |  |  | y = 0.0; | 
| 86 |  |  |  |  |  |  |  | 
| 87 |  |  |  |  |  |  | /* Periodic terms. */ | 
| 88 | 0 |  |  |  |  |  | w = ERFA_D2PI * t; | 
| 89 | 0 | 0 |  |  |  |  | for ( i = 0; i < NPER; i++ ) { | 
| 90 | 0 |  |  |  |  |  | a = w / xyper[i][0]; | 
| 91 | 0 |  |  |  |  |  | s = sin(a); | 
| 92 | 0 |  |  |  |  |  | c = cos(a); | 
| 93 | 0 |  |  |  |  |  | x += c*xyper[i][1] + s*xyper[i][3]; | 
| 94 | 0 |  |  |  |  |  | y += c*xyper[i][2] + s*xyper[i][4]; | 
| 95 |  |  |  |  |  |  | } | 
| 96 |  |  |  |  |  |  |  | 
| 97 |  |  |  |  |  |  | /* Polynomial terms. */ | 
| 98 |  |  |  |  |  |  | w = 1.0; | 
| 99 | 0 | 0 |  |  |  |  | for ( i = 0; i < NPOL; i++ ) { | 
| 100 | 0 |  |  |  |  |  | x += xypol[0][i]*w; | 
| 101 | 0 |  |  |  |  |  | y += xypol[1][i]*w; | 
| 102 | 0 |  |  |  |  |  | w *= t; | 
| 103 |  |  |  |  |  |  | } | 
| 104 |  |  |  |  |  |  |  | 
| 105 |  |  |  |  |  |  | /* X and Y (direction cosines). */ | 
| 106 | 0 |  |  |  |  |  | x *= ERFA_DAS2R; | 
| 107 | 0 |  |  |  |  |  | y *= ERFA_DAS2R; | 
| 108 |  |  |  |  |  |  |  | 
| 109 |  |  |  |  |  |  | /* Form the equator pole vector. */ | 
| 110 | 0 |  |  |  |  |  | veq[0] = x; | 
| 111 | 0 |  |  |  |  |  | veq[1] = y; | 
| 112 | 0 |  |  |  |  |  | w = 1.0 - x*x - y*y; | 
| 113 | 0 | 0 |  |  |  |  | veq[2] = w < 0.0 ? 0.0 : sqrt(w); | 
| 114 |  |  |  |  |  |  |  | 
| 115 | 0 |  |  |  |  |  | } | 
| 116 |  |  |  |  |  |  | /*---------------------------------------------------------------------- | 
| 117 |  |  |  |  |  |  | ** | 
| 118 |  |  |  |  |  |  | ** | 
| 119 |  |  |  |  |  |  | **  Copyright (C) 2013-2019, NumFOCUS Foundation. | 
| 120 |  |  |  |  |  |  | **  All rights reserved. | 
| 121 |  |  |  |  |  |  | ** | 
| 122 |  |  |  |  |  |  | **  This library is derived, with permission, from the International | 
| 123 |  |  |  |  |  |  | **  Astronomical Union's "Standards of Fundamental Astronomy" library, | 
| 124 |  |  |  |  |  |  | **  available from http://www.iausofa.org. | 
| 125 |  |  |  |  |  |  | ** | 
| 126 |  |  |  |  |  |  | **  The ERFA version is intended to retain identical functionality to | 
| 127 |  |  |  |  |  |  | **  the SOFA library, but made distinct through different function and | 
| 128 |  |  |  |  |  |  | **  file names, as set out in the SOFA license conditions.  The SOFA | 
| 129 |  |  |  |  |  |  | **  original has a role as a reference standard for the IAU and IERS, | 
| 130 |  |  |  |  |  |  | **  and consequently redistribution is permitted only in its unaltered | 
| 131 |  |  |  |  |  |  | **  state.  The ERFA version is not subject to this restriction and | 
| 132 |  |  |  |  |  |  | **  therefore can be included in distributions which do not support the | 
| 133 |  |  |  |  |  |  | **  concept of "read only" software. | 
| 134 |  |  |  |  |  |  | ** | 
| 135 |  |  |  |  |  |  | **  Although the intent is to replicate the SOFA API (other than | 
| 136 |  |  |  |  |  |  | **  replacement of prefix names) and results (with the exception of | 
| 137 |  |  |  |  |  |  | **  bugs;  any that are discovered will be fixed), SOFA is not | 
| 138 |  |  |  |  |  |  | **  responsible for any errors found in this version of the library. | 
| 139 |  |  |  |  |  |  | ** | 
| 140 |  |  |  |  |  |  | **  If you wish to acknowledge the SOFA heritage, please acknowledge | 
| 141 |  |  |  |  |  |  | **  that you are using a library derived from SOFA, rather than SOFA | 
| 142 |  |  |  |  |  |  | **  itself. | 
| 143 |  |  |  |  |  |  | ** | 
| 144 |  |  |  |  |  |  | ** | 
| 145 |  |  |  |  |  |  | **  TERMS AND CONDITIONS | 
| 146 |  |  |  |  |  |  | ** | 
| 147 |  |  |  |  |  |  | **  Redistribution and use in source and binary forms, with or without | 
| 148 |  |  |  |  |  |  | **  modification, are permitted provided that the following conditions | 
| 149 |  |  |  |  |  |  | **  are met: | 
| 150 |  |  |  |  |  |  | ** | 
| 151 |  |  |  |  |  |  | **  1 Redistributions of source code must retain the above copyright | 
| 152 |  |  |  |  |  |  | **    notice, this list of conditions and the following disclaimer. | 
| 153 |  |  |  |  |  |  | ** | 
| 154 |  |  |  |  |  |  | **  2 Redistributions in binary form must reproduce the above copyright | 
| 155 |  |  |  |  |  |  | **    notice, this list of conditions and the following disclaimer in | 
| 156 |  |  |  |  |  |  | **    the documentation and/or other materials provided with the | 
| 157 |  |  |  |  |  |  | **    distribution. | 
| 158 |  |  |  |  |  |  | ** | 
| 159 |  |  |  |  |  |  | **  3 Neither the name of the Standards Of Fundamental Astronomy Board, | 
| 160 |  |  |  |  |  |  | **    the International Astronomical Union nor the names of its | 
| 161 |  |  |  |  |  |  | **    contributors may be used to endorse or promote products derived | 
| 162 |  |  |  |  |  |  | **    from this software without specific prior written permission. | 
| 163 |  |  |  |  |  |  | ** | 
| 164 |  |  |  |  |  |  | **  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 
| 165 |  |  |  |  |  |  | **  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 
| 166 |  |  |  |  |  |  | **  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 
| 167 |  |  |  |  |  |  | **  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE | 
| 168 |  |  |  |  |  |  | **  COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | 
| 169 |  |  |  |  |  |  | **  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | 
| 170 |  |  |  |  |  |  | **  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 
| 171 |  |  |  |  |  |  | **  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | 
| 172 |  |  |  |  |  |  | **  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 
| 173 |  |  |  |  |  |  | **  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | 
| 174 |  |  |  |  |  |  | **  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 
| 175 |  |  |  |  |  |  | **  POSSIBILITY OF SUCH DAMAGE. | 
| 176 |  |  |  |  |  |  | ** | 
| 177 |  |  |  |  |  |  | */ |