1 /*
2 *+
3 * Name:
4 * palMapqkz
5
6 * Purpose:
7 * Quick mean to apparent place.
8
9 * Language:
10 * Starlink ANSI C
11
12 * Type of Module:
13 * Library routine
14
15 * Invocation:
16 * void palMapqkz( double rm, double dm, double amprms[21],
17 * double *ra, double *da )
18
19 * Arguments:
20 * rm = double (Given)
21 * Mean RA (radians).
22 * dm = double (Given)
23 * Mean Dec (radians).
24 * amprms = double[21] (Given)
25 * Star-independent mean-to-apparent parameters (see palMappa):
26 * (0-3) not used
27 * (4-6) not used
28 * (7) not used
29 * (8-10) abv: barycentric Earth velocity in units of c
30 * (11) sqrt(1-v**2) where v=modulus(abv)
31 * (12-20) precession/nutation (3,3) matrix
32 * ra = double * (Returned)
33 * Apparent RA (radians).
34 * da = double * (Returned)
35 * Apparent Dec (radians).
36
37 * Description:
38 * Quick mean to apparent place: transform a star RA,dec from
39 * mean place to geocentric apparent place, given the
40 * star-independent parameters, and assuming zero parallax
41 * and proper motion.
42 *
43 * Use of this function is appropriate when efficiency is important
44 * and where many star positions, all with parallax and proper
45 * motion either zero or already allowed for, and all referred to
46 * the same equator and equinox, are to be transformed for one
47 * epoch. The star-independent parameters can be obtained by
48 * calling the palMappa function.
49 *
50 * The corresponding function for the case of non-zero parallax
51 * and proper motion is palMapqk.
52 *
53 * The reference systems and timescales used are IAU 2006.
54 *
55 * Strictly speaking, the function is not valid for solar-system
56 * sources, though the error will usually be extremely small.
57
58 * Authors:
59 * PTW: Pat Wallace (STFC)
60 * {enter_new_authors_here}
61
62 * History:
63 * 2012-02-13 (PTW):
64 * Initial version.
65 * Adapted with permission from the Fortran SLALIB library.
66 * {enter_further_changes_here}
67
68 * Copyright:
69 * Copyright (C) 1999 Rutherford Appleton Laboratory
70 * Copyright (C) 2012 Science and Technology Facilities Council.
71 * All Rights Reserved.
72
73 * Licence:
74 * This program is free software: you can redistribute it and/or
75 * modify it under the terms of the GNU Lesser General Public
76 * License as published by the Free Software Foundation, either
77 * version 3 of the License, or (at your option) any later
78 * version.
79 *
80 * This program is distributed in the hope that it will be useful,
81 * but WITHOUT ANY WARRANTY; without even the implied warranty of
82 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
83 * GNU Lesser General Public License for more details.
84 *
85 * You should have received a copy of the GNU Lesser General
86 * License along with this program. If not, see
87 * <http://www.gnu.org/licenses/>.
88
89 * Bugs:
90 * {note_any_bugs_here}
91 *-
92 */
93
94 #include "pal.h"
95 #include "pal1sofa.h"
96
palMapqkz(double rm,double dm,double amprms[21],double * ra,double * da)97 void palMapqkz ( double rm, double dm, double amprms[21], double *ra,
98 double *da ){
99
100 /* Local Variables: */
101 int i;
102 double ab1, abv[3], p[3], w, p1dv, p1dvp1, p2[3], p3[3];
103
104 /* Unpack scalar and vector parameters. */
105 ab1 = amprms[11];
106 for( i = 0; i < 3; i++ ) {
107 abv[i] = amprms[i+8];
108 }
109
110 /* Spherical to x,y,z. */
111 eraS2c( rm, dm, p );
112
113 /* Aberration. */
114 p1dv = eraPdp( p, abv );
115 p1dvp1 = p1dv + 1.0;
116 w = 1.0 + p1dv / ( ab1 + 1.0 );
117 for( i = 0; i < 3; i++ ) {
118 p2[i] = ( ( ab1 * p[i] ) + ( w * abv[i] ) ) / p1dvp1;
119 }
120
121 /* Precession and nutation. */
122 eraRxp( (double(*)[3]) &rms[12], p2, p3 );
123
124 /* Geocentric apparent RA,dec. */
125 eraC2s( p3, ra, da );
126 *ra = eraAnp( *ra );
127 }
128