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