| 1 | #include "erfa.h" | 
|---|
| 2 |  | 
|---|
| 3 | void eraAticq(double ri, double di, eraASTROM *astrom, | 
|---|
| 4 | double *rc, double *dc) | 
|---|
| 5 | /* | 
|---|
| 6 | **  - - - - - - - - - | 
|---|
| 7 | **   e r a A t i c q | 
|---|
| 8 | **  - - - - - - - - - | 
|---|
| 9 | ** | 
|---|
| 10 | **  Quick CIRS RA,Dec to ICRS astrometric place, given the star- | 
|---|
| 11 | **  independent astrometry parameters. | 
|---|
| 12 | ** | 
|---|
| 13 | **  Use of this function is appropriate when efficiency is important and | 
|---|
| 14 | **  where many star positions are all to be transformed for one date. | 
|---|
| 15 | **  The star-independent astrometry parameters can be obtained by | 
|---|
| 16 | **  calling one of the functions eraApci[13], eraApcg[13], eraApco[13] | 
|---|
| 17 | **  or eraApcs[13]. | 
|---|
| 18 | ** | 
|---|
| 19 | **  Given: | 
|---|
| 20 | **     ri,di  double     CIRS RA,Dec (radians) | 
|---|
| 21 | **     astrom eraASTROM* star-independent astrometry parameters: | 
|---|
| 22 | **      pmt    double       PM time interval (SSB, Julian years) | 
|---|
| 23 | **      eb     double[3]    SSB to observer (vector, au) | 
|---|
| 24 | **      eh     double[3]    Sun to observer (unit vector) | 
|---|
| 25 | **      em     double       distance from Sun to observer (au) | 
|---|
| 26 | **      v      double[3]    barycentric observer velocity (vector, c) | 
|---|
| 27 | **      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor | 
|---|
| 28 | **      bpn    double[3][3] bias-precession-nutation matrix | 
|---|
| 29 | **      along  double       longitude + s' (radians) | 
|---|
| 30 | **      xpl    double       polar motion xp wrt local meridian (radians) | 
|---|
| 31 | **      ypl    double       polar motion yp wrt local meridian (radians) | 
|---|
| 32 | **      sphi   double       sine of geodetic latitude | 
|---|
| 33 | **      cphi   double       cosine of geodetic latitude | 
|---|
| 34 | **      diurab double       magnitude of diurnal aberration vector | 
|---|
| 35 | **      eral   double       "local" Earth rotation angle (radians) | 
|---|
| 36 | **      refa   double       refraction constant A (radians) | 
|---|
| 37 | **      refb   double       refraction constant B (radians) | 
|---|
| 38 | ** | 
|---|
| 39 | **  Returned: | 
|---|
| 40 | **     rc,dc  double     ICRS astrometric RA,Dec (radians) | 
|---|
| 41 | ** | 
|---|
| 42 | **  Notes: | 
|---|
| 43 | ** | 
|---|
| 44 | **  1) Only the Sun is taken into account in the light deflection | 
|---|
| 45 | **     correction. | 
|---|
| 46 | ** | 
|---|
| 47 | **  2) Iterative techniques are used for the aberration and light | 
|---|
| 48 | **     deflection corrections so that the functions eraAtic13 (or | 
|---|
| 49 | **     eraAticq) and eraAtci13 (or eraAtciq) are accurate inverses; | 
|---|
| 50 | **     even at the edge of the Sun's disk the discrepancy is only about | 
|---|
| 51 | **     1 nanoarcsecond. | 
|---|
| 52 | ** | 
|---|
| 53 | **  Called: | 
|---|
| 54 | **     eraS2c       spherical coordinates to unit vector | 
|---|
| 55 | **     eraTrxp      product of transpose of r-matrix and p-vector | 
|---|
| 56 | **     eraZp        zero p-vector | 
|---|
| 57 | **     eraAb        stellar aberration | 
|---|
| 58 | **     eraLdsun     light deflection by the Sun | 
|---|
| 59 | **     eraC2s       p-vector to spherical | 
|---|
| 60 | **     eraAnp       normalize angle into range +/- pi | 
|---|
| 61 | ** | 
|---|
| 62 | **  Copyright (C) 2013-2017, NumFOCUS Foundation. | 
|---|
| 63 | **  Derived, with permission, from the SOFA library.  See notes at end of file. | 
|---|
| 64 | */ | 
|---|
| 65 | { | 
|---|
| 66 | int j, i; | 
|---|
| 67 | double pi[3], ppr[3], pnat[3], pco[3], w, d[3], before[3], r2, r, | 
|---|
| 68 | after[3]; | 
|---|
| 69 |  | 
|---|
| 70 |  | 
|---|
| 71 | /* CIRS RA,Dec to Cartesian. */ | 
|---|
| 72 | eraS2c(ri, di, pi); | 
|---|
| 73 |  | 
|---|
| 74 | /* Bias-precession-nutation, giving GCRS proper direction. */ | 
|---|
| 75 | eraTrxp(astrom->bpn, pi, ppr); | 
|---|
| 76 |  | 
|---|
| 77 | /* Aberration, giving GCRS natural direction. */ | 
|---|
| 78 | eraZp(d); | 
|---|
| 79 | for (j = 0; j < 2; j++) { | 
|---|
| 80 | r2 = 0.0; | 
|---|
| 81 | for (i = 0; i < 3; i++) { | 
|---|
| 82 | w = ppr[i] - d[i]; | 
|---|
| 83 | before[i] = w; | 
|---|
| 84 | r2 += w*w; | 
|---|
| 85 | } | 
|---|
| 86 | r = sqrt(r2); | 
|---|
| 87 | for (i = 0; i < 3; i++) { | 
|---|
| 88 | before[i] /= r; | 
|---|
| 89 | } | 
|---|
| 90 | eraAb(before, astrom->v, astrom->em, astrom->bm1, after); | 
|---|
| 91 | r2 = 0.0; | 
|---|
| 92 | for (i = 0; i < 3; i++) { | 
|---|
| 93 | d[i] = after[i] - before[i]; | 
|---|
| 94 | w = ppr[i] - d[i]; | 
|---|
| 95 | pnat[i] = w; | 
|---|
| 96 | r2 += w*w; | 
|---|
| 97 | } | 
|---|
| 98 | r = sqrt(r2); | 
|---|
| 99 | for (i = 0; i < 3; i++) { | 
|---|
| 100 | pnat[i] /= r; | 
|---|
| 101 | } | 
|---|
| 102 | } | 
|---|
| 103 |  | 
|---|
| 104 | /* Light deflection by the Sun, giving BCRS coordinate direction. */ | 
|---|
| 105 | eraZp(d); | 
|---|
| 106 | for (j = 0; j < 5; j++) { | 
|---|
| 107 | r2 = 0.0; | 
|---|
| 108 | for (i = 0; i < 3; i++) { | 
|---|
| 109 | w = pnat[i] - d[i]; | 
|---|
| 110 | before[i] = w; | 
|---|
| 111 | r2 += w*w; | 
|---|
| 112 | } | 
|---|
| 113 | r = sqrt(r2); | 
|---|
| 114 | for (i = 0; i < 3; i++) { | 
|---|
| 115 | before[i] /= r; | 
|---|
| 116 | } | 
|---|
| 117 | eraLdsun(before, astrom->eh, astrom->em, after); | 
|---|
| 118 | r2 = 0.0; | 
|---|
| 119 | for (i = 0; i < 3; i++) { | 
|---|
| 120 | d[i] = after[i] - before[i]; | 
|---|
| 121 | w = pnat[i] - d[i]; | 
|---|
| 122 | pco[i] = w; | 
|---|
| 123 | r2 += w*w; | 
|---|
| 124 | } | 
|---|
| 125 | r = sqrt(r2); | 
|---|
| 126 | for (i = 0; i < 3; i++) { | 
|---|
| 127 | pco[i] /= r; | 
|---|
| 128 | } | 
|---|
| 129 | } | 
|---|
| 130 |  | 
|---|
| 131 | /* ICRS astrometric RA,Dec. */ | 
|---|
| 132 | eraC2s(pco, &w, dc); | 
|---|
| 133 | *rc = eraAnp(w); | 
|---|
| 134 |  | 
|---|
| 135 | /* Finished. */ | 
|---|
| 136 |  | 
|---|
| 137 | } | 
|---|
| 138 | /*---------------------------------------------------------------------- | 
|---|
| 139 | ** | 
|---|
| 140 | ** | 
|---|
| 141 | **  Copyright (C) 2013-2017, NumFOCUS Foundation. | 
|---|
| 142 | **  All rights reserved. | 
|---|
| 143 | ** | 
|---|
| 144 | **  This library is derived, with permission, from the International | 
|---|
| 145 | **  Astronomical Union's "Standards of Fundamental Astronomy" library, | 
|---|
| 146 | **  available from http://www.iausofa.org. | 
|---|
| 147 | ** | 
|---|
| 148 | **  The ERFA version is intended to retain identical functionality to | 
|---|
| 149 | **  the SOFA library, but made distinct through different function and | 
|---|
| 150 | **  file names, as set out in the SOFA license conditions.  The SOFA | 
|---|
| 151 | **  original has a role as a reference standard for the IAU and IERS, | 
|---|
| 152 | **  and consequently redistribution is permitted only in its unaltered | 
|---|
| 153 | **  state.  The ERFA version is not subject to this restriction and | 
|---|
| 154 | **  therefore can be included in distributions which do not support the | 
|---|
| 155 | **  concept of "read only" software. | 
|---|
| 156 | ** | 
|---|
| 157 | **  Although the intent is to replicate the SOFA API (other than | 
|---|
| 158 | **  replacement of prefix names) and results (with the exception of | 
|---|
| 159 | **  bugs;  any that are discovered will be fixed), SOFA is not | 
|---|
| 160 | **  responsible for any errors found in this version of the library. | 
|---|
| 161 | ** | 
|---|
| 162 | **  If you wish to acknowledge the SOFA heritage, please acknowledge | 
|---|
| 163 | **  that you are using a library derived from SOFA, rather than SOFA | 
|---|
| 164 | **  itself. | 
|---|
| 165 | ** | 
|---|
| 166 | ** | 
|---|
| 167 | **  TERMS AND CONDITIONS | 
|---|
| 168 | ** | 
|---|
| 169 | **  Redistribution and use in source and binary forms, with or without | 
|---|
| 170 | **  modification, are permitted provided that the following conditions | 
|---|
| 171 | **  are met: | 
|---|
| 172 | ** | 
|---|
| 173 | **  1 Redistributions of source code must retain the above copyright | 
|---|
| 174 | **    notice, this list of conditions and the following disclaimer. | 
|---|
| 175 | ** | 
|---|
| 176 | **  2 Redistributions in binary form must reproduce the above copyright | 
|---|
| 177 | **    notice, this list of conditions and the following disclaimer in | 
|---|
| 178 | **    the documentation and/or other materials provided with the | 
|---|
| 179 | **    distribution. | 
|---|
| 180 | ** | 
|---|
| 181 | **  3 Neither the name of the Standards Of Fundamental Astronomy Board, | 
|---|
| 182 | **    the International Astronomical Union nor the names of its | 
|---|
| 183 | **    contributors may be used to endorse or promote products derived | 
|---|
| 184 | **    from this software without specific prior written permission. | 
|---|
| 185 | ** | 
|---|
| 186 | **  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 
|---|
| 187 | **  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 
|---|
| 188 | **  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 
|---|
| 189 | **  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE | 
|---|
| 190 | **  COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | 
|---|
| 191 | **  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | 
|---|
| 192 | **  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 
|---|
| 193 | **  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | 
|---|
| 194 | **  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 
|---|
| 195 | **  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | 
|---|
| 196 | **  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 
|---|
| 197 | **  POSSIBILITY OF SUCH DAMAGE. | 
|---|
| 198 | ** | 
|---|
| 199 | */ | 
|---|