1 | #ifndef ERFAMHDEF
|
---|
2 | #define ERFAMHDEF
|
---|
3 |
|
---|
4 | /*
|
---|
5 | ** - - - - - - - -
|
---|
6 | ** e r f a m . h
|
---|
7 | ** - - - - - - - -
|
---|
8 | **
|
---|
9 | ** Macros used by ERFA library.
|
---|
10 | **
|
---|
11 | ** Copyright (C) 2013-2016, NumFOCUS Foundation.
|
---|
12 | ** Derived, with permission, from the SOFA library. See notes at end of file.
|
---|
13 | */
|
---|
14 |
|
---|
15 | /* Star-independent astrometry parameters */
|
---|
16 | typedef struct {
|
---|
17 | double pmt; /* PM time interval (SSB, Julian years) */
|
---|
18 | double eb[3]; /* SSB to observer (vector, au) */
|
---|
19 | double eh[3]; /* Sun to observer (unit vector) */
|
---|
20 | double em; /* distance from Sun to observer (au) */
|
---|
21 | double v[3]; /* barycentric observer velocity (vector, c) */
|
---|
22 | double bm1; /* sqrt(1-|v|^2): reciprocal of Lorenz factor */
|
---|
23 | double bpn[3][3]; /* bias-precession-nutation matrix */
|
---|
24 | double along; /* longitude + s' + dERA(DUT) (radians) */
|
---|
25 | double phi; /* geodetic latitude (radians) */
|
---|
26 | double xpl; /* polar motion xp wrt local meridian (radians) */
|
---|
27 | double ypl; /* polar motion yp wrt local meridian (radians) */
|
---|
28 | double sphi; /* sine of geodetic latitude */
|
---|
29 | double cphi; /* cosine of geodetic latitude */
|
---|
30 | double diurab; /* magnitude of diurnal aberration vector */
|
---|
31 | double eral; /* "local" Earth rotation angle (radians) */
|
---|
32 | double refa; /* refraction constant A (radians) */
|
---|
33 | double refb; /* refraction constant B (radians) */
|
---|
34 | } eraASTROM;
|
---|
35 | /* (Vectors eb, eh, em and v are all with respect to BCRS axes.) */
|
---|
36 |
|
---|
37 | /* Body parameters for light deflection */
|
---|
38 | typedef struct {
|
---|
39 | double bm; /* mass of the body (solar masses) */
|
---|
40 | double dl; /* deflection limiter (radians^2/2) */
|
---|
41 | double pv[2][3]; /* barycentric PV of the body (au, au/day) */
|
---|
42 | } eraLDBODY;
|
---|
43 |
|
---|
44 | /* Pi */
|
---|
45 | #define ERFA_DPI (3.141592653589793238462643)
|
---|
46 |
|
---|
47 | /* 2Pi */
|
---|
48 | #define ERFA_D2PI (6.283185307179586476925287)
|
---|
49 |
|
---|
50 | /* Radians to degrees */
|
---|
51 | #define ERFA_DR2D (57.29577951308232087679815)
|
---|
52 |
|
---|
53 | /* Degrees to radians */
|
---|
54 | #define ERFA_DD2R (1.745329251994329576923691e-2)
|
---|
55 |
|
---|
56 | /* Radians to arcseconds */
|
---|
57 | #define ERFA_DR2AS (206264.8062470963551564734)
|
---|
58 |
|
---|
59 | /* Arcseconds to radians */
|
---|
60 | #define ERFA_DAS2R (4.848136811095359935899141e-6)
|
---|
61 |
|
---|
62 | /* Seconds of time to radians */
|
---|
63 | #define ERFA_DS2R (7.272205216643039903848712e-5)
|
---|
64 |
|
---|
65 | /* Arcseconds in a full circle */
|
---|
66 | #define ERFA_TURNAS (1296000.0)
|
---|
67 |
|
---|
68 | /* Milliarcseconds to radians */
|
---|
69 | #define ERFA_DMAS2R (ERFA_DAS2R / 1e3)
|
---|
70 |
|
---|
71 | /* Length of tropical year B1900 (days) */
|
---|
72 | #define ERFA_DTY (365.242198781)
|
---|
73 |
|
---|
74 | /* Seconds per day. */
|
---|
75 | #define ERFA_DAYSEC (86400.0)
|
---|
76 |
|
---|
77 | /* Days per Julian year */
|
---|
78 | #define ERFA_DJY (365.25)
|
---|
79 |
|
---|
80 | /* Days per Julian century */
|
---|
81 | #define ERFA_DJC (36525.0)
|
---|
82 |
|
---|
83 | /* Days per Julian millennium */
|
---|
84 | #define ERFA_DJM (365250.0)
|
---|
85 |
|
---|
86 | /* Reference epoch (J2000.0), Julian Date */
|
---|
87 | #define ERFA_DJ00 (2451545.0)
|
---|
88 |
|
---|
89 | /* Julian Date of Modified Julian Date zero */
|
---|
90 | #define ERFA_DJM0 (2400000.5)
|
---|
91 |
|
---|
92 | /* Reference epoch (J2000.0), Modified Julian Date */
|
---|
93 | #define ERFA_DJM00 (51544.5)
|
---|
94 |
|
---|
95 | /* 1977 Jan 1.0 as MJD */
|
---|
96 | #define ERFA_DJM77 (43144.0)
|
---|
97 |
|
---|
98 | /* TT minus TAI (s) */
|
---|
99 | #define ERFA_TTMTAI (32.184)
|
---|
100 |
|
---|
101 | /* Astronomical unit (m) */
|
---|
102 | #define ERFA_DAU (149597870e3)
|
---|
103 |
|
---|
104 | /* Speed of light (m/s) */
|
---|
105 | #define ERFA_CMPS 299792458.0
|
---|
106 |
|
---|
107 | /* Light time for 1 au (s) */
|
---|
108 | #define ERFA_AULT 499.004782
|
---|
109 |
|
---|
110 | /* Speed of light (AU per day) */
|
---|
111 | #define ERFA_DC (ERFA_DAYSEC / ERFA_AULT)
|
---|
112 |
|
---|
113 | /* L_G = 1 - d(TT)/d(TCG) */
|
---|
114 | #define ERFA_ELG (6.969290134e-10)
|
---|
115 |
|
---|
116 | /* L_B = 1 - d(TDB)/d(TCB), and TDB (s) at TAI 1977/1/1.0 */
|
---|
117 | #define ERFA_ELB (1.550519768e-8)
|
---|
118 | #define ERFA_TDB0 (-6.55e-5)
|
---|
119 |
|
---|
120 | /* Schwarzschild radius of the Sun (au) */
|
---|
121 | /* = 2 * 1.32712440041e20 / (2.99792458e8)^2 / 1.49597870700e11 */
|
---|
122 | #define ERFA_SRS 1.97412574336e-8
|
---|
123 |
|
---|
124 | /* ERFA_DINT(A) - truncate to nearest whole number towards zero (double) */
|
---|
125 | #define ERFA_DINT(A) ((A)<0.0?ceil(A):floor(A))
|
---|
126 |
|
---|
127 | /* ERFA_DNINT(A) - round to nearest whole number (double) */
|
---|
128 | #define ERFA_DNINT(A) ((A)<0.0?ceil((A)-0.5):floor((A)+0.5))
|
---|
129 |
|
---|
130 | /* ERFA_DSIGN(A,B) - magnitude of A with sign of B (double) */
|
---|
131 | #define ERFA_DSIGN(A,B) ((B)<0.0?-fabs(A):fabs(A))
|
---|
132 |
|
---|
133 | /* max(A,B) - larger (most +ve) of two numbers (generic) */
|
---|
134 | #define ERFA_GMAX(A,B) (((A)>(B))?(A):(B))
|
---|
135 |
|
---|
136 | /* min(A,B) - smaller (least +ve) of two numbers (generic) */
|
---|
137 | #define ERFA_GMIN(A,B) (((A)<(B))?(A):(B))
|
---|
138 |
|
---|
139 | /* Reference ellipsoids */
|
---|
140 | #define ERFA_WGS84 1
|
---|
141 | #define ERFA_GRS80 2
|
---|
142 | #define ERFA_WGS72 3
|
---|
143 |
|
---|
144 | #endif
|
---|
145 |
|
---|
146 |
|
---|
147 | /*----------------------------------------------------------------------
|
---|
148 | **
|
---|
149 | **
|
---|
150 | ** Copyright (C) 2013-2016, NumFOCUS Foundation.
|
---|
151 | ** All rights reserved.
|
---|
152 | **
|
---|
153 | ** This library is derived, with permission, from the International
|
---|
154 | ** Astronomical Union's "Standards of Fundamental Astronomy" library,
|
---|
155 | ** available from http://www.iausofa.org.
|
---|
156 | **
|
---|
157 | ** The ERFA version is intended to retain identical functionality to
|
---|
158 | ** the SOFA library, but made distinct through different function and
|
---|
159 | ** file names, as set out in the SOFA license conditions. The SOFA
|
---|
160 | ** original has a role as a reference standard for the IAU and IERS,
|
---|
161 | ** and consequently redistribution is permitted only in its unaltered
|
---|
162 | ** state. The ERFA version is not subject to this restriction and
|
---|
163 | ** therefore can be included in distributions which do not support the
|
---|
164 | ** concept of "read only" software.
|
---|
165 | **
|
---|
166 | ** Although the intent is to replicate the SOFA API (other than
|
---|
167 | ** replacement of prefix names) and results (with the exception of
|
---|
168 | ** bugs; any that are discovered will be fixed), SOFA is not
|
---|
169 | ** responsible for any errors found in this version of the library.
|
---|
170 | **
|
---|
171 | ** If you wish to acknowledge the SOFA heritage, please acknowledge
|
---|
172 | ** that you are using a library derived from SOFA, rather than SOFA
|
---|
173 | ** itself.
|
---|
174 | **
|
---|
175 | **
|
---|
176 | ** TERMS AND CONDITIONS
|
---|
177 | **
|
---|
178 | ** Redistribution and use in source and binary forms, with or without
|
---|
179 | ** modification, are permitted provided that the following conditions
|
---|
180 | ** are met:
|
---|
181 | **
|
---|
182 | ** 1 Redistributions of source code must retain the above copyright
|
---|
183 | ** notice, this list of conditions and the following disclaimer.
|
---|
184 | **
|
---|
185 | ** 2 Redistributions in binary form must reproduce the above copyright
|
---|
186 | ** notice, this list of conditions and the following disclaimer in
|
---|
187 | ** the documentation and/or other materials provided with the
|
---|
188 | ** distribution.
|
---|
189 | **
|
---|
190 | ** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
|
---|
191 | ** the International Astronomical Union nor the names of its
|
---|
192 | ** contributors may be used to endorse or promote products derived
|
---|
193 | ** from this software without specific prior written permission.
|
---|
194 | **
|
---|
195 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
---|
196 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
---|
197 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
---|
198 | ** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
---|
199 | ** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
200 | ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
---|
201 | ** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
---|
202 | ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
---|
203 | ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
---|
204 | ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
---|
205 | ** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
---|
206 | ** POSSIBILITY OF SUCH DAMAGE.
|
---|
207 | **
|
---|
208 | */
|
---|