Kstars

jupitermoons.cpp
1/*
2 SPDX-FileCopyrightText: 2002 Jason Harris <kstars@30doradus.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "jupitermoons.h"
8
9#include "ksnumbers.h"
10#include "ksplanetbase.h"
11#include "kssun.h"
12#include "trailobject.h"
13
15{
16 //Initialize the Moon objects. The magnitude data are from the
17 //wikipedia articles for each moon, as of Oct 2007.
18 Moon.append(new TrailObject(SkyObject::MOON, 0.0, 0.0, 5.0, i18nc("Jupiter's moon Io", "Io")));
19 Moon.append(new TrailObject(SkyObject::MOON, 0.0, 0.0, 5.3, i18nc("Jupiter's moon Europa", "Europa")));
20 Moon.append(new TrailObject(SkyObject::MOON, 0.0, 0.0, 4.6, i18nc("Jupiter's moon Ganymede", "Ganymede")));
21 Moon.append(new TrailObject(SkyObject::MOON, 0.0, 0.0, 5.7, i18nc("Jupiter's moon Callisto", "Callisto")));
22
23 XP = QVector<double>(4, 0.0);
24 YP = QVector<double>(4, 0.0);
25 ZP = QVector<double>(4, 0.0);
26 InFront = QVector<bool>(4, false);
27}
28
32
33void JupiterMoons::findPosition(const KSNumbers *num, const KSPlanetBase *Jupiter, const KSSun *Sun)
34{
35 double Xj, Yj, Zj, Rj;
36 double sinJB, cosJB, sinJL, cosJL;
37 double sinSB, cosSB, sinSL, cosSL;
38 double D, t, tdelay, LAMBDA, ALPHA;
39 double T, oj, fj, ij, pa, tb, I, P;
40
41 //Satellite position data:
42 //l = mean longitude; Pj = longitude of perijove;
43 //w = long. of the node on Jupiter's equatorial plane
44 //G = Principal inequality in the longitude of Jupiter (whatever that means :)
45 //fl = phase of free libration
46 //z = longitude of node of Jupiter's equator on the ecliptic
47 //Gj/Gs = mean anomalies of Jupiter and Saturn
48 //Pj = Longitude of the perihelion of Jupiter
49 double l1, l2, l3, l4, p1, p2, p3, p4, w1, w2, w3, w4, G, fl, z, Gj, Gs, Pj;
50
51 //L/B = true longitude/latitude of satellites
52 double S1, S2, S3, S4, L1, L2, L3, L4, b1, b2, b3, b4, R1, R2, R3, R4;
53 double X[5], Y[5], Z[5];
54 double A1[5], B1[5], C1[5];
55 double A2[5], B2[5], C2[5];
56 double A3[5], B3[5], C3[5];
57 double A4[5], B4[5], C4[5];
58 double A5[5], B5[5], C5[5];
59 double A6[5], B6[5], C6[5];
60
61 Jupiter->ecLong().SinCos(sinJL, cosJL);
62 Jupiter->ecLat().SinCos(sinJB, cosJB);
63
64 Sun->ecLong().SinCos(sinSL, cosSL);
65 Sun->ecLat().SinCos(sinSB, cosSB);
66
67 //Geocentric Rectangular coordinates of Jupiter:
68 Xj = Jupiter->rsun() * cosJB * cosJL + Sun->rsun() * cosSL;
69 Yj = Jupiter->rsun() * cosJB * sinJL + Sun->rsun() * sinSL;
70 Zj = Jupiter->rsun() * sinJB;
71
72 //Distance and light-travel delay time:
73 //0.0057755183 is the inverse of the speed of light, in days/AU
74 Rj = sqrt(Xj * Xj + Yj * Yj + Zj * Zj);
75 tdelay = 0.0057755183 * Rj; //light travel delay, in days
76
77 LAMBDA = atan2(Yj, Xj);
78 ALPHA = atan2(Zj, sqrt(Xj * Xj + Yj * Yj));
79
80 //days since 10 Aug 1976 0h (minus light-travel delay)
81 t = num->julianDay() - 2443000.5 - tdelay;
82
83 //Mean longitudes of the satellites:
84 l1 = dms(106.07947 + 203.488955432 * t).radians();
85 l2 = dms(175.72938 + 101.374724550 * t).radians();
86 l3 = dms(120.55434 + 50.317609110 * t).radians();
87 l4 = dms(84.44868 + 21.571071314 * t).radians();
88
89 //Longitudes of the satellites' Perijoves (point along orbit nearest to Jupiter)
90 p1 = dms(58.3329 + 0.16103936 * t).radians();
91 p2 = dms(132.8959 + 0.04647985 * t).radians();
92 p3 = dms(187.2887 + 0.00712740 * t).radians();
93 p4 = dms(335.3418 + 0.00183998 * t).radians();
94
95 //Longitudes of the satellites' nodes on the equatorial plane of Jupiter
96 w1 = dms(311.0793 - 0.13279430 * t).radians();
97 w2 = dms(100.5099 - 0.03263047 * t).radians();
98 w3 = dms(119.1688 - 0.00717704 * t).radians();
99 w4 = dms(322.5729 - 0.00175934 * t).radians();
100
101 //Principal inequality in the longitude of Jupiter
102 // G = 0.33033*sin( 163.679 + 0.0010512*t ) + 0.03439*sin( 34.486 - 0.0161731*t );
103 //converted sin args to radians:
104 G = dms(0.33033 * sin(2.85674 + 0.0000183469 * t) + 0.03439 * sin(0.601894 - 0.000282274 * t)).radians();
105
106 //phase of free libration
107 fl = dms(191.8132 + 0.17390023 * t).radians();
108
109 //longitude of Jupiter's equatorial node on the ecliptic
110 z = dms(316.5182 - 0.00000208 * t).radians();
111
112 //Mean anomalies of Jupiter and Saturn
113 Gj = dms(30.23756 + 0.0830925701 * t + G / dms::DegToRad).radians();
114 Gs = dms(31.97853 + 0.0334597339 * t).radians();
115
116 //Longitude of perihelion of Jupiter
117 Pj = dms(13.469942).radians();
118
119 //***Periodic terms in the longitudes of the satellites
120 S1 = 0.47259 * sin(2. * (l1 - l2)) - 0.03480 * sin(p3 - p4) - 0.01756 * sin(p1 + p3 - 2. * Pj - 2. * Gj) +
121 0.01080 * sin(l2 - 2. * l3 + p3) + 0.00757 * sin(fl) + 0.00663 * sin(l2 - 2. * l3 + p4) +
122 0.00453 * sin(l1 - p3) + 0.00453 * sin(l2 - 2. * l3 + p2) - 0.00354 * sin(l1 - l2) -
123 0.00317 * sin(2. * z - 2. * Pj) - 0.00269 * sin(l2 - 2. * l3 + p1) + 0.00263 * sin(l1 - p4) +
124 0.00186 * sin(l1 - p1) - 0.00186 * sin(Gj) + 0.00167 * sin(p2 - p3) + 0.00158 * sin(4. * (l1 - l2)) -
125 0.00155 * sin(l1 - l3) - 0.00142 * sin(z + w3 - 2. * Pj - 2. * Gj) - 0.00115 * sin(2. * (l1 - 2. * l2 + w2)) +
126 0.00089 * sin(p2 - p4) + 0.00084 * sin(w2 - w3) + 0.00084 * sin(l1 + p3 - 2. * Pj - 2. * Gj) +
127 0.00053 * sin(z - w2);
128
129 S2 = 1.06476 * sin(2. * (l2 - l3)) + 0.04253 * sin(l1 - 2. * l2 + p3) + 0.03579 * sin(l2 - p3) +
130 0.02383 * sin(l1 - 2. * l2 + p4) + 0.01977 * sin(l2 - p4) - 0.01843 * sin(fl) + 0.01299 * sin(p3 - p4) -
131 0.01142 * sin(l2 - l3) + 0.01078 * sin(l2 - p2) - 0.01058 * sin(Gj) + 0.00870 * sin(l2 - 2. * l3 + p2) -
132 0.00775 * sin(2. * (z - Pj)) + 0.00524 * sin(2. * (l1 - l2)) - 0.00460 * sin(l1 - l3) +
133 0.00450 * sin(l2 - 2. * l3 + p1) + 0.00327 * sin(z + w3 - 2. * Pj - 2. * Gj) -
134 0.00296 * sin(p1 + p3 - 2. * Pj - 2. * Gj) - 0.00151 * sin(2. * Gj) + 0.00146 * sin(z - w3) +
135 0.00125 * sin(z - w4) - 0.00117 * sin(l1 - 2. * l3 + p3) - 0.00095 * sin(2. * (l2 - w2)) +
136 0.00086 * sin(l1 - 2. * l2 + w2) - 0.00086 * sin(5. * Gs - Gj + 0.911497) - 0.00078 * sin(l2 - l4) -
137 0.00064 * sin(l1 - 2. * l3 + p4) - 0.00063 * sin(3. * l3 - 7. * l4 + 4. * p4) + 0.00061 * sin(p1 - p4) +
138 0.00058 * sin(2. * (z - Pj - Gj)) + 0.00058 * sin(w3 - w4) + 0.00056 * sin(2. * (l2 - l4)) +
139 0.00055 * sin(2. * (l1 - l3)) + 0.00052 * sin(3. * l3 - 7. * l4 + p3 + 3. * p4) - 0.00043 * sin(l1 - p3) +
140 0.00042 * sin(p3 - p2) + 0.00041 * sin(5. * (l2 - l3)) + 0.00041 * sin(p4 - Pj) + 0.00038 * sin(l2 - p1) +
141 0.00032 * sin(w2 - w3) + 0.00032 * sin(2. * (l3 - Gj - Pj)) + 0.00029 * sin(p1 - p3);
142
143 S3 = 0.16477 * sin(l3 - p3) + 0.09062 * sin(l3 - p4) - 0.06907 * sin(l2 - l3) + 0.03786 * sin(p3 - p4) +
144 0.01844 * sin(2. * (l3 - l4)) - 0.01340 * sin(Gj) + 0.00703 * sin(l2 - 2. * l3 + p3) -
145 0.00670 * sin(2. * (z - Pj)) - 0.00540 * sin(l3 - l4) + 0.00481 * sin(p1 + p3 - 2. * Pj - 2. * Gj) -
146 0.00409 * sin(l2 - 2. * l3 + p2) + 0.00379 * sin(l2 - 2. * l3 + p4) + 0.00235 * sin(z - w3) +
147 0.00198 * sin(z - w4) + 0.00180 * sin(fl) + 0.00129 * sin(3. * (l3 - l4)) + 0.00124 * sin(l1 - l3) -
148 0.00119 * sin(5. * Gs - 2. * Gj + 0.911497) + 0.00109 * sin(l1 - l2) -
149 0.00099 * sin(3. * l3 - 7. * l4 + 4. * p4) + 0.00091 * sin(w3 - w4) +
150 0.00081 * sin(3. * l3 - 7. * l4 + p3 + 3. * p4) - 0.00076 * sin(2. * l2 - 3. * l3 + p3) +
151 0.00069 * sin(p4 - Pj) - 0.00058 * sin(2. * l3 - 3. * l4 + p4) + 0.00057 * sin(l3 + p3 - 2. * Pj - 2. * Gj) -
152 0.00057 * sin(l3 - 2. * l4 + p4) - 0.00052 * sin(p2 - p3) - 0.00052 * sin(l2 - 2. * l3 + p1) +
153 0.00048 * sin(l3 - 2. * l4 + p3) - 0.00045 * sin(2. * l2 - 3. * l3 + p4) - 0.00041 * sin(p2 - p4) -
154 0.00038 * sin(2. * Gj) - 0.00033 * sin(p3 - p4 + w3 - w4) -
155 0.00032 * sin(3. * l3 - 7. * l4 + 2. * p3 + 2. * p4) + 0.00030 * sin(4. * (l3 - l4)) -
156 0.00029 * sin(w3 + z - 2. * Pj - 2. * Gj) + 0.00029 * sin(l3 + p4 - 2. * Pj - 2. * Gj) +
157 0.00026 * sin(l3 - Pj - Gj) + 0.00024 * sin(l2 - 3. * l3 + 2. * l4) + 0.00021 * sin(2. * (l3 - Pj - Gj)) -
158 0.00021 * sin(l3 - p2) + 0.00017 * sin(2. * (l3 - p2));
159
160 S4 = 0.84109 * sin(l4 - p4) + 0.03429 * sin(p4 - p3) - 0.03305 * sin(2. * (z - Pj)) - 0.03211 * sin(Gj) -
161 0.01860 * sin(l4 - p3) + 0.01182 * sin(z - w4) + 0.00622 * sin(l4 + p4 - 2. * Gj - 2. * Pj) +
162 0.00385 * sin(2. * (l4 - p4)) - 0.00284 * sin(5. * Gs - 2. * Gj + +0.911497) - 0.00233 * sin(2. * (z - p4)) -
163 0.00223 * sin(l3 - l4) - 0.00208 * sin(l4 - Pj) + 0.00177 * sin(z + w4 - 2. * p4) + 0.00134 * sin(p4 - Pj) +
164 0.00125 * sin(2. * (l4 - Gj - Pj)) - 0.00117 * sin(2. * Gj) - 0.00112 * sin(2. * (l3 - l4)) +
165 0.00106 * sin(3. * l3 - 7. * l4 + 4. * p4) + 0.00102 * sin(l4 - Gj - Pj) + 0.00096 * sin(2. * l4 - z - w4) +
166 0.00087 * sin(2. * (z - w4)) - 0.00087 * sin(3. * l3 - 7. * l4 + p3 + 3. * p4) +
167 0.00085 * sin(l3 - 2. * l4 + p4) - 0.00081 * sin(2. * (l4 - z)) + 0.00071 * sin(l4 + p4 - 2. * Pj - 2. * Gj) +
168 0.00060 * sin(l1 - l4) - 0.00056 * sin(z - w3) - 0.00055 * sin(l3 - 2. * l4 + p3) + 0.00051 * sin(l2 - l4) +
169 0.00042 * sin(2. * (z - Gj - Pj)) + 0.00039 * sin(2. * (p4 - w4)) + 0.00036 * sin(z + Pj - p4 - w4) +
170 0.00035 * sin(2. * Gs - Gj + 3.28767) - 0.00035 * sin(l4 - p4 + 2. * Pj - 2. * z) -
171 0.00032 * sin(l4 + p4 - 2. * Pj - Gj) + 0.00030 * sin(3. * l3 - 7. * l4 + 2. * p3 + 2. * p4) +
172 0.00030 * sin(2. * Gs - 2. * Gj + 2.60316) + 0.00028 * sin(l4 - p4 + 2. * z - 2. * Pj) -
173 0.00028 * sin(2. * (l4 - w4)) - 0.00027 * sin(p3 - p4 + w3 - w4) - 0.00026 * sin(5. * Gs - 3. * Gj + 3.28767) +
174 0.00025 * sin(w4 - w3) - 0.00025 * sin(l2 - 3. * l3 + 2. * l4) - 0.00023 * sin(3. * (l3 - l4)) +
175 0.00021 * sin(2. * l4 - 2. * Pj - 3. * Gj) - 0.00021 * sin(2. * l3 - 3. * l4 + p4) +
176 0.00019 * sin(l4 - p4 - Gj) - 0.00019 * sin(2. * l4 - p4 + Gj) - 0.00018 * sin(l4 - p4 + Gj) -
177 0.00016 * sin(l4 + p3 - 2. * Pj - 2. * Gj);
178
179 //Convert Longitude Sums to Radians:
180 S1 *= dms::DegToRad;
181 S2 *= dms::DegToRad;
182 S3 *= dms::DegToRad;
183 S4 *= dms::DegToRad;
184
185 L1 = l1 + S1;
186 L2 = l2 + S2;
187 L3 = l3 + S3;
188 L4 = l4 + S4;
189
190 //Periodic terms in the latitudes of the satellites
191 tb = 0.0006502 * sin(L1 - w1) + 0.0001835 * sin(L1 - w2) + 0.0000329 * sin(L1 - w3) - 0.0000311 * sin(L1 - z) +
192 0.0000093 * sin(L1 - w4) + 0.0000075 * sin(3. * L1 - 4. * l2 - 1.9927 * S1 + w2) +
193 0.0000046 * sin(L1 + z - 2. * Pj - 2. * Gj);
194 b1 = atan(tb);
195
196 tb = 0.0081275 * sin(L2 - w2) + 0.0004512 * sin(L2 - w3) - 0.0003286 * sin(L2 - z) + 0.0001164 * sin(L2 - w4) +
197 0.0000273 * sin(l1 - 2. * l3 + 1.0146 * S2 + w2) + 0.0000143 * sin(L2 + z - 2. * Pj - 2. * Gj) -
198 0.0000143 * sin(L2 - w1) + 0.0000035 * sin(L2 - z + Gj) - 0.0000028 * sin(l1 - 2. * l3 + 1.0146 * S2 + w3);
199 b2 = atan(tb);
200
201 tb = 0.0032364 * sin(L3 - w3) - 0.0016911 * sin(L3 - z) + 0.0006849 * sin(L3 - w4) - 0.0002806 * sin(L3 - w2) +
202 0.0000321 * sin(L3 + z - 2. * Pj - 2. * Gj) + 0.0000051 * sin(L3 - z + Gj) - 0.0000045 * sin(L3 - z - Gj) -
203 0.0000045 * sin(L3 + z - 2. * Pj) + 0.0000037 * sin(L3 + z - 2. * Pj - 3. * Gj) +
204 0.0000030 * sin(2. * l2 - 3. * L3 + 4.03 * S3 + w2) - 0.0000021 * sin(2. * l2 - 3. * L3 + 4.03 * S3 + w3);
205 b3 = atan(tb);
206
207 tb = -0.0076579 * sin(L4 - z) + 0.0044148 * sin(L4 - w4) - 0.0005106 * sin(L4 - w3) +
208 0.0000773 * sin(L4 + z - 2. * Pj - 2. * Gj) + 0.0000104 * sin(L4 - z + Gj) - 0.0000102 * sin(L4 - z - Gj) +
209 0.0000088 * sin(L4 + z - 2. * Pj - 3. * Gj) - 0.0000038 * sin(L4 + z - 2. * Pj - Gj);
210 b4 = atan(tb);
211
212 //Periodic terms in the Radius of the stellites (distance from Jupiter)
213 R1 = 5.90730 * (1.0 + -0.0041339 * cos(2. * (l1 - l2)) - 0.0000395 * cos(l1 - p3) - 0.0000214 * cos(l1 - p4) +
214 0.0000170 * cos(l1 - l2) - 0.0000162 * cos(l1 - p1) - 0.0000130 * cos(4. * (l1 - l2)) +
215 0.0000106 * cos(l1 - l3) - 0.0000063 * cos(l1 + p3 - 2. * Pj - 2 * Gj));
216
217 R2 = 9.39912 * (1.0 + 0.0093847 * cos(l1 - l2) - 0.0003114 * cos(l2 - p3) - 0.0001738 * cos(l2 - p4) -
218 0.0000941 * cos(l2 - p2) + 0.0000553 * cos(l2 - l3) + 0.0000523 * cos(l1 - l3) -
219 0.0000290 * cos(2. * (l1 - l2)) + 0.0000166 * cos(2. * (l2 - w2)) +
220 0.0000107 * cos(l1 - 2. * l3 + p3) - 0.0000102 * cos(l2 - p1) - 0.0000091 * cos(2. * (l1 - l3)));
221
222 R3 = 14.99240 * (1.0 + -0.0014377 * cos(l3 - p3) - 0.0007904 * cos(l3 - p4) + 0.0006342 * cos(l2 - l3) -
223 0.0001758 * cos(2. * (l3 - l4)) + 0.0000294 * cos(l3 - l4) - 0.0000156 * cos(3. * (l3 - l4)) +
224 0.0000155 * cos(l1 - l3) - 0.0000153 * cos(l1 - l2) + 0.0000070 * cos(2. * l2 - 3. * l3 + p3) -
225 0.0000051 * cos(l3 + p3 - 2. * Pj - 2. * Gj));
226
227 R4 = 26.36990 * (1.0 + -0.0073391 * cos(l4 - p4) + 0.0001620 * cos(l4 - p3) + 0.0000974 * cos(l3 - l4) -
228 0.0000541 * cos(l4 + p4 - 2. * Pj - 2. * Gj) - 0.0000269 * cos(2. * (l4 - p4)) +
229 0.0000182 * cos(l4 - Pj) + 0.0000177 * cos(2. * (l3 - l4)) - 0.0000167 * cos(2. * l4 - z - w4) +
230 0.0000167 * cos(z - w4) - 0.0000155 * cos(2. * (l4 - Pj - Gj)) + 0.0000142 * cos(2. * (l4 - z)) +
231 0.0000104 * cos(l1 - l4) + 0.0000092 * cos(l2 - l4) - 0.0000089 * cos(l4 - Pj - Gj) -
232 0.0000062 * cos(l4 + p4 - 2. * Pj - 3. * Gj) + 0.0000048 * cos(2. * (l4 - w4)));
233
234 //Inclination of Jupiter's rotational axis since 1900.0
235 t = (num->julianDay() - 2415020.50) / 36525.0;
236 I = dms(3.120262 + 0.0006 * t).radians();
237
238 //Precession since B1950:
239 t = (num->julianDay() - 2433282.423) / 36525.0;
240 P = dms(1.3966626 * t + 0.0003088 * t * t).radians();
241
242 L1 += P;
243 L2 += P;
244 L3 += P;
245 L4 += P;
246 z += P;
247
248 X[0] = R1 * cos(L1 - z) * cos(b1);
249 X[1] = R2 * cos(L2 - z) * cos(b2);
250 X[2] = R3 * cos(L3 - z) * cos(b3);
251 X[3] = R4 * cos(L4 - z) * cos(b4);
252 Y[0] = R1 * sin(L1 - z) * cos(b1);
253 Y[1] = R2 * sin(L2 - z) * cos(b2);
254 Y[2] = R3 * sin(L3 - z) * cos(b3);
255 Y[3] = R4 * sin(L4 - z) * cos(b4);
256 Z[0] = R1 * sin(b1);
257 Z[1] = R2 * sin(b2);
258 Z[2] = R3 * sin(b3);
259 Z[3] = R4 * sin(b4);
260
261 //fictional "fifth moon" used later...
262 X[4] = 0.0;
263 Y[4] = 0.0;
264 Z[4] = 1.0;
265
266 T = num->julianCenturies();
267
268 oj = dms(100.464441 + 1.0209550 * T + 0.00040117 * T * T + 0.000000569 * T * T * T).radians();
269 fj = z - oj;
270 ij = dms(1.303270 - 0.0054966 * T + 0.00000465 * T * T - 0.000000004 * T * T * T).radians();
271
272 for (int i = 0; i < 5; ++i)
273 {
274 A1[i] = X[i];
275 B1[i] = Y[i] * cos(I) - Z[i] * sin(I);
276 C1[i] = Y[i] * sin(I) + Z[i] * cos(I);
277
278 A2[i] = A1[i] * cos(fj) - B1[i] * sin(fj);
279 B2[i] = A1[i] * sin(fj) + B1[i] * cos(fj);
280 C2[i] = C1[i];
281
282 A3[i] = A2[i];
283 B3[i] = B2[i] * cos(ij) - C2[i] * sin(ij);
284 C3[i] = B2[i] * sin(ij) + C2[i] * cos(ij);
285
286 A4[i] = A3[i] * cos(oj) - B3[i] * sin(oj);
287 B4[i] = A3[i] * sin(oj) + B3[i] * cos(oj);
288 C4[i] = C3[i];
289
290 A5[i] = A4[i] * sin(LAMBDA) - B4[i] * cos(LAMBDA);
291 B5[i] = A4[i] * cos(LAMBDA) + B4[i] * sin(LAMBDA);
292 C5[i] = C4[i];
293
294 A6[i] = A5[i];
295 B6[i] = C5[i] * sin(ALPHA) + B5[i] * cos(ALPHA);
296 C6[i] = C5[i] * cos(ALPHA) - B5[i] * sin(ALPHA);
297
298 /* DEBUG
299 qDebug() << Q_FUNC_INFO <<"A: "<<i<<": "<<A1[i]<<": "<<A2[i]<<": "<<A3[i]<<": "<<A4[i]<<": "<<A5[i]<<": "<<A6[i];
300 qDebug() << Q_FUNC_INFO <<"B: "<<i<<": "<<B1[i]<<": "<<B2[i]<<": "<<B3[i]<<": "<<B4[i]<<": "<<B5[i]<<": "<<B6[i];
301 qDebug() << Q_FUNC_INFO <<"C: "<<i<<": "<<C1[i]<<": "<<C2[i]<<": "<<C3[i]<<": "<<C4[i]<<": "<<C5[i]<<": "<<C6[i];
302 */
303 }
304
305 D = atan2(A6[4], C6[4]);
306
307 //X and Y are now the rectangular coordinates of each satellite,
308 //in units of Jupiter's Equatorial radius.
309 //When Z is negative, the planet is nearer to the Sun than Jupiter.
310
311 pa = Jupiter->pa() * dms::PI / 180.0;
312
313 for (int i = 0; i < 4; ++i)
314 {
315 XP[i] = A6[i] * cos(D) - C6[i] * sin(D);
316 YP[i] = A6[i] * sin(D) + C6[i] * cos(D);
317 ZP[i] = B6[i];
318
319 Moon[i]->setRA(Jupiter->ra().Hours() - 0.011 * (XP[i] * cos(pa) - YP[i] * sin(pa)) / 15.0);
320 Moon[i]->setDec(Jupiter->dec().Degrees() - 0.011 * (XP[i] * sin(pa) + YP[i] * cos(pa)));
321
322 //SkyPoint p = Moon[i]->deprecess(
323 // num); // FIXME: Really, we should also denutate. Actually, we should also be aberrating these above, right?
324 SkyPoint p = Moon[i]->catalogueCoord(num->julianDay());
325 Moon[i]->setRA0(
326 p.ra()); // Just to be sure, in case deprecess doesn't set it already because RA0 was not NaN or something.
327 Moon[i]->setDec0(p.dec());
328
329 if (ZP[i] < 0.0)
330 InFront[i] = true;
331 else
332 InFront[i] = false;
333
334 //Update Trails
335 if (Moon[i]->hasTrail())
336 {
337 Moon[i]->addToTrail();
338 if (Moon[i]->trail().size() > TrailObject::MaxTrail)
339 Moon[i]->clipTrail();
340 }
341 }
342}
JupiterMoons()
Constructor.
void findPosition(const KSNumbers *num, const KSPlanetBase *jup, const KSSun *sunptr) override
Find the positions of each Moon, relative to Jupiter.
~JupiterMoons() override
Destructor.
There are several time-dependent values used in position calculations, that are not specific to an ob...
Definition ksnumbers.h:43
double julianCenturies() const
Definition ksnumbers.h:88
long double julianDay() const
Definition ksnumbers.h:91
A subclass of TrailObject that provides additional information needed for most solar system objects.
const dms & ecLat() const
const dms & ecLong() const
double pa() const override
double rsun() const
Child class of KSPlanetBase; encapsulates information about the Sun.
Definition kssun.h:24
double z(int i) const
const CachingDms & dec() const
Definition skypoint.h:269
const CachingDms & ra() const
Definition skypoint.h:263
provides a SkyObject with an attachable Trail
Definition trailobject.h:22
static const int MaxTrail
Maximum trail size.
Definition trailobject.h:66
static constexpr double PI
PI is a const static member; it's public so that it can be used anywhere, as long as dms....
Definition dms.h:385
static constexpr double DegToRad
DegToRad is a const static member equal to the number of radians in one degree (dms::PI/180....
Definition dms.h:390
QString i18nc(const char *context, const char *text, const TYPE &arg...)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:57:49 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.