FACT++  1.0
aticq.c
Go to the documentation of this file.
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-2015, 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 /* CIRS RA,Dec to Cartesian. */
71  eraS2c(ri, di, pi);
72 
73 /* Bias-precession-nutation, giving GCRS proper direction. */
74  eraTrxp(astrom->bpn, pi, ppr);
75 
76 /* Aberration, giving GCRS natural direction. */
77  eraZp(d);
78  for (j = 0; j < 2; j++) {
79  r2 = 0.0;
80  for (i = 0; i < 3; i++) {
81  w = ppr[i] - d[i];
82  before[i] = w;
83  r2 += w*w;
84  }
85  r = sqrt(r2);
86  for (i = 0; i < 3; i++) {
87  before[i] /= r;
88  }
89  eraAb(before, astrom->v, astrom->em, astrom->bm1, after);
90  r2 = 0.0;
91  for (i = 0; i < 3; i++) {
92  d[i] = after[i] - before[i];
93  w = ppr[i] - d[i];
94  pnat[i] = w;
95  r2 += w*w;
96  }
97  r = sqrt(r2);
98  for (i = 0; i < 3; i++) {
99  pnat[i] /= r;
100  }
101  }
102 
103 /* Light deflection by the Sun, giving BCRS coordinate direction. */
104  eraZp(d);
105  for (j = 0; j < 5; j++) {
106  r2 = 0.0;
107  for (i = 0; i < 3; i++) {
108  w = pnat[i] - d[i];
109  before[i] = w;
110  r2 += w*w;
111  }
112  r = sqrt(r2);
113  for (i = 0; i < 3; i++) {
114  before[i] /= r;
115  }
116  eraLdsun(before, astrom->eh, astrom->em, after);
117  r2 = 0.0;
118  for (i = 0; i < 3; i++) {
119  d[i] = after[i] - before[i];
120  w = pnat[i] - d[i];
121  pco[i] = w;
122  r2 += w*w;
123  }
124  r = sqrt(r2);
125  for (i = 0; i < 3; i++) {
126  pco[i] /= r;
127  }
128  }
129 
130 /* ICRS astrometric RA,Dec. */
131  eraC2s(pco, &w, dc);
132  *rc = eraAnp(w);
133 
134 /* Finished. */
135 
136 }
137 /*----------------------------------------------------------------------
138 **
139 **
140 ** Copyright (C) 2013-2015, NumFOCUS Foundation.
141 ** All rights reserved.
142 **
143 ** This library is derived, with permission, from the International
144 ** Astronomical Union's "Standards of Fundamental Astronomy" library,
145 ** available from http://www.iausofa.org.
146 **
147 ** The ERFA version is intended to retain identical functionality to
148 ** the SOFA library, but made distinct through different function and
149 ** file names, as set out in the SOFA license conditions. The SOFA
150 ** original has a role as a reference standard for the IAU and IERS,
151 ** and consequently redistribution is permitted only in its unaltered
152 ** state. The ERFA version is not subject to this restriction and
153 ** therefore can be included in distributions which do not support the
154 ** concept of "read only" software.
155 **
156 ** Although the intent is to replicate the SOFA API (other than
157 ** replacement of prefix names) and results (with the exception of
158 ** bugs; any that are discovered will be fixed), SOFA is not
159 ** responsible for any errors found in this version of the library.
160 **
161 ** If you wish to acknowledge the SOFA heritage, please acknowledge
162 ** that you are using a library derived from SOFA, rather than SOFA
163 ** itself.
164 **
165 **
166 ** TERMS AND CONDITIONS
167 **
168 ** Redistribution and use in source and binary forms, with or without
169 ** modification, are permitted provided that the following conditions
170 ** are met:
171 **
172 ** 1 Redistributions of source code must retain the above copyright
173 ** notice, this list of conditions and the following disclaimer.
174 **
175 ** 2 Redistributions in binary form must reproduce the above copyright
176 ** notice, this list of conditions and the following disclaimer in
177 ** the documentation and/or other materials provided with the
178 ** distribution.
179 **
180 ** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
181 ** the International Astronomical Union nor the names of its
182 ** contributors may be used to endorse or promote products derived
183 ** from this software without specific prior written permission.
184 **
185 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
186 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
187 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
188 ** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
189 ** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
190 ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
191 ** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
192 ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
193 ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
194 ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
195 ** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
196 ** POSSIBILITY OF SUCH DAMAGE.
197 **
198 */
void eraAb(double pnat[3], double v[3], double s, double bm1, double ppr[3])
Definition: ab.c:3
double eh[3]
Definition: erfam.h:19
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 eraTrxp(double r[3][3], double p[3], double trp[3])
Definition: trxp.c:3
double bpn[3][3]
Definition: erfam.h:23
void eraAticq(double ri, double di, eraASTROM *astrom, double *rc, double *dc)
Definition: aticq.c:3
double v[3]
Definition: erfam.h:21
void eraZp(double p[3])
Definition: zp.c:3
double eraAnp(double a)
Definition: anp.c:3
double em
Definition: erfam.h:20
double bm1
Definition: erfam.h:22
void eraLdsun(double p[3], double e[3], double em, double p1[3])
Definition: ldsun.c:3