FACT++  1.0
hfk5z.c
Go to the documentation of this file.
1 #include "erfa.h"
2 
3 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-2015, 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 /* Time interval from fundamental epoch J2000.0 to given date (JY). */
86  t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJY;
87 
88 /* Hipparcos barycentric position vector (normalized). */
89  eraS2c(rh, dh, ph);
90 
91 /* FK5 to Hipparcos orientation matrix and spin vector. */
92  eraFk5hip(r5h, s5h);
93 
94 /* Rotate the spin into the Hipparcos system. */
95  eraRxp(r5h, s5h, sh);
96 
97 /* Accumulated Hipparcos wrt FK5 spin over that interval. */
98  eraSxp(t, s5h, vst);
99 
100 /* Express the accumulated spin as a rotation matrix. */
101  eraRv2m(vst, rst);
102 
103 /* Rotation matrix: accumulated spin, then FK5 to Hipparcos. */
104  eraRxr(r5h, rst, r5ht);
105 
106 /* De-orient & de-spin the Hipparcos position into FK5 J2000.0. */
107  eraTrxp(r5ht, ph, pv5e[0]);
108 
109 /* Apply spin to the position giving a space motion. */
110  eraPxp(sh, ph, vv);
111 
112 /* De-orient & de-spin the Hipparcos space motion into FK5 J2000.0. */
113  eraTrxp(r5ht, vv, pv5e[1]);
114 
115 /* FK5 position/velocity pv-vector to spherical. */
116  eraPv2s(pv5e, &w, d5, &r, dr5, dd5, &v);
117  *r5 = eraAnp(w);
118 
119  return;
120 
121 }
122 /*----------------------------------------------------------------------
123 **
124 **
125 ** Copyright (C) 2013-2015, NumFOCUS Foundation.
126 ** All rights reserved.
127 **
128 ** This library is derived, with permission, from the International
129 ** Astronomical Union's "Standards of Fundamental Astronomy" library,
130 ** available from http://www.iausofa.org.
131 **
132 ** The ERFA version is intended to retain identical functionality to
133 ** the SOFA library, but made distinct through different function and
134 ** file names, as set out in the SOFA license conditions. The SOFA
135 ** original has a role as a reference standard for the IAU and IERS,
136 ** and consequently redistribution is permitted only in its unaltered
137 ** state. The ERFA version is not subject to this restriction and
138 ** therefore can be included in distributions which do not support the
139 ** concept of "read only" software.
140 **
141 ** Although the intent is to replicate the SOFA API (other than
142 ** replacement of prefix names) and results (with the exception of
143 ** bugs; any that are discovered will be fixed), SOFA is not
144 ** responsible for any errors found in this version of the library.
145 **
146 ** If you wish to acknowledge the SOFA heritage, please acknowledge
147 ** that you are using a library derived from SOFA, rather than SOFA
148 ** itself.
149 **
150 **
151 ** TERMS AND CONDITIONS
152 **
153 ** Redistribution and use in source and binary forms, with or without
154 ** modification, are permitted provided that the following conditions
155 ** are met:
156 **
157 ** 1 Redistributions of source code must retain the above copyright
158 ** notice, this list of conditions and the following disclaimer.
159 **
160 ** 2 Redistributions in binary form must reproduce the above copyright
161 ** notice, this list of conditions and the following disclaimer in
162 ** the documentation and/or other materials provided with the
163 ** distribution.
164 **
165 ** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
166 ** the International Astronomical Union nor the names of its
167 ** contributors may be used to endorse or promote products derived
168 ** from this software without specific prior written permission.
169 **
170 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
171 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
172 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
173 ** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
174 ** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
175 ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
176 ** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
177 ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
178 ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
179 ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
180 ** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
181 ** POSSIBILITY OF SUCH DAMAGE.
182 **
183 */
#define ERFA_DJ00
Definition: erfam.h:87
void eraPv2s(double pv[2][3], double *theta, double *phi, double *r, double *td, double *pd, double *rd)
Definition: pv2s.c:3
#define ERFA_DJY
Definition: erfam.h:78
void eraHfk5z(double rh, double dh, double date1, double date2, double *r5, double *d5, double *dr5, double *dd5)
Definition: hfk5z.c:3
void eraS2c(double theta, double phi, double c[3])
Definition: s2c.c:3
void eraFk5hip(double r5h[3][3], double s5h[3])
Definition: fk5hip.c:3
void eraRxr(double a[3][3], double b[3][3], double atb[3][3])
Definition: rxr.c:3
void eraPxp(double a[3], double b[3], double axb[3])
Definition: pxp.c:3
void eraRxp(double r[3][3], double p[3], double rp[3])
Definition: rxp.c:3
void eraTrxp(double r[3][3], double p[3], double trp[3])
Definition: trxp.c:3
void eraSxp(double s, double p[3], double sp[3])
Definition: sxp.c:3
void eraRv2m(double w[3], double r[3][3])
Definition: rv2m.c:3
TT t
Definition: test_client.c:26
double eraAnp(double a)
Definition: anp.c:3