1 #include "erfa.h"
2 
eraH2fk5(double rh,double dh,double drh,double ddh,double pxh,double rvh,double * r5,double * d5,double * dr5,double * dd5,double * px5,double * rv5)3 void eraH2fk5(double rh, double dh,
4               double drh, double ddh, double pxh, double rvh,
5               double *r5, double *d5,
6               double *dr5, double *dd5, double *px5, double *rv5)
7 /*
8 **  - - - - - - - - -
9 **   e r a H 2 f k 5
10 **  - - - - - - - - -
11 **
12 **  Transform Hipparcos star data into the FK5 (J2000.0) system.
13 **
14 **  Given (all Hipparcos, epoch J2000.0):
15 **     rh      double    RA (radians)
16 **     dh      double    Dec (radians)
17 **     drh     double    proper motion in RA (dRA/dt, rad/Jyear)
18 **     ddh     double    proper motion in Dec (dDec/dt, rad/Jyear)
19 **     pxh     double    parallax (arcsec)
20 **     rvh     double    radial velocity (km/s, positive = receding)
21 **
22 **  Returned (all FK5, equinox J2000.0, epoch J2000.0):
23 **     r5      double    RA (radians)
24 **     d5      double    Dec (radians)
25 **     dr5     double    proper motion in RA (dRA/dt, rad/Jyear)
26 **     dd5     double    proper motion in Dec (dDec/dt, rad/Jyear)
27 **     px5     double    parallax (arcsec)
28 **     rv5     double    radial velocity (km/s, positive = receding)
29 **
30 **  Notes:
31 **
32 **  1) This function transforms Hipparcos star positions and proper
33 **     motions into FK5 J2000.0.
34 **
35 **  2) The proper motions in RA are dRA/dt rather than
36 **     cos(Dec)*dRA/dt, and are per year rather than per century.
37 **
38 **  3) The FK5 to Hipparcos transformation is modeled as a pure
39 **     rotation and spin;  zonal errors in the FK5 catalog are not
40 **     taken into account.
41 **
42 **  4) See also eraFk52h, eraFk5hz, eraHfk5z.
43 **
44 **  Called:
45 **     eraStarpv    star catalog data to space motion pv-vector
46 **     eraFk5hip    FK5 to Hipparcos rotation and spin
47 **     eraRv2m      r-vector to r-matrix
48 **     eraRxp       product of r-matrix and p-vector
49 **     eraTrxp      product of transpose of r-matrix and p-vector
50 **     eraPxp       vector product of two p-vectors
51 **     eraPmp       p-vector minus p-vector
52 **     eraPvstar    space motion pv-vector to star catalog data
53 **
54 **  Reference:
55 **
56 **     F.Mignard & M.Froeschle, Astron. Astrophys. 354, 732-739 (2000).
57 **
58 **  Copyright (C) 2013-2014, NumFOCUS Foundation.
59 **  Derived, with permission, from the SOFA library.  See notes at end of file.
60 */
61 {
62    int i;
63    double pvh[2][3], r5h[3][3], s5h[3], sh[3], wxp[3], vv[3], pv5[2][3];
64 
65 
66 /* Hipparcos barycentric position/velocity pv-vector (normalized). */
67    eraStarpv(rh, dh, drh, ddh, pxh, rvh, pvh);
68 
69 /* FK5 to Hipparcos orientation matrix and spin vector. */
70    eraFk5hip(r5h, s5h);
71 
72 /* Make spin units per day instead of per year. */
73    for ( i = 0; i < 3; s5h[i++] /= 365.25 );
74 
75 /* Orient the spin into the Hipparcos system. */
76    eraRxp(r5h, s5h, sh);
77 
78 /* De-orient the Hipparcos position into the FK5 system. */
79    eraTrxp(r5h, pvh[0], pv5[0]);
80 
81 /* Apply spin to the position giving an extra space motion component. */
82    eraPxp(pvh[0], sh, wxp);
83 
84 /* Subtract this component from the Hipparcos space motion. */
85    eraPmp(pvh[1], wxp, vv);
86 
87 /* De-orient the Hipparcos space motion into the FK5 system. */
88    eraTrxp(r5h, vv, pv5[1]);
89 
90 /* FK5 pv-vector to spherical. */
91    eraPvstar(pv5, r5, d5, dr5, dd5, px5, rv5);
92 
93    return;
94 
95 }
96 /*----------------------------------------------------------------------
97 **
98 **
99 **  Copyright (C) 2013-2014, NumFOCUS Foundation.
100 **  All rights reserved.
101 **
102 **  This library is derived, with permission, from the International
103 **  Astronomical Union's "Standards of Fundamental Astronomy" library,
104 **  available from http://www.iausofa.org.
105 **
106 **  The ERFA version is intended to retain identical functionality to
107 **  the SOFA library, but made distinct through different function and
108 **  file names, as set out in the SOFA license conditions.  The SOFA
109 **  original has a role as a reference standard for the IAU and IERS,
110 **  and consequently redistribution is permitted only in its unaltered
111 **  state.  The ERFA version is not subject to this restriction and
112 **  therefore can be included in distributions which do not support the
113 **  concept of "read only" software.
114 **
115 **  Although the intent is to replicate the SOFA API (other than
116 **  replacement of prefix names) and results (with the exception of
117 **  bugs;  any that are discovered will be fixed), SOFA is not
118 **  responsible for any errors found in this version of the library.
119 **
120 **  If you wish to acknowledge the SOFA heritage, please acknowledge
121 **  that you are using a library derived from SOFA, rather than SOFA
122 **  itself.
123 **
124 **
125 **  TERMS AND CONDITIONS
126 **
127 **  Redistribution and use in source and binary forms, with or without
128 **  modification, are permitted provided that the following conditions
129 **  are met:
130 **
131 **  1 Redistributions of source code must retain the above copyright
132 **    notice, this list of conditions and the following disclaimer.
133 **
134 **  2 Redistributions in binary form must reproduce the above copyright
135 **    notice, this list of conditions and the following disclaimer in
136 **    the documentation and/or other materials provided with the
137 **    distribution.
138 **
139 **  3 Neither the name of the Standards Of Fundamental Astronomy Board,
140 **    the International Astronomical Union nor the names of its
141 **    contributors may be used to endorse or promote products derived
142 **    from this software without specific prior written permission.
143 **
144 **  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
145 **  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
146 **  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
147 **  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
148 **  COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
149 **  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
150 **  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
151 **  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
152 **  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
153 **  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
154 **  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
155 **  POSSIBILITY OF SUCH DAMAGE.
156 **
157 */
158