1 | #include "erfa.h"
|
---|
2 |
|
---|
3 | void eraC2ixys(double x, double y, double s, double rc2i[3][3])
|
---|
4 | /*
|
---|
5 | ** - - - - - - - - - -
|
---|
6 | ** e r a C 2 i x y s
|
---|
7 | ** - - - - - - - - - -
|
---|
8 | **
|
---|
9 | ** Form the celestial to intermediate-frame-of-date matrix given the CIP
|
---|
10 | ** X,Y and the CIO locator s.
|
---|
11 | **
|
---|
12 | ** Given:
|
---|
13 | ** x,y double Celestial Intermediate Pole (Note 1)
|
---|
14 | ** s double the CIO locator s (Note 2)
|
---|
15 | **
|
---|
16 | ** Returned:
|
---|
17 | ** rc2i double[3][3] celestial-to-intermediate matrix (Note 3)
|
---|
18 | **
|
---|
19 | ** Notes:
|
---|
20 | **
|
---|
21 | ** 1) The Celestial Intermediate Pole coordinates are the x,y
|
---|
22 | ** components of the unit vector in the Geocentric Celestial
|
---|
23 | ** Reference System.
|
---|
24 | **
|
---|
25 | ** 2) The CIO locator s (in radians) positions the Celestial
|
---|
26 | ** Intermediate Origin on the equator of the CIP.
|
---|
27 | **
|
---|
28 | ** 3) The matrix rc2i is the first stage in the transformation from
|
---|
29 | ** celestial to terrestrial coordinates:
|
---|
30 | **
|
---|
31 | ** [TRS] = RPOM * R_3(ERA) * rc2i * [CRS]
|
---|
32 | **
|
---|
33 | ** = RC2T * [CRS]
|
---|
34 | **
|
---|
35 | ** where [CRS] is a vector in the Geocentric Celestial Reference
|
---|
36 | ** System and [TRS] is a vector in the International Terrestrial
|
---|
37 | ** Reference System (see IERS Conventions 2003), ERA is the Earth
|
---|
38 | ** Rotation Angle and RPOM is the polar motion matrix.
|
---|
39 | **
|
---|
40 | ** Called:
|
---|
41 | ** eraIr initialize r-matrix to identity
|
---|
42 | ** eraRz rotate around Z-axis
|
---|
43 | ** eraRy rotate around Y-axis
|
---|
44 | **
|
---|
45 | ** Reference:
|
---|
46 | **
|
---|
47 | ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
|
---|
48 | ** IERS Technical Note No. 32, BKG (2004)
|
---|
49 | **
|
---|
50 | ** Copyright (C) 2013-2016, NumFOCUS Foundation.
|
---|
51 | ** Derived, with permission, from the SOFA library. See notes at end of file.
|
---|
52 | */
|
---|
53 | {
|
---|
54 | double r2, e, d;
|
---|
55 |
|
---|
56 |
|
---|
57 | /* Obtain the spherical angles E and d. */
|
---|
58 | r2 = x*x + y*y;
|
---|
59 | e = (r2 > 0.0) ? atan2(y, x) : 0.0;
|
---|
60 | d = atan(sqrt(r2 / (1.0 - r2)));
|
---|
61 |
|
---|
62 | /* Form the matrix. */
|
---|
63 | eraIr(rc2i);
|
---|
64 | eraRz(e, rc2i);
|
---|
65 | eraRy(d, rc2i);
|
---|
66 | eraRz(-(e+s), rc2i);
|
---|
67 |
|
---|
68 | return;
|
---|
69 |
|
---|
70 | }
|
---|
71 | /*----------------------------------------------------------------------
|
---|
72 | **
|
---|
73 | **
|
---|
74 | ** Copyright (C) 2013-2016, NumFOCUS Foundation.
|
---|
75 | ** All rights reserved.
|
---|
76 | **
|
---|
77 | ** This library is derived, with permission, from the International
|
---|
78 | ** Astronomical Union's "Standards of Fundamental Astronomy" library,
|
---|
79 | ** available from http://www.iausofa.org.
|
---|
80 | **
|
---|
81 | ** The ERFA version is intended to retain identical functionality to
|
---|
82 | ** the SOFA library, but made distinct through different function and
|
---|
83 | ** file names, as set out in the SOFA license conditions. The SOFA
|
---|
84 | ** original has a role as a reference standard for the IAU and IERS,
|
---|
85 | ** and consequently redistribution is permitted only in its unaltered
|
---|
86 | ** state. The ERFA version is not subject to this restriction and
|
---|
87 | ** therefore can be included in distributions which do not support the
|
---|
88 | ** concept of "read only" software.
|
---|
89 | **
|
---|
90 | ** Although the intent is to replicate the SOFA API (other than
|
---|
91 | ** replacement of prefix names) and results (with the exception of
|
---|
92 | ** bugs; any that are discovered will be fixed), SOFA is not
|
---|
93 | ** responsible for any errors found in this version of the library.
|
---|
94 | **
|
---|
95 | ** If you wish to acknowledge the SOFA heritage, please acknowledge
|
---|
96 | ** that you are using a library derived from SOFA, rather than SOFA
|
---|
97 | ** itself.
|
---|
98 | **
|
---|
99 | **
|
---|
100 | ** TERMS AND CONDITIONS
|
---|
101 | **
|
---|
102 | ** Redistribution and use in source and binary forms, with or without
|
---|
103 | ** modification, are permitted provided that the following conditions
|
---|
104 | ** are met:
|
---|
105 | **
|
---|
106 | ** 1 Redistributions of source code must retain the above copyright
|
---|
107 | ** notice, this list of conditions and the following disclaimer.
|
---|
108 | **
|
---|
109 | ** 2 Redistributions in binary form must reproduce the above copyright
|
---|
110 | ** notice, this list of conditions and the following disclaimer in
|
---|
111 | ** the documentation and/or other materials provided with the
|
---|
112 | ** distribution.
|
---|
113 | **
|
---|
114 | ** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
|
---|
115 | ** the International Astronomical Union nor the names of its
|
---|
116 | ** contributors may be used to endorse or promote products derived
|
---|
117 | ** from this software without specific prior written permission.
|
---|
118 | **
|
---|
119 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
---|
120 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
---|
121 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
---|
122 | ** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
---|
123 | ** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
124 | ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
---|
125 | ** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
---|
126 | ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
---|
127 | ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
---|
128 | ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
---|
129 | ** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
---|
130 | ** POSSIBILITY OF SUCH DAMAGE.
|
---|
131 | **
|
---|
132 | */
|
---|