source: trunk/FACT++/pal/palMapqk.c@ 18403

Last change on this file since 18403 was 18347, checked in by tbretz, 9 years ago
File size: 4.6 KB
Line 
1/*
2*+
3* Name:
4* palMapqk
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 palMapqk ( double rm, double dm, double pr, double pd,
17* double px, double rv, double amprms[21],
18* double *ra, double *da );
19
20* Arguments:
21* rm = double (Given)
22* Mean RA (radians)
23* dm = double (Given)
24* Mean declination (radians)
25* pr = double (Given)
26* RA proper motion, changes per Julian year (radians)
27* pd = double (Given)
28* Dec proper motion, changes per Julian year (radians)
29* px = double (Given)
30* Parallax (arcsec)
31* rv = double (Given)
32* Radial velocity (km/s, +ve if receding)
33* amprms = double [21] (Given)
34* Star-independent mean-to-apparent parameters (see palMappa).
35* ra = double * (Returned)
36* Apparent RA (radians)
37* dec = double * (Returned)
38* Apparent dec (radians)
39
40* Description:
41* Quick mean to apparent place: transform a star RA,Dec from
42* mean place to geocentric apparent place, given the
43* star-independent parameters.
44*
45* Use of this routine is appropriate when efficiency is important
46* and where many star positions, all referred to the same equator
47* and equinox, are to be transformed for one epoch. The
48* star-independent parameters can be obtained by calling the
49* palMappa routine.
50*
51* If the parallax and proper motions are zero the palMapqkz
52* routine can be used instead.
53
54* Authors:
55* PTW: Patrick T. Wallace
56* TIMJ: Tim Jenness (JAC, Hawaii)
57* {enter_new_authors_here}
58
59* Notes:
60* - The reference frames and timescales used are post IAU 2006.
61
62* History:
63* 2012-03-01 (TIMJ):
64* Initial version with documentation from SLA/F
65* Adapted with permission from the Fortran SLALIB library.
66* {enter_further_changes_here}
67
68* Copyright:
69* Copyright (C) 2000 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 General Public License as
76* published by the Free Software Foundation; either version 3 of
77* the License, or (at your option) any later version.
78*
79* This program is distributed in the hope that it will be
80* useful, but WITHOUT ANY WARRANTY; without even the implied
81* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
82* PURPOSE. See the GNU General Public License for more details.
83*
84* You should have received a copy of the GNU General Public License
85* along with this program; if not, write to the Free Software
86* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
87* MA 02110-1301, USA.
88
89* Bugs:
90* {note_any_bugs_here}
91*-
92*/
93
94#include "pal.h"
95#include "palmac.h"
96#include "pal1sofa.h"
97
98void palMapqk ( double rm, double dm, double pr, double pd,
99 double px, double rv, double amprms[21],
100 double *ra, double *da ) {
101
102/* local constants */
103 const double VF = 0.21094502; /* Km/s to AU/year */
104
105/* Local Variables: */
106 int i;
107 double ab1, abv[3], p[3], w, p1dv, p2[3], p3[3];
108 double pmt, gr2e, eb[3], q[3], pxr, em[3];
109 double pde, pdep1, p1[3], ehn[3], pn[3];
110
111/* Unpack scalar and vector parameters. */
112 pmt = amprms[0];
113 gr2e = amprms[7];
114 ab1 = amprms[11];
115 for( i = 0; i < 3; i++ ) {
116 eb[i] = amprms[i+1];
117 ehn[i] = amprms[i+4];
118 abv[i] = amprms[i+8];
119 }
120
121/* Spherical to x,y,z. */
122 eraS2c( rm, dm, q);
123
124 /* Space motion (radians per year) */
125 pxr = px * PAL__DAS2R;
126 w = VF * rv * pxr;
127 em[0] = -pr * q[1] - pd * cos(rm) * sin(dm) + w * q[0];
128 em[1] = pr * q[0] - pd * sin(rm) * sin(dm) + w * q[1];
129 em[2] = pd * cos(dm) + w * q[2];
130
131/* Geocentric direction of star (normalised) */
132 for( i = 0; i < 3; i++ ) {
133 p[i] = q[i] + pmt * em[i] - pxr * eb[i];
134 }
135 eraPn( p, &w, pn );
136
137/* Light deflection (restrained within the Sun's disc) */
138 pde = eraPdp( pn, ehn );
139 pdep1 = pde + 1.0;
140 w = gr2e / ( pdep1 > 1.0e-5 ? pdep1 : 1.0e-5 );
141 for( i = 0; i < 3; i++) {
142 p1[i] = pn[i] + w * ( ehn[i] - pde * pn[i] );
143 }
144
145/* Aberration (normalisation omitted). */
146 p1dv = eraPdp( p, abv );
147 w = 1.0 + p1dv / ( ab1 + 1.0 );
148 for( i = 0; i < 3; i++ ) {
149 p2[i] = ( ab1 * p1[i] ) + ( w * abv[i] );
150 }
151
152/* Precession and nutation. */
153 eraRxp( (double(*)[3]) &amprms[12], p2, p3 );
154
155/* Geocentric apparent RA,dec. */
156 eraC2s( p3, ra, da );
157 *ra = eraAnp( *ra );
158
159}
Note: See TracBrowser for help on using the repository browser.