File Coverage

erfasrc/src/hfk5z.c
Criterion Covered Total %
statement 0 14 0.0
branch n/a
condition n/a
subroutine n/a
pod n/a
total 0 14 0.0


line stmt bran cond sub pod time code
1             #include "erfa.h"
2              
3 0           void eraHfk5z(double rh, double dh, double date1, double date2,
4             double *r5, double *d5, double *dr5, double *dd5)
5             /*
6             ** - - - - - - - - -
7             ** e r a H f k 5 z
8             ** - - - - - - - - -
9             **
10             ** Transform a Hipparcos star position into FK5 J2000.0, assuming
11             ** zero Hipparcos proper motion.
12             **
13             ** Given:
14             ** rh double Hipparcos RA (radians)
15             ** dh double Hipparcos Dec (radians)
16             ** date1,date2 double TDB date (Note 1)
17             **
18             ** Returned (all FK5, equinox J2000.0, date date1+date2):
19             ** r5 double RA (radians)
20             ** d5 double Dec (radians)
21             ** dr5 double FK5 RA proper motion (rad/year, Note 4)
22             ** dd5 double Dec proper motion (rad/year, Note 4)
23             **
24             ** Notes:
25             **
26             ** 1) The TT date date1+date2 is a Julian Date, apportioned in any
27             ** convenient way between the two arguments. For example,
28             ** JD(TT)=2450123.7 could be expressed in any of these ways,
29             ** among others:
30             **
31             ** date1 date2
32             **
33             ** 2450123.7 0.0 (JD method)
34             ** 2451545.0 -1421.3 (J2000 method)
35             ** 2400000.5 50123.2 (MJD method)
36             ** 2450123.5 0.2 (date & time method)
37             **
38             ** The JD method is the most natural and convenient to use in
39             ** cases where the loss of several decimal digits of resolution
40             ** is acceptable. The J2000 method is best matched to the way
41             ** the argument is handled internally and will deliver the
42             ** optimum resolution. The MJD method and the date & time methods
43             ** are both good compromises between resolution and convenience.
44             **
45             ** 2) The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt.
46             **
47             ** 3) The FK5 to Hipparcos transformation is modeled as a pure rotation
48             ** and spin; zonal errors in the FK5 catalogue are not taken into
49             ** account.
50             **
51             ** 4) It was the intention that Hipparcos should be a close
52             ** approximation to an inertial frame, so that distant objects have
53             ** zero proper motion; such objects have (in general) non-zero
54             ** proper motion in FK5, and this function returns those fictitious
55             ** proper motions.
56             **
57             ** 5) The position returned by this function is in the FK5 J2000.0
58             ** reference system but at date date1+date2.
59             **
60             ** 6) See also eraFk52h, eraH2fk5, eraFk5zhz.
61             **
62             ** Called:
63             ** eraS2c spherical coordinates to unit vector
64             ** eraFk5hip FK5 to Hipparcos rotation and spin
65             ** eraRxp product of r-matrix and p-vector
66             ** eraSxp multiply p-vector by scalar
67             ** eraRxr product of two r-matrices
68             ** eraTrxp product of transpose of r-matrix and p-vector
69             ** eraPxp vector product of two p-vectors
70             ** eraPv2s pv-vector to spherical
71             ** eraAnp normalize angle into range 0 to 2pi
72             **
73             ** Reference:
74             **
75             ** F.Mignard & M.Froeschle, 2000, Astron.Astrophys. 354, 732-739.
76             **
77             ** Copyright (C) 2013-2019, NumFOCUS Foundation.
78             ** Derived, with permission, from the SOFA library. See notes at end of file.
79             */
80             {
81             double t, ph[3], r5h[3][3], s5h[3], sh[3], vst[3],
82             rst[3][3], r5ht[3][3], pv5e[2][3], vv[3],
83             w, r, v;
84              
85              
86             /* Time interval from fundamental epoch J2000.0 to given date (JY). */
87 0           t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJY;
88              
89             /* Hipparcos barycentric position vector (normalized). */
90 0           eraS2c(rh, dh, ph);
91              
92             /* FK5 to Hipparcos orientation matrix and spin vector. */
93 0           eraFk5hip(r5h, s5h);
94              
95             /* Rotate the spin into the Hipparcos system. */
96 0           eraRxp(r5h, s5h, sh);
97              
98             /* Accumulated Hipparcos wrt FK5 spin over that interval. */
99 0           eraSxp(t, s5h, vst);
100              
101             /* Express the accumulated spin as a rotation matrix. */
102 0           eraRv2m(vst, rst);
103              
104             /* Rotation matrix: accumulated spin, then FK5 to Hipparcos. */
105 0           eraRxr(r5h, rst, r5ht);
106              
107             /* De-orient & de-spin the Hipparcos position into FK5 J2000.0. */
108 0           eraTrxp(r5ht, ph, pv5e[0]);
109              
110             /* Apply spin to the position giving a space motion. */
111 0           eraPxp(sh, ph, vv);
112              
113             /* De-orient & de-spin the Hipparcos space motion into FK5 J2000.0. */
114 0           eraTrxp(r5ht, vv, pv5e[1]);
115              
116             /* FK5 position/velocity pv-vector to spherical. */
117 0           eraPv2s(pv5e, &w, d5, &r, dr5, dd5, &v);
118 0           *r5 = eraAnp(w);
119              
120 0           return;
121              
122             }
123             /*----------------------------------------------------------------------
124             **
125             **
126             ** Copyright (C) 2013-2019, NumFOCUS Foundation.
127             ** All rights reserved.
128             **
129             ** This library is derived, with permission, from the International
130             ** Astronomical Union's "Standards of Fundamental Astronomy" library,
131             ** available from http://www.iausofa.org.
132             **
133             ** The ERFA version is intended to retain identical functionality to
134             ** the SOFA library, but made distinct through different function and
135             ** file names, as set out in the SOFA license conditions. The SOFA
136             ** original has a role as a reference standard for the IAU and IERS,
137             ** and consequently redistribution is permitted only in its unaltered
138             ** state. The ERFA version is not subject to this restriction and
139             ** therefore can be included in distributions which do not support the
140             ** concept of "read only" software.
141             **
142             ** Although the intent is to replicate the SOFA API (other than
143             ** replacement of prefix names) and results (with the exception of
144             ** bugs; any that are discovered will be fixed), SOFA is not
145             ** responsible for any errors found in this version of the library.
146             **
147             ** If you wish to acknowledge the SOFA heritage, please acknowledge
148             ** that you are using a library derived from SOFA, rather than SOFA
149             ** itself.
150             **
151             **
152             ** TERMS AND CONDITIONS
153             **
154             ** Redistribution and use in source and binary forms, with or without
155             ** modification, are permitted provided that the following conditions
156             ** are met:
157             **
158             ** 1 Redistributions of source code must retain the above copyright
159             ** notice, this list of conditions and the following disclaimer.
160             **
161             ** 2 Redistributions in binary form must reproduce the above copyright
162             ** notice, this list of conditions and the following disclaimer in
163             ** the documentation and/or other materials provided with the
164             ** distribution.
165             **
166             ** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
167             ** the International Astronomical Union nor the names of its
168             ** contributors may be used to endorse or promote products derived
169             ** from this software without specific prior written permission.
170             **
171             ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172             ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
173             ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
174             ** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
175             ** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
176             ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
177             ** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
178             ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
179             ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
180             ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
181             ** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
182             ** POSSIBILITY OF SUCH DAMAGE.
183             **
184             */