1 #include "erfa.h"
2
eraIcrs2g(double dr,double dd,double * dl,double * db)3 void eraIcrs2g ( double dr, double dd, double *dl, double *db )
4 /*
5 ** - - - - - - - - - -
6 ** e r a I c r s 2 g
7 ** - - - - - - - - - -
8 **
9 ** Transformation from ICRS to Galactic Coordinates.
10 **
11 ** Given:
12 ** dr double ICRS right ascension (radians)
13 ** dd double ICRS declination (radians)
14 **
15 ** Returned:
16 ** dl double galactic longitude (radians)
17 ** db double galactic latitude (radians)
18 **
19 ** Notes:
20 **
21 ** 1) The IAU 1958 system of Galactic coordinates was defined with
22 ** respect to the now obsolete reference system FK4 B1950.0. When
23 ** interpreting the system in a modern context, several factors have
24 ** to be taken into account:
25 **
26 ** . The inclusion in FK4 positions of the E-terms of aberration.
27 **
28 ** . The distortion of the FK4 proper motion system by differential
29 ** Galactic rotation.
30 **
31 ** . The use of the B1950.0 equinox rather than the now-standard
32 ** J2000.0.
33 **
34 ** . The frame bias between ICRS and the J2000.0 mean place system.
35 **
36 ** The Hipparcos Catalogue (Perryman & ESA 1997) provides a rotation
37 ** matrix that transforms directly between ICRS and Galactic
38 ** coordinates with the above factors taken into account. The
39 ** matrix is derived from three angles, namely the ICRS coordinates
40 ** of the Galactic pole and the longitude of the ascending node of
41 ** the galactic equator on the ICRS equator. They are given in
42 ** degrees to five decimal places and for canonical purposes are
43 ** regarded as exact. In the Hipparcos Catalogue the matrix
44 ** elements are given to 10 decimal places (about 20 microarcsec).
45 ** In the present ERFA function the matrix elements have been
46 ** recomputed from the canonical three angles and are given to 30
47 ** decimal places.
48 **
49 ** 2) The inverse transformation is performed by the function eraG2icrs.
50 **
51 ** Called:
52 ** eraAnp normalize angle into range 0 to 2pi
53 ** eraAnpm normalize angle into range +/- pi
54 ** eraS2c spherical coordinates to unit vector
55 ** eraRxp product of r-matrix and p-vector
56 ** eraC2s p-vector to spherical
57 **
58 ** Reference:
59 ** Perryman M.A.C. & ESA, 1997, ESA SP-1200, The Hipparcos and Tycho
60 ** catalogues. Astrometric and photometric star catalogues
61 ** derived from the ESA Hipparcos Space Astrometry Mission. ESA
62 ** Publications Division, Noordwijk, Netherlands.
63 **
64 ** This revision: 2021 January 25
65 **
66 ** Copyright (C) 2013-2021, NumFOCUS Foundation.
67 ** Derived, with permission, from the SOFA library. See notes at end of file.
68 */
69 {
70 double v1[3], v2[3];
71
72 /*
73 ** L2,B2 system of galactic coordinates in the form presented in the
74 ** Hipparcos Catalogue. In degrees:
75 **
76 ** P = 192.85948 right ascension of the Galactic north pole in ICRS
77 ** Q = 27.12825 declination of the Galactic north pole in ICRS
78 ** R = 32.93192 Galactic longitude of the ascending node of
79 ** the Galactic equator on the ICRS equator
80 **
81 ** ICRS to galactic rotation matrix, obtained by computing
82 ** R_3(-R) R_1(pi/2-Q) R_3(pi/2+P) to the full precision shown:
83 */
84 double r[3][3] = { { -0.054875560416215368492398900454,
85 -0.873437090234885048760383168409,
86 -0.483835015548713226831774175116 },
87 { +0.494109427875583673525222371358,
88 -0.444829629960011178146614061616,
89 +0.746982244497218890527388004556 },
90 { -0.867666149019004701181616534570,
91 -0.198076373431201528180486091412,
92 +0.455983776175066922272100478348 } };
93
94
95 /* Spherical to Cartesian. */
96 eraS2c(dr, dd, v1);
97
98 /* ICRS to Galactic. */
99 eraRxp(r, v1, v2);
100
101 /* Cartesian to spherical. */
102 eraC2s(v2, dl, db);
103
104 /* Express in conventional ranges. */
105 *dl = eraAnp(*dl);
106 *db = eraAnpm(*db);
107
108 /* Finished. */
109
110 }
111 /*----------------------------------------------------------------------
112 **
113 **
114 ** Copyright (C) 2013-2021, NumFOCUS Foundation.
115 ** All rights reserved.
116 **
117 ** This library is derived, with permission, from the International
118 ** Astronomical Union's "Standards of Fundamental Astronomy" library,
119 ** available from http://www.iausofa.org.
120 **
121 ** The ERFA version is intended to retain identical functionality to
122 ** the SOFA library, but made distinct through different function and
123 ** file names, as set out in the SOFA license conditions. The SOFA
124 ** original has a role as a reference standard for the IAU and IERS,
125 ** and consequently redistribution is permitted only in its unaltered
126 ** state. The ERFA version is not subject to this restriction and
127 ** therefore can be included in distributions which do not support the
128 ** concept of "read only" software.
129 **
130 ** Although the intent is to replicate the SOFA API (other than
131 ** replacement of prefix names) and results (with the exception of
132 ** bugs; any that are discovered will be fixed), SOFA is not
133 ** responsible for any errors found in this version of the library.
134 **
135 ** If you wish to acknowledge the SOFA heritage, please acknowledge
136 ** that you are using a library derived from SOFA, rather than SOFA
137 ** itself.
138 **
139 **
140 ** TERMS AND CONDITIONS
141 **
142 ** Redistribution and use in source and binary forms, with or without
143 ** modification, are permitted provided that the following conditions
144 ** are met:
145 **
146 ** 1 Redistributions of source code must retain the above copyright
147 ** notice, this list of conditions and the following disclaimer.
148 **
149 ** 2 Redistributions in binary form must reproduce the above copyright
150 ** notice, this list of conditions and the following disclaimer in
151 ** the documentation and/or other materials provided with the
152 ** distribution.
153 **
154 ** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
155 ** the International Astronomical Union nor the names of its
156 ** contributors may be used to endorse or promote products derived
157 ** from this software without specific prior written permission.
158 **
159 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
160 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
161 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
162 ** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
163 ** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
164 ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
165 ** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
166 ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
167 ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
168 ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
169 ** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
170 ** POSSIBILITY OF SUCH DAMAGE.
171 **
172 */
173