1 | #include "slalib.h"
|
---|
2 | #include "slamac.h"
|
---|
3 | void slaPlante ( double date, double elong, double phi, int jform,
|
---|
4 | double epoch, double orbinc, double anode, double perih,
|
---|
5 | double aorq, double e, double aorl, double dm,
|
---|
6 | double* ra, double* dec, double* r, int* jstat )
|
---|
7 | /*
|
---|
8 | ** - - - - - - - - - -
|
---|
9 | ** s l a P l a n t e
|
---|
10 | ** - - - - - - - - - -
|
---|
11 | **
|
---|
12 | ** Topocentric apparent RA,Dec of a Solar-System object whose
|
---|
13 | ** heliocentric orbital elements are known.
|
---|
14 | **
|
---|
15 | ** Given:
|
---|
16 | ** date double MJD of observation (JD - 2400000.5)
|
---|
17 | ** elong double observer's east longitude (radians)
|
---|
18 | ** phi double observer's geodetic latitude (radians)
|
---|
19 | ** jform int choice of element set (1-3; Note 2)
|
---|
20 | ** epoch double epoch of elements (TT MJD)
|
---|
21 | ** orbinc double inclination (radians)
|
---|
22 | ** anode double longitude of the ascending node (radians)
|
---|
23 | ** perih double longitude or argument of perihelion (radians)
|
---|
24 | ** aorq double mean distance or perihelion distance (AU)
|
---|
25 | ** e double eccentricity
|
---|
26 | ** aorl double mean anomaly or longitude (radians, jform=1,2 only)
|
---|
27 | ** dm double daily motion (radians, jform=1 only )
|
---|
28 | **
|
---|
29 | ** Returned:
|
---|
30 | ** ra,dec double RA, Dec (topocentric apparent, radians)
|
---|
31 | ** r double distance from observer (AU)
|
---|
32 | ** jstat int status: 0 = OK
|
---|
33 | ** -1 = illegal jform
|
---|
34 | ** -2 = illegal e
|
---|
35 | ** -3 = illegal aorq
|
---|
36 | ** -4 = illegal dm
|
---|
37 | ** -5 = numerical error
|
---|
38 | **
|
---|
39 | ** Notes:
|
---|
40 | **
|
---|
41 | ** 1 date is the instant for which the prediction is required.
|
---|
42 | ** It is in the TT timescale (formerly Ephemeris Time, ET)
|
---|
43 | ** and is a Modified Julian Date (JD-2400000.5).
|
---|
44 | **
|
---|
45 | ** 2 The longitude and latitude allow correction for geocentric
|
---|
46 | ** parallax. This is usually a small effect, but can become
|
---|
47 | ** important for Earth-crossing asteroids. Geocentric positions
|
---|
48 | ** can be generated by appropriate use of the routines slaEvp and
|
---|
49 | ** slaPlanel.
|
---|
50 | **
|
---|
51 | ** 3 The elements are with respect to the J2000 ecliptic and equinox.
|
---|
52 | **
|
---|
53 | ** 4 Three different element-format options are available:
|
---|
54 | **
|
---|
55 | ** Option jform=1, suitable for the major planets:
|
---|
56 | **
|
---|
57 | ** epoch = epoch of elements (TT MJD)
|
---|
58 | ** orbinc = inclination i (radians)
|
---|
59 | ** anode = longitude of the ascending node, big omega (radians)
|
---|
60 | ** perih = longitude of perihelion, curly pi (radians)
|
---|
61 | ** aorq = mean distance, a (AU)
|
---|
62 | ** e = eccentricity, e
|
---|
63 | ** aorl = mean longitude L (radians)
|
---|
64 | ** dm = daily motion (radians)
|
---|
65 | **
|
---|
66 | ** Option jform=2, suitable for minor planets:
|
---|
67 | **
|
---|
68 | ** epoch = epoch of elements (TT MJD)
|
---|
69 | ** orbinc = inclination i (radians)
|
---|
70 | ** anode = longitude of the ascending node, big omega (radians)
|
---|
71 | ** perih = argument of perihelion, little omega (radians)
|
---|
72 | ** aorq = mean distance, a (AU)
|
---|
73 | ** e = eccentricity, e
|
---|
74 | ** aorl = mean anomaly M (radians)
|
---|
75 | **
|
---|
76 | ** Option jform=3, suitable for comets:
|
---|
77 | **
|
---|
78 | ** epoch = epoch of perihelion (TT MJD)
|
---|
79 | ** orbinc = inclination i (radians)
|
---|
80 | ** anode = longitude of the ascending node, big omega (radians)
|
---|
81 | ** perih = argument of perihelion, little omega (radians)
|
---|
82 | ** aorq = perihelion distance, q (AU)
|
---|
83 | ** e = eccentricity, e
|
---|
84 | **
|
---|
85 | ** 5 Unused elements (dm for jform=2, aorl and dm for jform=3) are
|
---|
86 | ** not accessed.
|
---|
87 | **
|
---|
88 | ** Called: slaGmst, slaDt, slaEpj, slaPvobs, slaPrenut,
|
---|
89 | ** slaPlanel, slaDmxv, slaDcc2s, slaDranrm
|
---|
90 | **
|
---|
91 | ** Last revision: 17 March 1999
|
---|
92 | **
|
---|
93 | ** Copyright P.T.Wallace. All rights reserved.
|
---|
94 | */
|
---|
95 |
|
---|
96 | /* Light time for unit distance (sec) */
|
---|
97 | #define TAU 499.004782
|
---|
98 |
|
---|
99 | {
|
---|
100 | int i;
|
---|
101 | double dvb[3], dpb[3], vsg[6], vsp[6], v[6],
|
---|
102 | rmat[3][3], vgp[6], stl, vgo[6],
|
---|
103 | dx, dy, dz, tl;
|
---|
104 |
|
---|
105 |
|
---|
106 | /* Sun to geocentre (J2000). */
|
---|
107 | slaEvp( date, 2000.0, dvb, dpb, &vsg[3], &vsg[0] );
|
---|
108 |
|
---|
109 | /* Sun to planet (J2000). */
|
---|
110 | slaPlanel ( date, jform, epoch, orbinc, anode, perih, aorq,
|
---|
111 | e, aorl, dm, vsp, jstat );
|
---|
112 |
|
---|
113 | /* Geocentre to planet (J2000). */
|
---|
114 | for ( i = 0; i < 6; i++ ) {
|
---|
115 | v[i] = vsp[i] - vsg[i];
|
---|
116 | }
|
---|
117 |
|
---|
118 | /* Precession and nutation to date. */
|
---|
119 | slaPrenut ( 2000.0, date, rmat );
|
---|
120 | slaDmxv ( rmat, v, vgp );
|
---|
121 | slaDmxv ( rmat, &v[3], &vgp[3] );
|
---|
122 |
|
---|
123 | /* Geocentre to observer (date). */
|
---|
124 | stl = slaGmst ( date - slaDt ( slaEpj ( date ) ) / 86400.0 ) + elong;
|
---|
125 | slaPvobs ( phi, 0.0, stl, vgo );
|
---|
126 |
|
---|
127 | /* Observer to planet (date). */
|
---|
128 | for ( i = 0; i < 6; i++ ) {
|
---|
129 | v[i] = vgp[i] - vgo[i];
|
---|
130 | }
|
---|
131 |
|
---|
132 | /* Geometric distance (AU). */
|
---|
133 | dx = v[0];
|
---|
134 | dy = v[1];
|
---|
135 | dz = v[2];
|
---|
136 | *r = sqrt ( dx * dx + dy * dy + dz * dz );
|
---|
137 |
|
---|
138 | /* Light time (sec). */
|
---|
139 | tl = *r * TAU;
|
---|
140 |
|
---|
141 | /* Correct position for planetary aberration. */
|
---|
142 | for ( i = 0; i < 3; i++ ) {
|
---|
143 | v[i] = v[i] - tl * v[i+3];
|
---|
144 | }
|
---|
145 |
|
---|
146 | /* To RA,Dec. */
|
---|
147 | slaDcc2s ( v, ra, dec );
|
---|
148 | *ra = slaDranrm ( *ra );
|
---|
149 | return;
|
---|
150 | }
|
---|