source: trunk/FACT++/erfa/src/icrs2g.c@ 19008

Last change on this file since 19008 was 18921, checked in by tbretz, 7 years ago
Updated to ERFA 1.4.0
File size: 6.8 KB
Line 
1#include "erfa.h"
2
3void 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** Copyright (C) 2013-2017, NumFOCUS Foundation.
65** Derived, with permission, from the SOFA library. See notes at end of file.
66*/
67{
68 double v1[3], v2[3];
69
70/*
71** L2,B2 system of galactic coordinates in the form presented in the
72** Hipparcos Catalogue. In degrees:
73**
74** P = 192.85948 right ascension of the Galactic north pole in ICRS
75** Q = 27.12825 declination of the Galactic north pole in ICRS
76** R = 32.93192 longitude of the ascending node of the Galactic
77** plane on the ICRS equator
78**
79** ICRS to galactic rotation matrix, obtained by computing
80** R_3(-R) R_1(pi/2-Q) R_3(pi/2+P) to the full precision shown:
81*/
82 double r[3][3] = { { -0.054875560416215368492398900454,
83 -0.873437090234885048760383168409,
84 -0.483835015548713226831774175116 },
85 { +0.494109427875583673525222371358,
86 -0.444829629960011178146614061616,
87 +0.746982244497218890527388004556 },
88 { -0.867666149019004701181616534570,
89 -0.198076373431201528180486091412,
90 +0.455983776175066922272100478348 } };
91
92
93/* Spherical to Cartesian. */
94 eraS2c(dr, dd, v1);
95
96/* ICRS to Galactic. */
97 eraRxp(r, v1, v2);
98
99/* Cartesian to spherical. */
100 eraC2s(v2, dl, db);
101
102/* Express in conventional ranges. */
103 *dl = eraAnp(*dl);
104 *db = eraAnpm(*db);
105
106/* Finished. */
107
108}
109/*----------------------------------------------------------------------
110**
111**
112** Copyright (C) 2013-2017, NumFOCUS Foundation.
113** All rights reserved.
114**
115** This library is derived, with permission, from the International
116** Astronomical Union's "Standards of Fundamental Astronomy" library,
117** available from http://www.iausofa.org.
118**
119** The ERFA version is intended to retain identical functionality to
120** the SOFA library, but made distinct through different function and
121** file names, as set out in the SOFA license conditions. The SOFA
122** original has a role as a reference standard for the IAU and IERS,
123** and consequently redistribution is permitted only in its unaltered
124** state. The ERFA version is not subject to this restriction and
125** therefore can be included in distributions which do not support the
126** concept of "read only" software.
127**
128** Although the intent is to replicate the SOFA API (other than
129** replacement of prefix names) and results (with the exception of
130** bugs; any that are discovered will be fixed), SOFA is not
131** responsible for any errors found in this version of the library.
132**
133** If you wish to acknowledge the SOFA heritage, please acknowledge
134** that you are using a library derived from SOFA, rather than SOFA
135** itself.
136**
137**
138** TERMS AND CONDITIONS
139**
140** Redistribution and use in source and binary forms, with or without
141** modification, are permitted provided that the following conditions
142** are met:
143**
144** 1 Redistributions of source code must retain the above copyright
145** notice, this list of conditions and the following disclaimer.
146**
147** 2 Redistributions in binary form must reproduce the above copyright
148** notice, this list of conditions and the following disclaimer in
149** the documentation and/or other materials provided with the
150** distribution.
151**
152** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
153** the International Astronomical Union nor the names of its
154** contributors may be used to endorse or promote products derived
155** from this software without specific prior written permission.
156**
157** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
158** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
159** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
160** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
161** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
162** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
163** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
164** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
165** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
166** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
167** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
168** POSSIBILITY OF SUCH DAMAGE.
169**
170*/
Note: See TracBrowser for help on using the repository browser.