Merge lp:~stellarium/stellarium/fix-DeltaT into lp:stellarium

Proposed by gzotti
Status: Merged
Approved by: Alexander Wolf
Approved revision: 7754
Merged at revision: 7760
Proposed branch: lp:~stellarium/stellarium/fix-DeltaT
Merge into: lp:stellarium
Diff against target: 3522 lines (+693/-585)
59 files modified
plugins/AngleMeasure/src/AngleMeasure.hpp (+5/-3)
plugins/ArchaeoLines/src/ArchaeoLines.cpp (+11/-5)
plugins/ArchaeoLines/src/ArchaeoLines.hpp (+1/-1)
plugins/EquationOfTime/src/EquationOfTime.cpp (+12/-10)
plugins/EquationOfTime/src/EquationOfTime.hpp (+2/-2)
plugins/Exoplanets/src/Exoplanet.cpp (+1/-1)
plugins/MeteorShowers/src/MeteorShower.cpp (+3/-3)
plugins/MeteorShowers/src/MeteorShowers.cpp (+4/-3)
plugins/MeteorShowers/src/gui/MeteorShowerDialog.cpp (+2/-1)
plugins/Novae/src/Nova.cpp (+1/-1)
plugins/Novae/src/Nova.hpp (+5/-0)
plugins/Observability/src/Observability.cpp (+121/-99)
plugins/Observability/src/Observability.hpp (+25/-18)
plugins/PointerCoordinates/src/PointerCoordinates.cpp (+2/-2)
plugins/Satellites/src/Satellite.cpp (+2/-3)
plugins/Satellites/src/Satellites.cpp (+1/-1)
plugins/Satellites/src/gSatWrapper.cpp (+1/-1)
plugins/Satellites/src/gsatellite/gVector.cpp (+1/-1)
plugins/Satellites/src/gsatellite/gVector.hpp (+3/-2)
plugins/Scenery3d/src/Scenery3d.cpp (+3/-3)
plugins/Supernovae/src/Supernova.cpp (+1/-1)
plugins/TelescopeControl/src/clients/TelescopeClient.cpp (+4/-2)
plugins/TelescopeControl/src/servers/Socket.cpp (+4/-2)
plugins/TextUserInterface/src/TextUserInterface.cpp (+3/-3)
src/core/StelCore.cpp (+147/-111)
src/core/StelCore.hpp (+54/-26)
src/core/StelMovementMgr.cpp (+3/-3)
src/core/StelMovementMgr.hpp (+1/-1)
src/core/StelObject.cpp (+5/-12)
src/core/StelObserver.cpp (+6/-12)
src/core/StelObserver.hpp (+4/-1)
src/core/StelUtils.hpp (+1/-1)
src/core/TrailGroup.cpp (+3/-3)
src/core/modules/Atmosphere.cpp (+1/-1)
src/core/modules/Comet.cpp (+12/-12)
src/core/modules/Comet.hpp (+2/-6)
src/core/modules/Constellation.cpp (+1/-1)
src/core/modules/LandscapeMgr.cpp (+2/-1)
src/core/modules/MinorPlanet.cpp (+3/-3)
src/core/modules/Orbit.cpp (+17/-26)
src/core/modules/Orbit.hpp (+7/-7)
src/core/modules/Planet.cpp (+61/-58)
src/core/modules/Planet.hpp (+17/-15)
src/core/modules/SolarSystem.cpp (+10/-8)
src/core/modules/SolarSystem.hpp (+3/-3)
src/core/modules/StarWrapper.cpp (+1/-1)
src/core/modules/StarWrapper.hpp (+1/-1)
src/core/modules/ZodiacalLight.cpp (+1/-1)
src/core/modules/ZoneArray.cpp (+2/-2)
src/core/planetsephems/sidereal_time.c (+10/-10)
src/core/planetsephems/sidereal_time.h (+2/-2)
src/gui/ConfigurationDialog.cpp (+4/-2)
src/gui/DateTimeDialog.cpp (+16/-23)
src/gui/SearchDialog.cpp (+1/-1)
src/gui/StelGui.cpp (+1/-1)
src/gui/StelGuiItems.cpp (+20/-22)
src/gui/dateTimeDialogGui.ui (+3/-3)
src/scripting/StelMainScriptAPI.cpp (+37/-26)
src/scripting/StelMainScriptAPI.hpp (+16/-11)
To merge this branch: bzr merge lp:~stellarium/stellarium/fix-DeltaT
Reviewer Review Type Date Requested Status
Alexander Wolf Approve
Review via email: mp+266675@code.launchpad.net

Description of the change

See branch description, also on tests. The branch untangles applications of DeltaT, it should be clear now what flavour of JD to use in which situation.

I have placed comments in many places which have changed. These will go away during merge when no longer needed. There are very few cases in the "object plugins" (Supernovae, pulsars, ...) where it is not clear to me which kind of JD (JD or JDE) was in the original catalog for discovery date. Most likely these cases are JDE (as was also in use via the previous getJDay() call).

To post a comment you must log in.
Revision history for this message
Alexander Wolf (alexwolf) wrote :

I think it ready to merge

review: Approve
lp:~stellarium/stellarium/fix-DeltaT updated
7755. By gzotti

most explanatory pre-review comments removed before merge. A few have to stay in, explain open questions for plugin authors!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/AngleMeasure/src/AngleMeasure.hpp'
2--- plugins/AngleMeasure/src/AngleMeasure.hpp 2015-05-31 09:35:00 +0000
3+++ plugins/AngleMeasure/src/AngleMeasure.hpp 2015-08-03 13:17:13 +0000
4@@ -34,8 +34,10 @@
5 /*! @defgroup angleMeasure Angle Measure plug-in
6 @{
7 The Angle Measure plugin is a small tool which is used to measure
8-the angular distance between two points on the sky. *goes misty eyed*
9-I recall measuring the size of the Cassini Division when I was a student.
10+the angular distance between two points on the sky.
11+
12+*goes misty eyed* I recall measuring the size of the Cassini Division
13+when I was a student.
14 It was not the high academic glamor one might expect... It was cloudy...
15 It was rainy... The observatory lab had some old scopes set up at one end,
16 pointing at a photograph of Saturn at the other end of the lab. We measured.
17@@ -64,7 +66,7 @@
18 //! Main class of the Angle Measure plug-in.
19 //! @author Matthew Gates
20 //! @author Alexander Wolf
21-//! @anchor Georg Zotti
22+//! @author Georg Zotti
23 class AngleMeasure : public StelModule
24 {
25 Q_OBJECT
26
27=== modified file 'plugins/ArchaeoLines/src/ArchaeoLines.cpp'
28--- plugins/ArchaeoLines/src/ArchaeoLines.cpp 2015-05-16 10:23:09 +0000
29+++ plugins/ArchaeoLines/src/ArchaeoLines.cpp 2015-08-03 13:17:13 +0000
30@@ -79,7 +79,7 @@
31 , flagShowCurrentSun(false)
32 , flagShowCurrentMoon(false)
33 , enumShowCurrentPlanet(ArchaeoLine::CurrentPlanetNone)
34- , lastJD(0.0)
35+ , lastJDE(0.0)
36 , toolbarButton(NULL)
37 {
38 setObjectName("ArchaeoLines");
39@@ -212,6 +212,9 @@
40
41 void ArchaeoLines::update(double deltaTime)
42 {
43+ if (core->getCurrentPlanet()->getEnglishName()!="Earth")
44+ return;
45+
46 static SolarSystem *ssystem=GETSTELMODULE(SolarSystem);
47 static const double lunarI=5.145396; // inclination of lunar orbit
48 // compute min and max distance values for horizontal parallax.
49@@ -244,16 +247,16 @@
50 currentPlanetLine->setDeclination(dec_equ * 180.0/M_PI);
51 }
52
53- double newJD=core->getJDay();
54- if (fabs(newJD-lastJD) > 10.0) // enough to compute this every 10 days?
55+ double newJDE=core->getJDE();
56+ if (fabs(newJDE-lastJDE) > 10.0) // enough to compute this every 10 days?
57 {
58- eps= ssystem->getEarth()->getRotObliquity(core->getJDay()) *180.0/M_PI;
59+ eps= ssystem->getEarth()->getRotObliquity(newJDE) *180.0/M_PI;
60 static const double invSqrt2=1.0/std::sqrt(2.0);
61 northernSolsticeLine->setDeclination( eps);
62 southernSolsticeLine->setDeclination(-eps);
63 northernCrossquarterLine->setDeclination( eps*invSqrt2);
64 southernCrossquarterLine->setDeclination(-eps*invSqrt2);
65- lastJD=newJD;
66+ lastJDE=newJDE;
67 }
68 StelLocation loc=core->getCurrentLocation();
69
70@@ -347,6 +350,9 @@
71 //! Draw any parts on the screen which are for our module
72 void ArchaeoLines::draw(StelCore* core)
73 {
74+ if (core->getCurrentPlanet()->getEnglishName()!="Earth")
75+ return;
76+
77 equinoxLine->draw(core, lineFader.getInterstate());
78 northernSolsticeLine->draw(core, lineFader.getInterstate());
79 southernSolsticeLine->draw(core, lineFader.getInterstate());
80
81=== modified file 'plugins/ArchaeoLines/src/ArchaeoLines.hpp'
82--- plugins/ArchaeoLines/src/ArchaeoLines.hpp 2015-05-30 19:56:47 +0000
83+++ plugins/ArchaeoLines/src/ArchaeoLines.hpp 2015-08-03 13:17:13 +0000
84@@ -272,7 +272,7 @@
85 bool flagShowCurrentSun;
86 bool flagShowCurrentMoon;
87 ArchaeoLine::Line enumShowCurrentPlanet;
88- double lastJD; // cache last-time-computed to 1/month or so?
89+ double lastJDE; // cache last-time-computed to every 10 days or so?
90
91 ArchaeoLine * equinoxLine;
92 ArchaeoLine * northernSolsticeLine;
93
94=== modified file 'plugins/EquationOfTime/src/EquationOfTime.cpp'
95--- plugins/EquationOfTime/src/EquationOfTime.cpp 2015-03-22 09:33:56 +0000
96+++ plugins/EquationOfTime/src/EquationOfTime.cpp 2015-08-03 13:17:13 +0000
97@@ -113,6 +113,8 @@
98 {
99 if (!isEnabled())
100 return;
101+ if (core->getCurrentPlanet()->getEnglishName()!="Earth")
102+ return;
103
104 StelPainter sPainter(core->getProjection2d());
105 sPainter.setColor(textColor[0], textColor[1], textColor[2], 1.f);
106@@ -120,26 +122,26 @@
107 sPainter.setFont(font);
108
109 QString timeText;
110- double time = getSolutionEquationOfTime(core->getJDay());
111+ double eqTime = getSolutionEquationOfTime(core->getJDE());
112
113 if (getFlagInvertedValue())
114- time *= -1;
115+ eqTime *= -1;
116
117 if (getFlagMsFormat())
118 {
119- int seconds = qRound((time - (int)time)*60);
120+ int seconds = qRound((eqTime - (int)eqTime)*60);
121 QString messageSecondsValue = QString("%1").arg(qAbs(seconds), 2, 10, QLatin1Char('0'));
122
123- timeText = QString("%1: %2%3%4%5%6").arg(messageEquation, (time<0? QString(QLatin1Char('-')):QString()), QString::number((int)qAbs(time)), messageEquationMinutes, messageSecondsValue, messageEquationSeconds);
124+ timeText = QString("%1: %2%3%4%5%6").arg(messageEquation, (eqTime<0? QString(QLatin1Char('-')):QString()), QString::number((int)qAbs(eqTime)), messageEquationMinutes, messageSecondsValue, messageEquationSeconds);
125 }
126 else
127- timeText = QString("%1: %2%3").arg(messageEquation, QString::number(time, 'f', 2), messageEquationMinutes);
128+ timeText = QString("%1: %2%3").arg(messageEquation, QString::number(eqTime, 'f', 2), messageEquationMinutes);
129
130
131 QFontMetrics fm(font);
132 QSize fs = fm.size(Qt::TextSingleLine, timeText);
133- if (core->getCurrentPlanet().data()->getEnglishName()=="Earth")
134- sPainter.drawText(gui->getSkyGui()->getSkyGuiWidth()/2 - fs.width()/2, gui->getSkyGui()->getSkyGuiHeight() - fs.height()*1.5, timeText);
135+
136+ sPainter.drawText(gui->getSkyGui()->getSkyGuiWidth()/2 - fs.width()/2, gui->getSkyGui()->getSkyGuiHeight() - fs.height()*1.5, timeText);
137
138 //qDebug() << timeText;
139 }
140@@ -212,11 +214,11 @@
141 conf->endGroup();
142 }
143
144-double EquationOfTime::getSolutionEquationOfTime(const double JDay) const
145+double EquationOfTime::getSolutionEquationOfTime(const double JDE) const
146 {
147 StelCore* core = StelApp::getInstance().getCore();
148
149- double tau = (JDay - 2451545.0)/365250.0;
150+ double tau = (JDE - 2451545.0)/365250.0;
151 double sunMeanLongitude = 280.4664567 + tau*(360007.6892779 + tau*(0.03032028 + tau*(1./49931. - tau*(1./15300. - tau/2000000.))));
152
153 // reduce the angle
154@@ -233,7 +235,7 @@
155 // force it to be the positive remainder, so that 0 <= angle < 360
156 alpha = std::fmod(alpha + 360., 360.);
157
158- double equation = 4*(sunMeanLongitude - 0.0057183 - alpha + get_nutation_longitude(JDay)*cos(get_mean_ecliptical_obliquity(JDay)));
159+ double equation = 4*(sunMeanLongitude - 0.0057183 - alpha + get_nutation_longitude(JDE)*cos(get_mean_ecliptical_obliquity(JDE)));
160 // The equation of time is always smaller 20 minutes in absolute value
161 if (qAbs(equation)>20)
162 {
163
164=== modified file 'plugins/EquationOfTime/src/EquationOfTime.hpp'
165--- plugins/EquationOfTime/src/EquationOfTime.hpp 2015-05-31 09:35:00 +0000
166+++ plugins/EquationOfTime/src/EquationOfTime.hpp 2015-08-03 13:17:13 +0000
167@@ -87,9 +87,9 @@
168
169 //! Get solution of equation of time
170 //! Source: J. Meeus "Astronomical Algorithms" (2nd ed., with corrections as of August 10, 2009) p.183-187.
171- //! @param JDay JD
172+ //! @param JDE JD in Dynamical Time (previously called Ephemeris Time)
173 //! @return time in minutes
174- double getSolutionEquationOfTime(const double JDay) const;
175+ double getSolutionEquationOfTime(const double JDE) const;
176
177 //! Is plugin enabled?
178 bool isEnabled() const
179
180=== modified file 'plugins/Exoplanets/src/Exoplanet.cpp'
181--- plugins/Exoplanets/src/Exoplanet.cpp 2015-01-16 19:33:33 +0000
182+++ plugins/Exoplanets/src/Exoplanet.cpp 2015-08-03 13:17:13 +0000
183@@ -417,7 +417,7 @@
184 QList<int> discovery;
185 // For getting value of new year from midnight at 1 Jan we need increase a value of JD on 0.5.
186 // This hack need for correct display of discovery mode of exoplanets.
187- StelUtils::getDateFromJulianDay(core->getJDay()+0.5, &year, &month, &day);
188+ StelUtils::getDateFromJulianDay(core->getJD()+0.5, &year, &month, &day);
189 discovery.clear();
190 foreach(const exoplanetData &p, exoplanets)
191 {
192
193=== modified file 'plugins/MeteorShowers/src/MeteorShower.cpp'
194--- plugins/MeteorShowers/src/MeteorShower.cpp 2015-04-22 01:04:29 +0000
195+++ plugins/MeteorShowers/src/MeteorShower.cpp 2015-08-03 13:17:13 +0000
196@@ -206,9 +206,9 @@
197 QDateTime MeteorShower::getSkyQDateTime() const
198 {
199 StelCore* core = StelApp::getInstance().getCore();
200- //get the current sky date
201- double JD = core->getJDay();
202- return StelUtils::jdToQDateTime(JD+StelUtils::getGMTShiftFromQT(JD)/24-core->getDeltaT(JD)/86400);
203+ //get the current sky date (zone time)
204+ double JD = core->getJD();
205+ return StelUtils::jdToQDateTime(JD+ StelUtils::getGMTShiftFromQT(JD)/24);
206 }
207
208 void MeteorShower::updateCurrentData(QDateTime skyDate)
209
210=== modified file 'plugins/MeteorShowers/src/MeteorShowers.cpp'
211--- plugins/MeteorShowers/src/MeteorShowers.cpp 2015-04-11 13:25:02 +0000
212+++ plugins/MeteorShowers/src/MeteorShowers.cpp 2015-08-03 13:17:13 +0000
213@@ -215,7 +215,8 @@
214 updateTimer->start();
215
216 // skyDate startup
217- skyDate = StelUtils::jdToQDateTime(StelApp::getInstance().getCore()->getJDay());
218+ // GZ JDfix for 0.14 I am not sure how skyDate is used. It used to be set to JDE, so again:
219+ skyDate = StelUtils::jdToQDateTime(StelApp::getInstance().getCore()->getJDE());
220
221 GETSTELMODULE(StelObjectMgr)->registerStelObjectMgr(this);
222 }
223@@ -273,8 +274,8 @@
224
225 bool MeteorShowers::changedSkyDate(StelCore* core)
226 {
227- double JD = core->getJDay();
228- skyDate = StelUtils::jdToQDateTime(JD+StelUtils::getGMTShiftFromQT(JD)/24-core->getDeltaT(JD)/86400);
229+ double JD = core->getJD();
230+ skyDate = StelUtils::jdToQDateTime(JD+StelUtils::getGMTShiftFromQT(JD)/24);
231 if (skyDate.toString("MM.dd.yyyy") != lastSkyDate.toString("MM.dd.yyyy")) //if the sky date changed
232 {
233 return true;
234
235=== modified file 'plugins/MeteorShowers/src/gui/MeteorShowerDialog.cpp'
236--- plugins/MeteorShowers/src/gui/MeteorShowerDialog.cpp 2015-07-29 18:56:52 +0000
237+++ plugins/MeteorShowers/src/gui/MeteorShowerDialog.cpp 2015-08-03 13:17:13 +0000
238@@ -237,7 +237,8 @@
239 //Change date
240 QString dateString = treeWidget->currentItem()->text(ColumnPeak);
241 QDateTime qDateTime = QDateTime::fromString(dateString, "dd/MMM/yyyy");
242- core->setJDay(StelUtils::qDateTimeToJd(qDateTime));
243+ // GZ JDfix for V0.14 this used to set JDE, so again. If IMO ephemerides are JD(UT), please change.
244+ core->setJDE(StelUtils::qDateTimeToJd(qDateTime));
245
246 //Select object
247 QString namel18n = treeWidget->currentItem()->text(ColumnName);
248
249=== modified file 'plugins/Novae/src/Nova.cpp'
250--- plugins/Novae/src/Nova.cpp 2015-02-08 15:35:27 +0000
251+++ plugins/Novae/src/Nova.cpp 2015-08-03 13:17:13 +0000
252@@ -167,7 +167,7 @@
253 {
254 // OK, start from minimal brightness
255 double vmag = minMagnitude;
256- double currentJD = core->getJDay();
257+ double currentJD = core->getJDE();
258 double deltaJD = qAbs(peakJD-currentJD);
259
260 // Fill "default" values for mX
261
262=== modified file 'plugins/Novae/src/Nova.hpp'
263--- plugins/Novae/src/Nova.hpp 2015-05-30 19:56:47 +0000
264+++ plugins/Novae/src/Nova.hpp 2015-08-03 13:17:13 +0000
265@@ -37,6 +37,11 @@
266 //! Details about the novae are passed using a QVariant which contains
267 //! a map of data from the json file.
268 //! @ingroup brightNovae
269+//
270+// GZ NOTE from JDfix for V0.14:
271+// TODO: I don't know whether the peak times given are UT or DT times.
272+// If DT, please change relevant calls from core->getJD() to getJDE() etc
273+// and rename variables to include JDE for clarity.
274
275 class Nova : public StelObject
276 {
277
278=== modified file 'plugins/Observability/src/Observability.cpp'
279--- plugins/Observability/src/Observability.cpp 2014-11-26 18:14:09 +0000
280+++ plugins/Observability/src/Observability.cpp 2015-08-03 13:17:13 +0000
281@@ -72,6 +72,17 @@
282 return info;
283 }
284
285+// TODO: Migrate to static const? --BM ==> GZ during JDfix for 0.14: SURE!
286+// Some useful constants:
287+const double Observability::Rad2Deg = 180./M_PI; // Convert degrees into radians
288+const double Observability::Rad2Hr = 12./M_PI; // Convert hours into radians
289+const double Observability::UA = AU; // 1.4958e+8; // Astronomical Unit in Km. ==> HAS BEEN DEFINED IN StelUtils.hpp!
290+const double Observability::TFrac = 0.9972677595628414; // Convert sidereal time into Solar time
291+const double Observability::JDsec = 1./86400.; // A second in days. ==> TODO USE StelCore::JD_SECOND instead
292+const double Observability::halfpi = M_PI * 0.5; // 1.57079632675; // pi/2
293+const double Observability::MoonT = 29.530588; // Moon synodic period (used as first estimate of Full Moon). ==> FIND MORE DEC. PLACES!
294+const double Observability::RefFullMoon = 2451564.696; // Reference Julian date of a Full Moon.
295+const double Observability::MoonPerilune = 0.0024236308; // Smallest Earth-Moon distance (in AU).
296
297
298 Observability::Observability()
299@@ -110,17 +121,6 @@
300 setObjectName("Observability");
301 configDialog = new ObservabilityDialog();
302
303- // TODO: Migrate to static const? --BM
304- // Some useful constants:
305- Rad2Deg = 180./3.1415927; // Convert degrees into radians
306- Rad2Hr = 12./3.1415927; // Convert hours into radians
307- UA = 1.4958e+8; // Astronomical Unit in Km.
308- TFrac = 0.9972677595628414; // Convert sidereal time into Solar time
309- JDsec = 1./86400.; // A second in days.
310- halfpi = 1.57079632675; // pi/2
311- MoonT = 29.530588; // Moon synodic period (used as first estimate of Full Moon).
312- RefFullMoon = 2451564.696; // Reference Julian date of a Full Moon.
313- MoonPerilune = 0.0024236308; // Smallest Earth-Moon distance (in AU).
314
315 nextFullMoon = 0.0;
316 prevFullMoon = 0.0;
317@@ -129,7 +129,8 @@
318
319 // Dummy initial values for parameters and data vectors:
320 mylat = 1000.; mylon = 1000.;
321- myJD = 0.0;
322+ myJD.first = 0.0;
323+ myJD.second = 0.0;
324 curYear = 0;
325 isStar = true;
326 isMoon = false;
327@@ -146,13 +147,21 @@
328
329 // I think this can be done in a more simple way...--BM
330 for (int i=0;i<366;i++) {
331- sunRA[i] = 0.0; sunDec[i] = 0.0;
332- objectRA[i] = 0.0; objectDec[i]=0.0;
333- sunSidT[0][i]=0.0; sunSidT[1][i]=0.0;
334- objectSidT[0][i]=0.0; objectSidT[1][i]=0.0;
335- objectH0[i] = 0.0;
336- yearJD[i] = 0.0;
337+// sunRA[i] = 0.0; sunDec[i] = 0.0;
338+// objectRA[i] = 0.0; objectDec[i]=0.0;
339+// sunSidT[0][i]=0.0; sunSidT[1][i]=0.0;
340+// objectSidT[0][i]=0.0; objectSidT[1][i]=0.0;
341+// objectH0[i] = 0.0;
342+ yearJD[i]=QPair<double, double>(0.0, 0.0);
343 };
344+ // GZ Sure:
345+ memset(sunRA, 0, 366*sizeof(double));
346+ memset(sunDec, 0, 366*sizeof(double));
347+ memset(objectRA, 0, 366*sizeof(double));
348+ memset(objectDec, 0, 366*sizeof(double));
349+ memset(sunSidT, 0, 2*366*sizeof(double));
350+ memset(objectSidT, 0, 2*366*sizeof(double));
351+ memset(objectH0, 0, 366*sizeof(double));
352
353 }
354
355@@ -281,7 +290,7 @@
356 double currlat = (core->getCurrentLocation().latitude)/Rad2Deg;
357 double currlon = (core->getCurrentLocation().longitude)/Rad2Deg;
358 double currheight = (6371.+(core->getCurrentLocation().altitude)/1000.)/UA;
359- double currJD = core->getJDay();
360+ double currJD = core->getJD();
361 double currJDint;
362 // GMTShift = StelUtils::getGMTShiftFromQT(currJD)/24.0;
363 GMTShift = StelApp::getInstance().getLocaleMgr().getGMTShift(currJD)/24.0;
364@@ -302,7 +311,7 @@
365 // NOW WE CHECK THE CHANGED PARAMETERS W.R.T. THE PREVIOUS FRAME:
366
367 // Update JD.
368- myJD = currJD;
369+ myJD.first = currJD;
370
371 // If the year changed, we must recompute the Sun's position for each new day:
372 if (auxy != curYear)
373@@ -494,12 +503,12 @@
374
375 // Returns false if the calculation fails...
376 solvedMoon = calculateSolarSystemEvents(core, type);
377- currH = qAbs(24.*(MoonCulm-myJD)/TFrac);
378- transit = MoonCulm-myJD<0.0;
379+ currH = qAbs(24.*(MoonCulm-myJD.first)/TFrac);
380+ transit = MoonCulm-myJD.first<0.0;
381 if (solvedMoon)
382 { // If failed, Set and Rise will be dummy.
383- settingTime = qAbs(24.*(MoonSet-myJD)/TFrac);
384- risingTime = qAbs(24.*(MoonRise-myJD)/TFrac);
385+ settingTime = qAbs(24.*(MoonSet-myJD.first)/TFrac);
386+ risingTime = qAbs(24.*(MoonRise-myJD.first)/TFrac);
387 }
388 }
389 else if (horizH>0.0)
390@@ -947,7 +956,7 @@
391 QString Observability::formatAsDate(int dayNumber)
392 {
393 int day, month, year;
394- StelUtils::getDateFromJulianDay(yearJD[dayNumber], &year, &month, &day);
395+ StelUtils::getDateFromJulianDay(yearJD[dayNumber].first, &year, &month, &day);
396
397 QString formatString = (getDateFormat()) ? "%1 %2" : "%2 %1";
398 QString result = formatString.arg(day).arg(monthNames[month-1]);
399@@ -960,8 +969,8 @@
400 {
401 int sDay, sMonth, sYear, eDay, eMonth, eYear;
402 QString range;
403- StelUtils::getDateFromJulianDay(yearJD[startDay], &sYear, &sMonth, &sDay);
404- StelUtils::getDateFromJulianDay(yearJD[endDay], &eYear, &eMonth, &eDay);
405+ StelUtils::getDateFromJulianDay(yearJD[startDay].first, &sYear, &sMonth, &sDay);
406+ StelUtils::getDateFromJulianDay(yearJD[endDay].first, &eYear, &eMonth, &eDay);
407 if (endDay == 0)
408 {
409 eDay = 31;
410@@ -1017,7 +1026,7 @@
411 {
412 int day, month, year, sameYear;
413 // Get current date:
414- StelUtils::getDateFromJulianDay(myJD,&year,&month,&day);
415+ StelUtils::getDateFromJulianDay(myJD.first,&year,&month,&day);
416
417 // Get JD for the Jan 1 of current year:
418 StelUtils::getJDFromDate(&Jan1stJD,year,1,1,0,0,0);
419@@ -1030,9 +1039,10 @@
420 Vec3d pos, sunPos;
421 for (int i=0; i<nDays; i++)
422 {
423- yearJD[i] = Jan1stJD + (double)i;
424- myEarth->computePosition(yearJD[i]);
425- myEarth->computeTransMatrix(yearJD[i]);
426+ yearJD[i].first = Jan1stJD + (double)i;
427+ yearJD[i].second = yearJD[i].first+core->computeDeltaT(yearJD[i].first)/86400.0;
428+ myEarth->computePosition(yearJD[i].second);
429+ myEarth->computeTransMatrix(yearJD[i].first, yearJD[i].second);
430 pos = myEarth->getHeliocentricEclipticPos();
431 sunPos = core->j2000ToEquinoxEqu((core->matVsop87ToJ2000)*(-pos));
432 EarthPos[i] = -pos;
433@@ -1040,8 +1050,8 @@
434 };
435
436 //Return the Earth to its current time:
437- myEarth->computePosition(myJD);
438- myEarth->computeTransMatrix(myJD);
439+ myEarth->computePosition(myJD.second);
440+ myEarth->computeTransMatrix(myJD.first, myJD.second);
441 }
442 ///////////////////////////////////////////////////
443
444@@ -1261,24 +1271,24 @@
445 //////////////////////////
446 // Get the coordinates of Sun or Moon for a given JD:
447 // getBack controls whether Earth and Moon must be returned to their original positions after computation.
448-void Observability::getSunMoonCoords(StelCore *core, double jd,
449- double &raSun, double &decSun,
450- double &raMoon, double &decMoon,
451- double &eclLon, bool getBack)
452+void Observability::getSunMoonCoords(StelCore *core, QPair<double, double> JD,
453+ double &raSun, double &decSun,
454+ double &raMoon, double &decMoon,
455+ double &eclLon, bool getBack)
456 //, Vec3d &AltAzVector)
457 {
458
459 if (getBack) // Return the Moon and Earth to their current position:
460 {
461- myEarth->computePosition(jd);
462- myEarth->computeTransMatrix(jd);
463- myMoon->computePosition(jd);
464- myMoon->computeTransMatrix(jd);
465+ myEarth->computePosition(JD.second);
466+ myEarth->computeTransMatrix(JD.first, JD.second);
467+ myMoon->computePosition(JD.second);
468+ myMoon->computeTransMatrix(JD.first, JD.second);
469 }
470 else // Compute coordinates:
471 {
472- myEarth->computePosition(jd);
473- myEarth->computeTransMatrix(jd);
474+ myEarth->computePosition(JD.second);
475+ myEarth->computeTransMatrix(JD.first, JD.second);
476 Vec3d earthPos = myEarth->getHeliocentricEclipticPos();
477 double curSidT;
478
479@@ -1287,11 +1297,11 @@
480 toRADec(sunPos, raSun, decSun);
481
482 // Moon coordinates:
483- curSidT = myEarth->getSiderealTime(jd)/Rad2Deg;
484+ curSidT = myEarth->getSiderealTime(JD.first, JD.second)/Rad2Deg;
485 RotObserver = (Mat4d::zrotation(curSidT))*ObserverLoc;
486 LocTrans = (core->matVsop87ToJ2000)*(Mat4d::translation(-earthPos));
487- myMoon->computePosition(jd);
488- myMoon->computeTransMatrix(jd);
489+ myMoon->computePosition(JD.second);
490+ myMoon->computeTransMatrix(JD.first, JD.second);
491 Vec3d moonPos = myMoon->getHeliocentricEclipticPos();
492 sunPos = (core->j2000ToEquinoxEqu(LocTrans*moonPos))-RotObserver;
493
494@@ -1307,20 +1317,20 @@
495 //////////////////////////
496 // Get the Observer-to-Moon distance JD:
497 // getBack controls whether Earth and Moon must be returned to their original positions after computation.
498-void Observability::getMoonDistance(StelCore *core, double jd, double &distance, bool getBack)
499+void Observability::getMoonDistance(StelCore *core, QPair<double, double> JD, double &distance, bool getBack)
500 {
501
502 if (getBack) // Return the Moon and Earth to their current position:
503 {
504- myEarth->computePosition(jd);
505- myEarth->computeTransMatrix(jd);
506- myMoon->computePosition(jd);
507- myMoon->computeTransMatrix(jd);
508+ myEarth->computePosition(JD.second);
509+ myEarth->computeTransMatrix(JD.first, JD.second);
510+ myMoon->computePosition(JD.second);
511+ myMoon->computeTransMatrix(JD.first, JD.second);
512 }
513 else
514 { // Compute coordinates:
515- myEarth->computePosition(jd);
516- myEarth->computeTransMatrix(jd);
517+ myEarth->computePosition(JD.second);
518+ myEarth->computeTransMatrix(JD.first, JD.second);
519 Vec3d earthPos = myEarth->getHeliocentricEclipticPos();
520 // double curSidT;
521
522@@ -1332,8 +1342,8 @@
523 // curSidT = myEarth->getSiderealTime(JD)/Rad2Deg;
524 // RotObserver = (Mat4d::zrotation(curSidT))*ObserverLoc;
525 LocTrans = (core->matVsop87ToJ2000)*(Mat4d::translation(-earthPos));
526- myMoon->computePosition(jd);
527- myMoon->computeTransMatrix(jd);
528+ myMoon->computePosition(JD.second);
529+ myMoon->computeTransMatrix(JD.first, JD.second);
530 Pos1 = myMoon->getHeliocentricEclipticPos();
531 Pos2 = (core->j2000ToEquinoxEqu(LocTrans*Pos1)); //-RotObserver;
532
533@@ -1349,24 +1359,24 @@
534
535 //////////////////////////////////////////////
536 // Get the Coords of a planet:
537-void Observability::getPlanetCoords(StelCore *core, double JD, double &RA, double &Dec, bool getBack)
538+void Observability::getPlanetCoords(StelCore *core, QPair<double, double> JD, double &RA, double &Dec, bool getBack)
539 {
540
541 if (getBack)
542 {
543 // Return the planet to its current time:
544- myPlanet->computePosition(JD);
545- myPlanet->computeTransMatrix(JD);
546- myEarth->computePosition(JD);
547- myEarth->computeTransMatrix(JD);
548+ myPlanet->computePosition(JD.second);
549+ myPlanet->computeTransMatrix(JD.first, JD.second);
550+ myEarth->computePosition(JD.second);
551+ myEarth->computeTransMatrix(JD.first, JD.second);
552 } else
553 {
554 // Compute planet's position:
555- myPlanet->computePosition(JD);
556- myPlanet->computeTransMatrix(JD);
557+ myPlanet->computePosition(JD.second);
558+ myPlanet->computeTransMatrix(JD.first, JD.second);
559 Pos1 = myPlanet->getHeliocentricEclipticPos();
560- myEarth->computePosition(JD);
561- myEarth->computeTransMatrix(JD);
562+ myEarth->computePosition(JD.second);
563+ myEarth->computeTransMatrix(JD.first, JD.second);
564 Pos2 = myEarth->getHeliocentricEclipticPos();
565 LocTrans = (core->matVsop87ToJ2000)*(Mat4d::translation(-Pos2));
566 Pos2 = core->j2000ToEquinoxEqu(LocTrans*Pos1);
567@@ -1385,7 +1395,8 @@
568
569 const int NUM_ITER = 100;
570 int i;
571- double hHoriz, ra, dec, raSun, decSun, tempH, tempJd, tempEphH, curSidT, eclLon;
572+ double hHoriz, ra, dec, raSun, decSun, tempH, /* tempJd, */ tempEphH, curSidT, eclLon;
573+ QPair<double, double> tempJd;
574 //Vec3d Observer;
575
576 hHoriz = calculateHourAngle(mylat, refractedHorizonAlt, selDec);
577@@ -1394,15 +1405,15 @@
578
579 // Only recompute ephemeris from second to second (at least)
580 // or if the source has changed (i.e., Sun <-> Moon). This saves resources:
581- if (qAbs(myJD-lastJDMoon)>JDsec || lastType!=bodyType || souChanged)
582+ if (qAbs(myJD.first-lastJDMoon)>JDsec || lastType!=bodyType || souChanged)
583 {
584
585 // qDebug() << q_("%1 %2 %3 %4").arg(Kind).arg(LastObject).arg(myJD,0,'f',5).arg(lastJDMoon,0,'f',5);
586
587 lastType = bodyType;
588
589- myEarth->computePosition(myJD);
590- myEarth->computeTransMatrix(myJD);
591+ myEarth->computePosition(myJD.second);
592+ myEarth->computeTransMatrix(myJD.first, myJD.second);
593 Vec3d earthPos = myEarth->getHeliocentricEclipticPos();
594
595 if (bodyType == 1) // Sun position
596@@ -1411,18 +1422,18 @@
597 }
598 else if (bodyType==2) // Moon position
599 {
600- curSidT = myEarth->getSiderealTime(myJD)/Rad2Deg;
601+ curSidT = myEarth->getSiderealTime(myJD.first, myJD.second)/Rad2Deg;
602 RotObserver = (Mat4d::zrotation(curSidT))*ObserverLoc;
603 LocTrans = (core->matVsop87ToJ2000)*(Mat4d::translation(-earthPos));
604- myMoon->computePosition(myJD);
605- myMoon->computeTransMatrix(myJD);
606+ myMoon->computePosition(myJD.second);
607+ myMoon->computeTransMatrix(myJD.first, myJD.second);
608 Pos1 = myMoon->getHeliocentricEclipticPos();
609 Pos2 = (core->j2000ToEquinoxEqu(LocTrans*Pos1))-RotObserver;
610 }
611 else // Planet position
612 {
613- myPlanet->computePosition(myJD);
614- myPlanet->computeTransMatrix(myJD);
615+ myPlanet->computePosition(myJD.second);
616+ myPlanet->computeTransMatrix(myJD.first, myJD.second);
617 Pos1 = myPlanet->getHeliocentricEclipticPos();
618 LocTrans = (core->matVsop87ToJ2000)*(Mat4d::translation(-earthPos));
619 Pos2 = core->j2000ToEquinoxEqu(LocTrans*Pos1);
620@@ -1452,11 +1463,12 @@
621
622 // Rise time:
623 tempEphH = MoonRise*TFrac;
624- MoonRise = myJD + (MoonRise/24.);
625+ MoonRise = myJD.first + (MoonRise/24.);
626 for (i=0; i<NUM_ITER; i++)
627 {
628 // Get modified coordinates:
629- tempJd = MoonRise;
630+ tempJd.first = MoonRise;
631+ tempJd.second=tempJd.first+core->computeDeltaT(tempJd.first)/86400.0;
632
633 if (bodyType<3)
634 {
635@@ -1485,16 +1497,18 @@
636 if (qAbs(tempH-tempEphH)<JDsec) break;
637 // Update rise-time estimate:
638 tempEphH = tempH;
639- MoonRise = myJD + (tempEphH/24.);
640+ MoonRise = myJD.first + (tempEphH/24.);
641 };
642
643 // Set time:
644 tempEphH = MoonSet;
645- MoonSet = myJD + (MoonSet/24.);
646+ MoonSet = myJD.first + (MoonSet/24.);
647 for (i=0; i<NUM_ITER; i++)
648 {
649 // Get modified coordinates:
650- tempJd = MoonSet;
651+ tempJd.first = MoonSet;
652+ tempJd.second=tempJd.first+core->computeDeltaT(tempJd.first)/86400.0;
653+
654
655 if (bodyType < 3)
656 getSunMoonCoords(core, tempJd,
657@@ -1521,7 +1535,7 @@
658 break;
659 // Update set-time estimate:
660 tempEphH = tempH;
661- MoonSet = myJD + (tempEphH/24.);
662+ MoonSet = myJD.first + (tempEphH/24.);
663 };
664 }
665 else // Comes from if(raises)
666@@ -1532,12 +1546,14 @@
667
668 // Culmination time:
669 tempEphH = MoonCulm;
670- MoonCulm = myJD + (MoonCulm/24.);
671+ MoonCulm = myJD.first + (MoonCulm/24.);
672
673 for (i=0; i<NUM_ITER; i++)
674 {
675 // Get modified coordinates:
676- tempJd = MoonCulm;
677+ tempJd.first = MoonCulm;
678+ tempJd.second=tempJd.first+core->computeDeltaT(tempJd.first)/86400.0;
679+
680
681 if (bodyType<3)
682 {
683@@ -1561,16 +1577,16 @@
684 // Check convergence:
685 if (qAbs(tempH-tempEphH)<JDsec) break;
686 tempEphH = tempH;
687- MoonCulm = myJD + (tempEphH/24.);
688+ MoonCulm = myJD.first + (tempEphH/24.);
689 culmAlt = qAbs(mylat-dec); // 90 - altitude at transit.
690 };
691
692 // qDebug() << q_("%1").arg(MoonCulm,0,'f',5);
693
694
695- lastJDMoon = myJD;
696+ lastJDMoon = myJD.first;
697
698- }; // Comes from if (qAbs(myJD-lastJDMoon)>JDsec || LastObject!=Kind)
699+ }; // Comes from if (qAbs(myJD.first-lastJDMoon)>JDsec || LastObject!=Kind)
700
701
702
703@@ -1580,13 +1596,13 @@
704 {
705
706 // Only estimate date of Full Moon if we have changed Lunar month:
707- if (myJD > nextFullMoon || myJD < prevFullMoon)
708+ if (myJD.first > nextFullMoon || myJD.first < prevFullMoon)
709 {
710
711
712 // Estimate the nearest (in time) Full Moon:
713 double nT;
714- double dT = std::modf((myJD-RefFullMoon)/MoonT,&nT);
715+ double dT = std::modf((myJD.first-RefFullMoon)/MoonT,&nT);
716 if (dT>0.5) {nT += 1.0;};
717 if (dT<-0.5) {nT -= 1.0;};
718
719@@ -1596,7 +1612,8 @@
720
721 dT = 0.1/1440.; // 6 seconds. Our time span for the finite-difference derivative estimate.
722 // double Deriv1, Deriv2; // Variables for temporal use.
723- double Sec1, Sec2, Temp1, Temp2; // Variables for temporal use.
724+ QPair<double, double>Sec1, Sec2; // Variables for temporal use. Contrary to the other cases, we have Sec[12].second=DeltaT[days], not JDE. This avoids needless re-computing.
725+ double Temp1, Temp2; // Variables for temporal use.
726 double iniEst1, iniEst2; // JD values that MUST include the solution within them.
727 double Phase1;
728
729@@ -1606,26 +1623,31 @@
730 iniEst1 = TempFullMoon - 0.25*MoonT;
731 iniEst2 = TempFullMoon + 0.25*MoonT;
732
733- Sec1 = iniEst1; // TempFullMoon - 0.05*MoonT; // Initial estimates of Full-Moon dates
734- Sec2 = iniEst2; // TempFullMoon + 0.05*MoonT;
735-
736- getSunMoonCoords(core,Sec1,raSun,decSun,ra,dec,eclLon,false);
737+
738+ Sec1.first = iniEst1; // TempFullMoon - 0.05*MoonT; // Initial estimates of Full-Moon dates
739+ Sec1.second= core->computeDeltaT(Sec1.first)/86400.0; // enough to compute this once.
740+ Sec2.first = iniEst2; // TempFullMoon + 0.05*MoonT;
741+ Sec2.second= core->computeDeltaT(Sec2.first)/86400.0; // enough to compute this once.
742+
743+ // for the computation calls, we need temporary QPairs here!
744+ getSunMoonCoords(core,QPair<double, double>(Sec1.first, Sec1.first+Sec1.second),raSun,decSun,ra,dec,eclLon,false);
745 Temp1 = eclLon; //Lambda(RA,Dec,RAS,DecS);
746- getSunMoonCoords(core,Sec2,raSun,decSun,ra,dec,eclLon,false);
747+ getSunMoonCoords(core,QPair<double, double>(Sec2.first, Sec2.first+Sec2.second),raSun,decSun,ra,dec,eclLon,false);
748 Temp2 = eclLon; //Lambda(RA,Dec,RAS,DecS);
749
750
751 for (int i=0; i<100; i++) // A limit of 100 iterations.
752 {
753- Phase1 = (Sec2-Sec1)/(Temp1-Temp2)*Temp1+Sec1;
754- getSunMoonCoords(core,Phase1,raSun,decSun,ra,dec,eclLon,false);
755+ Phase1 = (Sec2.first-Sec1.first)/(Temp1-Temp2)*Temp1+Sec1.first;
756+ // The ad-hoc pair needs a DeltaT, use the one of Sec1
757+ getSunMoonCoords(core,QPair<double, double>(Phase1, Phase1+Sec1.second),raSun,decSun,ra,dec,eclLon,false);
758
759 if (Temp1*eclLon < 0.0)
760 {
761- Sec2 = Phase1;
762+ Sec2.first = Phase1;
763 Temp2 = eclLon;
764 } else {
765- Sec1 = Phase1;
766+ Sec1.first = Phase1;
767 Temp1 = eclLon;
768
769 };
770@@ -1633,9 +1655,9 @@
771 // qDebug() << QString("%1 %2 %3 %4 ").arg(Sec1).arg(Sec2).arg(Temp1).arg(Temp2);
772
773
774- if (qAbs(Sec2-Sec1) < 10.*dT) // 1 minute accuracy; convergence.
775+ if (qAbs(Sec2.first-Sec1.first) < 10.*dT) // 1 minute accuracy; convergence.
776 {
777- TempFullMoon = (Sec1+Sec2)/2.;
778+ TempFullMoon = (Sec1.first+Sec2.first)/2.;
779 // qDebug() << QString("%1%2 ").arg(TempFullMoon);
780 break;
781 };
782@@ -1643,7 +1665,7 @@
783 };
784
785
786- if (TempFullMoon > myJD)
787+ if (TempFullMoon > myJD.first)
788 {
789 nextFullMoon = TempFullMoon;
790 TempFullMoon -= MoonT;
791
792=== modified file 'plugins/Observability/src/Observability.hpp'
793--- plugins/Observability/src/Observability.hpp 2015-05-30 19:56:47 +0000
794+++ plugins/Observability/src/Observability.hpp 2015-08-03 13:17:13 +0000
795@@ -21,6 +21,7 @@
796 #include "StelModule.hpp"
797 #include <QFont>
798 #include <QString>
799+#include <QPair>
800 #include "VecMath.hpp"
801 #include "SolarSystem.hpp"
802 #include "Planet.hpp"
803@@ -190,33 +191,33 @@
804
805 //! Computes the Sun or Moon coordinates at a given Julian date.
806 //! @param core the stellarium core.
807-//! @param JD double for the Julian date.
808+//! @param JD QPair of double for the Julian date: first=JD_UT and .second=JDE_DT
809 //! @param RASun right ascension of the Sun (in hours).
810 //! @param DecSun declination of the Sun (in radians).
811 //! @param RAMoon idem for the Moon.
812 //! @param DecMoon idem for the Moon.
813 //! @param EclLon is the module of the vector product of Heliocentric Ecliptic Coordinates of Sun and Moon (projected over the Ecliptic plane). Useful to derive the dates of Full Moon.
814 //! @param getBack controls whether Earth and Moon must be returned to their original positions after computation.
815- void getSunMoonCoords(StelCore* core, double jd,
816- double& raSun, double& decSun,
817- double& raMoon, double& decMoon,
818- double& eclLon, bool getBack);
819+ void getSunMoonCoords(StelCore* core, QPair<double, double> JD,
820+ double& raSun, double& decSun,
821+ double& raMoon, double& decMoon,
822+ double& eclLon, bool getBack);
823
824
825 //! computes the selected-planet coordinates at a given Julian date.
826 //! @param core the stellarium core.
827-//! @param JD double for the Julian date.
828+//! @param JD QPair for the Julian date: .first=JD(UT), .second=JDE
829 //! @param RA right ascension of the planet (in hours).
830 //! @param Dec declination of the planet (in radians).
831 //! @param getBack controls whether the planet must be returned to its original positions after computation.
832- void getPlanetCoords(StelCore* core, double JD, double &RA, double &Dec, bool getBack);
833+ void getPlanetCoords(StelCore* core, QPair<double, double> JD, double &RA, double &Dec, bool getBack);
834
835-//! Comptues the Earth-Moon distance (in AU) at a given Julian date.
836-//! The parameters are similar to those of getSunMoonCoords or getPlanetCoords.
837+//! Computes the Earth-Moon distance (in AU) at a given Julian date.
838+//! The parameters are similar to those of getSunMoonCoords() or getPlanetCoords().
839 void getMoonDistance(StelCore* core,
840- double jd,
841- double& distance,
842- bool getBack);
843+ QPair<double, double> JD,
844+ double& distance,
845+ bool getBack);
846
847 //! Returns the angular separation (in radians) between two points.
848 //! @param RA1 right ascension of point 1 (in hours)
849@@ -268,15 +269,19 @@
850 void toRADec(Vec3d vec3d, double& ra, double& dec);
851
852 //! Table containing the Julian Dates of the days of the current year.
853- double yearJD[366];
854+ QPair<double, double> yearJD[366]; // GZ: This had to become a QPair of JD.first=JD_UT, JD.second=JDE
855
856 //! Check if a source is observable during a given date.
857 //! @param i the day of the year.
858 bool CheckRise(int day);
859
860-//! Some useful constants and variables(almost self-explanatory).
861- double Rad2Deg, Rad2Hr, UA, TFrac, JDsec, Jan1stJD, halfpi, MoonT, nextFullMoon, prevFullMoon, RefFullMoon, GMTShift, MoonPerilune;
862-
863+//! Some useful constants (almost self-explanatory).
864+// GZ: Made true constants out of those, and improved accuracy of some.
865+ static const double Rad2Deg, Rad2Hr, UA, TFrac, JDsec, halfpi, MoonT, RefFullMoon, MoonPerilune;
866+
867+//! Some useful variables(almost self-explanatory).
868+ double nextFullMoon, prevFullMoon, GMTShift, Jan1stJD;
869+
870 //! User-defined angular altitude of astronomical twilight in radians.
871 //! See setTwilightAltitude() and getTwilightAltitude().
872 double twilightAltRad;
873@@ -292,7 +297,9 @@
874 int horizonAltDeg;
875
876 //! RA, Dec, observer latitude, object's elevation, and Hour Angle at horizon.
877- double selRA, selDec, mylat, mylon, alti, horizH, culmAlt, myJD;
878+ double selRA, selDec, mylat, mylon, alti, horizH, culmAlt;
879+//! Some place to keep JD and JDE. .first is JD(UT), .second is for the fitting JDE.
880+ QPair<double, double> myJD;
881
882 //! Vectors to store Sun's RA, Dec, and Sid. Time at twilight and rise/set.
883 double sunRA[366];
884@@ -304,7 +311,7 @@
885 double objectRA[366];
886 double objectDec[366];
887 double objectH0[366];
888- //! Table of the sidereal time of the object's rising/setting.
889+//! Table of the sidereal time of the object's rising/setting.
890 double objectSidT[2][366];
891
892 //! Rise/Set/Transit times for the Moon at current day:
893
894=== modified file 'plugins/PointerCoordinates/src/PointerCoordinates.cpp'
895--- plugins/PointerCoordinates/src/PointerCoordinates.cpp 2015-04-24 17:04:28 +0000
896+++ plugins/PointerCoordinates/src/PointerCoordinates.cpp 2015-08-03 13:17:13 +0000
897@@ -210,7 +210,7 @@
898 {
899 double lambda, beta;
900 StelUtils::rectToSphe(&cx,&cy,core->j2000ToEquinoxEqu(mousePosition));
901- StelUtils::equToEcl(cx, cy, core->getCurrentPlanet()->getRotObliquity(core->getJDay()), &lambda, &beta); // Calculate ecliptic position and show it...
902+ StelUtils::equToEcl(cx, cy, core->getCurrentPlanet()->getRotObliquity(core->getJDE()), &lambda, &beta); // Calculate ecliptic position and show it...
903 if (lambda<0) lambda+=2.0*M_PI;
904 coordsSystem = qc_("Ecl. Long/Lat", "abbreviated in the plugin");
905 if (withDecimalDegree)
906@@ -247,7 +247,7 @@
907 case HourAngle:
908 {
909 Vec3d v = core->j2000ToAltAz(mousePosition, StelCore::RefractionAuto);
910- StelUtils::rectToSphe(&cx,&cy,Mat4d::zrotation(-core->getLocalSiderealTime()+((core->getDeltaT(core->getJDay())/240.)*M_PI/180.))*core->altAzToEquinoxEqu(v, StelCore::RefractionOff));
911+ StelUtils::rectToSphe(&cx,&cy,Mat4d::zrotation(-core->getLocalSiderealTime())*core->altAzToEquinoxEqu(v, StelCore::RefractionOff));
912 cx = 2.*M_PI-cx;
913 coordsSystem = qc_("HA/Dec", "abbreviated in the plugin");
914 if (withDecimalDegree)
915
916=== modified file 'plugins/Satellites/src/Satellite.cpp'
917--- plugins/Satellites/src/Satellite.cpp 2015-06-18 19:50:02 +0000
918+++ plugins/Satellites/src/Satellite.cpp 2015-08-03 13:17:13 +0000
919@@ -612,8 +612,7 @@
920 if (pSatWrapper && orbitValid)
921 {
922 StelCore* core = StelApp::getInstance().getCore();
923- double JD = core->getJDay();
924- epochTime = JD - core->getDeltaT(JD)/86400; // Delta T anti-correction for artificial satellites
925+ epochTime = core->getJD(); // We have "true" JD from core, satellites don't need JDE!
926
927 pSatWrapper->setEpoch(epochTime);
928 position = pSatWrapper->getTEMEPos();
929@@ -730,7 +729,7 @@
930
931 void Satellite::draw(StelCore* core, StelPainter& painter, float)
932 {
933- if (core->getJDay()<jdLaunchYearJan1 || !displayed)
934+ if (core->getJD()<jdLaunchYearJan1 || !displayed)
935 return;
936
937 XYZ = getJ2000EquatorialPos(core);
938
939=== modified file 'plugins/Satellites/src/Satellites.cpp'
940--- plugins/Satellites/src/Satellites.cpp 2015-06-17 18:00:57 +0000
941+++ plugins/Satellites/src/Satellites.cpp 2015-08-03 13:17:13 +0000
942@@ -1694,7 +1694,7 @@
943 bool Satellites::isValidRangeDates() const
944 {
945 bool ok;
946- double tJD = StelApp::getInstance().getCore()->getJDay();
947+ double tJD = StelApp::getInstance().getCore()->getJD();
948 double uJD = StelUtils::getJulianDayFromISO8601String(lastUpdate.toString(Qt::ISODate), &ok);
949 if (lastUpdate.isNull()) // No updates yet?
950 uJD = tJD;
951
952=== modified file 'plugins/Satellites/src/gSatWrapper.cpp'
953--- plugins/Satellites/src/gSatWrapper.cpp 2015-02-01 20:44:54 +0000
954+++ plugins/Satellites/src/gSatWrapper.cpp 2015-08-03 13:17:13 +0000
955@@ -122,7 +122,7 @@
956
957 void gSatWrapper::updateEpoch()
958 {
959- double jul_utc = StelApp::getInstance().getCore()->getJDay();
960+ double jul_utc = StelApp::getInstance().getCore()->getJD();
961 epoch = jul_utc;
962
963 if (pSatellite)
964
965=== modified file 'plugins/Satellites/src/gsatellite/gVector.cpp'
966--- plugins/Satellites/src/gsatellite/gVector.cpp 2015-02-01 20:44:54 +0000
967+++ plugins/Satellites/src/gsatellite/gVector.cpp 2015-08-03 13:17:13 +0000
968@@ -34,7 +34,7 @@
969
970 }
971
972-gVector::gVector(unsigned int ai_uiElementsNumber)
973+gVector::gVector(size_t ai_uiElementsNumber)
974 : br_stl::gVectorTempl<double>(ai_uiElementsNumber)
975 {
976
977
978=== modified file 'plugins/Satellites/src/gsatellite/gVector.hpp'
979--- plugins/Satellites/src/gsatellite/gVector.hpp 2015-05-30 19:56:47 +0000
980+++ plugins/Satellites/src/gsatellite/gVector.hpp 2015-08-03 13:17:13 +0000
981@@ -43,9 +43,10 @@
982
983 public:
984 gVector();
985- gVector(unsigned int ai_uiElementsNumber);
986+ //gVector(unsigned int ai_uiElementsNumber);
987+ gVector(size_t ai_uiElementsNumber);
988
989- virtual ~gVector() {};
990+ virtual ~gVector() {}
991
992 //## Other Operations (specified)
993 //## Operation: operator*
994
995=== modified file 'plugins/Scenery3d/src/Scenery3d.cpp'
996--- plugins/Scenery3d/src/Scenery3d.cpp 2015-05-18 12:01:39 +0000
997+++ plugins/Scenery3d/src/Scenery3d.cpp 2015-08-03 13:17:13 +0000
998@@ -391,7 +391,7 @@
999 movement[2]);
1000
1001 //get current time
1002- double curTime = core->getJDay();
1003+ double curTime = core->getJD();
1004
1005 if(lazyDrawing)
1006 {
1007@@ -1542,7 +1542,7 @@
1008
1009 if(needsCubemapUpdate)
1010 {
1011- lastCubemapUpdate = core->getJDay();
1012+ lastCubemapUpdate = core->getJD();
1013 lastCubemapUpdateRealTime = QDateTime::currentMSecsSinceEpoch();
1014 }
1015 }
1016@@ -1893,7 +1893,7 @@
1017 str = QString("Last cubemap update: %1ms ago").arg(QDateTime::currentMSecsSinceEpoch() - lastCubemapUpdateRealTime);
1018 painter.drawText(screen_x, screen_y, str);
1019 screen_y -= 15.0f;
1020- str = QString("Last cubemap update JDAY: %1").arg(qAbs(core->getJDay()-lastCubemapUpdate) * StelCore::ONE_OVER_JD_SECOND);
1021+ str = QString("Last cubemap update JDAY: %1").arg(qAbs(core->getJD()-lastCubemapUpdate) * StelCore::ONE_OVER_JD_SECOND);
1022 painter.drawText(screen_x, screen_y, str);
1023 }
1024
1025
1026=== modified file 'plugins/Supernovae/src/Supernova.cpp'
1027--- plugins/Supernovae/src/Supernova.cpp 2015-02-08 15:35:27 +0000
1028+++ plugins/Supernovae/src/Supernova.cpp 2015-08-03 13:17:13 +0000
1029@@ -160,7 +160,7 @@
1030 float Supernova::getVMagnitude(const StelCore* core) const
1031 {
1032 double vmag = 20;
1033- double currentJD = core->getJDay();
1034+ double currentJD = core->getJDE(); // GZ JDfix for 0.14. I hope the JD in the list is JDE? (Usually difference should be negligible)
1035 double deltaJD = qAbs(peakJD-currentJD);
1036
1037 // Use supernova light curve model from here - http://www.astronet.ru/db/msg/1188703
1038
1039=== modified file 'plugins/TelescopeControl/src/clients/TelescopeClient.cpp'
1040--- plugins/TelescopeControl/src/clients/TelescopeClient.cpp 2015-02-05 15:44:10 +0000
1041+++ plugins/TelescopeControl/src/clients/TelescopeClient.cpp 2015-08-03 13:17:13 +0000
1042@@ -146,7 +146,7 @@
1043 // At the moment this can't be done in a platform-independent way with Qt
1044 // (QDateTime and QTime don't support microsecond precision)
1045 qint64 t;
1046- StelCore *core = StelApp::getInstance().getCore();
1047+ //StelCore *core = StelApp::getInstance().getCore();
1048 #ifdef Q_OS_WIN32
1049 FILETIME file_time;
1050 GetSystemTimeAsFileTime(&file_time);
1051@@ -156,7 +156,9 @@
1052 gettimeofday(&tv,0);
1053 t = tv.tv_sec * 1000000LL + tv.tv_usec;
1054 #endif
1055- return t - core->getDeltaT(StelUtils::getJDFromSystem())*1000000; // Delta T anti-correction
1056+ // GZ JDfix for 0.14 I am 99.9% sure we no longer need the anti-correction
1057+ //return t - core->getDeltaT(StelUtils::getJDFromSystem())*1000000; // Delta T anti-correction
1058+ return t;
1059 }
1060
1061 TelescopeTCP::TelescopeTCP(const QString &name, const QString &params, Equinox eq)
1062
1063=== modified file 'plugins/TelescopeControl/src/servers/Socket.cpp'
1064--- plugins/TelescopeControl/src/servers/Socket.cpp 2013-05-15 12:54:31 +0000
1065+++ plugins/TelescopeControl/src/servers/Socket.cpp 2015-08-03 13:17:13 +0000
1066@@ -36,7 +36,7 @@
1067 long long int GetNow(void)
1068 {
1069 long long int t;
1070- StelCore *core = StelApp::getInstance().getCore();
1071+ //StelCore *core = StelApp::getInstance().getCore();
1072 #ifdef Q_OS_WIN32
1073 union
1074 {
1075@@ -50,7 +50,9 @@
1076 gettimeofday(&tv, 0);
1077 t = tv.tv_sec * 1000000LL + tv.tv_usec;
1078 #endif
1079- return t - core->getDeltaT(StelUtils::getJDFromSystem())*1000000; // Delta T anti-correction
1080+ // GZ JDfix for 0.14 I am 99.9% sure we no longer need the anti-correction
1081+ //return t - core->getDeltaT(StelUtils::getJDFromSystem())*1000000; // Delta T anti-correction
1082+ return t;
1083 }
1084
1085 void Socket::hangup(void)
1086
1087=== modified file 'plugins/TextUserInterface/src/TextUserInterface.cpp'
1088--- plugins/TextUserInterface/src/TextUserInterface.cpp 2015-06-14 20:40:29 +0000
1089+++ plugins/TextUserInterface/src/TextUserInterface.cpp 2015-08-03 13:17:13 +0000
1090@@ -174,8 +174,8 @@
1091 m1->setNextNode(m2);
1092 TuiNode* m2_1 = new TuiNodeDateTime(N_("Current date/time"),
1093 core,
1094- SLOT(setJDay(double)),
1095- core->getJDay(),
1096+ SLOT(setJD(double)),
1097+ core->getJD(),
1098 m2);
1099 TuiNode* m2_2 = new TuiNode(N_("Set time zone"), m2, m2_1);
1100 TuiNode* m2_3 = new TuiNode(N_("Day keys"), m2, m2_2);
1101@@ -605,7 +605,7 @@
1102
1103 if (tuiDateTime)
1104 {
1105- double jd = core->getJDay();
1106+ double jd = core->getJD();
1107 int text_x = x + xVc*2/3, text_y = y + pixOffset;
1108
1109 QString newDate = StelApp::getInstance().getLocaleMgr().getPrintableDateLocal(jd) + " "
1110
1111=== modified file 'src/core/StelCore.cpp'
1112--- src/core/StelCore.cpp 2015-08-02 17:12:29 +0000
1113+++ src/core/StelCore.cpp 2015-08-03 13:17:13 +0000
1114@@ -50,11 +50,11 @@
1115 const Mat4d StelCore::matJ2000ToGalactic(-0.054875539726, 0.494109453312, -0.867666135858, 0, -0.873437108010, -0.444829589425, -0.198076386122, 0, -0.483834985808, 0.746982251810, 0.455983795705, 0, 0, 0, 0, 1);
1116 const Mat4d StelCore::matGalacticToJ2000(matJ2000ToGalactic.transpose());
1117
1118-const double StelCore::JD_SECOND=0.000011574074074074074074;
1119-const double StelCore::JD_MINUTE=0.00069444444444444444444;
1120-const double StelCore::JD_HOUR =0.041666666666666666666;
1121+const double StelCore::JD_SECOND=0.000011574074074074074074; // 1/(24*60*60)=1/86400
1122+const double StelCore::JD_MINUTE=0.00069444444444444444444; // 1/(24*60) =1/1440
1123+const double StelCore::JD_HOUR =0.041666666666666666666; // 1/24
1124 const double StelCore::JD_DAY =1.;
1125-const double StelCore::ONE_OVER_JD_SECOND = 24 * 60 * 60;
1126+const double StelCore::ONE_OVER_JD_SECOND = 24 * 60 * 60; // 86400
1127
1128
1129 StelCore::StelCore()
1130@@ -65,10 +65,10 @@
1131 , currentDeltaTAlgorithm(EspenakMeeus)
1132 , position(NULL)
1133 , timeSpeed(JD_SECOND)
1134- , JDay(0.)
1135+ , JD(0.,0.)
1136 , presetSkyTime(0.)
1137- , secondsOfLastJDayUpdate(0.)
1138- , JDayOfLastJDayUpdate(0.)
1139+ , secondsOfLastJDUpdate(0.)
1140+ , jdOfLastJDUpdate(0.)
1141 , deltaTCustomNDot(-26.0)
1142 , deltaTCustomYear(1820.0)
1143 {
1144@@ -173,7 +173,7 @@
1145 setInitTodayTime(QTime::fromString(conf->value("navigation/today_time", "22:00").toString()));
1146 startupTimeMode = conf->value("navigation/startup_time_mode", "actual").toString().toLower();
1147 if (startupTimeMode=="preset")
1148- setJDay(presetSkyTime - StelUtils::getGMTShiftFromQT(presetSkyTime) * JD_HOUR);
1149+ setJD(presetSkyTime - StelUtils::getGMTShiftFromQT(presetSkyTime) * JD_HOUR);
1150 else if (startupTimeMode=="today")
1151 setTodayTime(getInitTodayTime());
1152
1153@@ -766,7 +766,7 @@
1154 // called in update() (for every frame)
1155 void StelCore::updateTransformMatrices()
1156 {
1157- matAltAzToEquinoxEqu = position->getRotAltAzToEquatorial(JDay);
1158+ matAltAzToEquinoxEqu = position->getRotAltAzToEquatorial(getJD(), getJDE());
1159 matEquinoxEquToAltAz = matAltAzToEquinoxEqu.transpose();
1160
1161 // multiply static J2000 earth axis tilt (eclipticalJ2000<->equatorialJ2000)
1162@@ -865,26 +865,40 @@
1163 smmgr->zoomTo(smmgr->getInitFov(), 1.);
1164 }
1165
1166-void StelCore::setJDay(double JD)
1167-{
1168- JDay=JD;
1169- resetSync();
1170-}
1171-
1172-double StelCore::getJDay() const
1173-{
1174- return JDay;
1175-}
1176+void StelCore::setJD(double newJD)
1177+{
1178+ JD.first=newJD;
1179+ JD.second=computeDeltaT(newJD);
1180+ resetSync();
1181+}
1182+
1183+double StelCore::getJD() const
1184+{
1185+ return JD.first;
1186+}
1187+
1188+void StelCore::setJDE(double newJDE)
1189+{
1190+ // nitpickerish this is not exact, but as good as it gets...
1191+ JD.second=computeDeltaT(newJDE);
1192+ JD.first=newJDE-JD.second/86400.0;
1193+ resetSync();
1194+}
1195+
1196+double StelCore::getJDE() const
1197+{
1198+ return JD.first+JD.second/86400.0;
1199+}
1200+
1201
1202 void StelCore::setMJDay(double MJD)
1203 {
1204- JDay=MJD+2400000.5;
1205- resetSync();
1206+ setJD(MJD+2400000.5);
1207 }
1208
1209 double StelCore::getMJDay() const
1210 {
1211- return JDay-2400000.5;
1212+ return JD.first-2400000.5;
1213 }
1214
1215 double StelCore::getPresetSkyTime() const
1216@@ -993,9 +1007,7 @@
1217 //! Set stellarium time to current real world time
1218 void StelCore::setTimeNow()
1219 {
1220- double JD = StelUtils::getJDFromSystem();
1221- // add Delta-T correction for actual time
1222- setJDay(JD+getDeltaT(JD)/86400);
1223+ setJD(StelUtils::getJDFromSystem());
1224 }
1225
1226 void StelCore::setTodayTime(const QTime& target)
1227@@ -1006,7 +1018,7 @@
1228 dt.setTime(target);
1229 // don't forget to adjust for timezone / daylight savings.
1230 double JD = StelUtils::qDateTimeToJd(dt)-(StelUtils::getGMTShiftFromQT(StelUtils::getJDFromSystem()) * JD_HOUR);
1231- setJDay(JD + getDeltaT(JD)/86400);
1232+ setJD(JD);
1233 }
1234 else
1235 {
1236@@ -1019,12 +1031,12 @@
1237 bool StelCore::getIsTimeNow(void) const
1238 {
1239 // cache last time to prevent to much slow system call
1240- static double lastJD = getJDay();
1241- static bool previousResult = (fabs(getJDay()-(StelUtils::getJDFromSystem()+getDeltaT(lastJD)/86400))<JD_SECOND);
1242- if (fabs(lastJD-getJDay())>JD_SECOND/4)
1243+ static double lastJD = getJD();
1244+ static bool previousResult = (fabs(getJD()-(StelUtils::getJDFromSystem()))<JD_SECOND);
1245+ if (fabs(lastJD-getJD())>JD_SECOND/4)
1246 {
1247- lastJD = getJDay();
1248- previousResult = (fabs(getJDay()-(StelUtils::getJDFromSystem()+getDeltaT(lastJD)/86400))<JD_SECOND);
1249+ lastJD = getJD();
1250+ previousResult = (fabs(getJD()-(StelUtils::getJDFromSystem()))<JD_SECOND);
1251 }
1252 return previousResult;
1253 }
1254@@ -1034,14 +1046,14 @@
1255 return initTodayTime;
1256 }
1257
1258-void StelCore::setInitTodayTime(const QTime& t)
1259+void StelCore::setInitTodayTime(const QTime& time)
1260 {
1261- initTodayTime=t;
1262+ initTodayTime=time;
1263 }
1264
1265-void StelCore::setPresetSkyTime(QDateTime dt)
1266+void StelCore::setPresetSkyTime(QDateTime dateTime)
1267 {
1268- setPresetSkyTime(StelUtils::qDateTimeToJd(dt));
1269+ setPresetSkyTime(StelUtils::qDateTimeToJd(dateTime));
1270 }
1271
1272 void StelCore::addHour()
1273@@ -1250,7 +1262,7 @@
1274 if (home->getEnglishName() != "Solar System Observer")
1275 d *= home->getMeanSolarDay();
1276
1277- setJDay(getJDay() + d);
1278+ setJD(getJD() + d);
1279 }
1280
1281 void StelCore::addSiderealDays(double d)
1282@@ -1258,13 +1270,14 @@
1283 const PlanetP& home = position->getHomePlanet();
1284 if (home->getEnglishName() != "Solar System Observer")
1285 d *= home->getSiderealDay();
1286- setJDay(getJDay() + d);
1287+ setJD(getJD() + d);
1288 }
1289
1290 // Get the sidereal time shifted by the observer longitude
1291 double StelCore::getLocalSiderealTime() const
1292 {
1293- return (position->getHomePlanet()->getSiderealTime(JDay)+position->getCurrentLocation().longitude)*M_PI/180.;
1294+ // On Earth, this requires UT deliberately with all its faults, on other planets we use the more regular TT.
1295+ return (position->getHomePlanet()->getSiderealTime(getJD(), getJDE())+position->getCurrentLocation().longitude)*M_PI/180.;
1296 }
1297
1298 //! Get the duration of a sidereal day for the current observer in day.
1299@@ -1353,16 +1366,19 @@
1300 if (getRealTimeSpeed())
1301 {
1302 // Get rid of the error from the 1 /
1303- JDay = JDayOfLastJDayUpdate + (StelApp::getTotalRunTime() - secondsOfLastJDayUpdate) / ONE_OVER_JD_SECOND;
1304+ // JDay = JDayOfLastJDayUpdate + (StelApp::getTotalRunTime() - secondsOfLastJDayUpdate) / ONE_OVER_JD_SECOND;
1305+ // GZ I don't understand the comment. Is the constant wrong?
1306+ JD.first = jdOfLastJDUpdate + (StelApp::getTotalRunTime() - secondsOfLastJDUpdate) * JD_SECOND;
1307 }
1308 else
1309 {
1310- JDay = JDayOfLastJDayUpdate + (StelApp::getTotalRunTime() - secondsOfLastJDayUpdate) * timeSpeed;
1311+ JD.first = jdOfLastJDUpdate + (StelApp::getTotalRunTime() - secondsOfLastJDUpdate) * timeSpeed;
1312 }
1313
1314 // Fix time limits to -100000 to +100000 to prevent bugs
1315- if (JDay>38245309.499988) JDay = 38245309.499988;
1316- if (JDay<-34803211.500012) JDay = -34803211.500012;
1317+ if (JD.first>38245309.499988) JD.first = 38245309.499988;
1318+ if (JD.first<-34803211.500012) JD.first = -34803211.500012;
1319+ JD.second=computeDeltaT(JD.first);
1320
1321 if (position->isObserverLifeOver())
1322 {
1323@@ -1380,14 +1396,16 @@
1324 position->update(deltaTime);
1325
1326 // Position of sun and all the satellites (ie planets)
1327- SolarSystem* solsystem = (SolarSystem*)StelApp::getInstance().getModuleMgr().getModule("SolarSystem");
1328- solsystem->computePositions(getJDay(), position->getHomePlanet()->getHeliocentricEclipticPos());
1329+ // GZ maybe setting this static can speedup a bit?
1330+ static SolarSystem* solsystem = (SolarSystem*)StelApp::getInstance().getModuleMgr().getModule("SolarSystem");
1331+ // Likely the most important location where we need JDE:
1332+ solsystem->computePositions(getJDE(), position->getHomePlanet()->getHeliocentricEclipticPos());
1333 }
1334
1335 void StelCore::resetSync()
1336 {
1337- JDayOfLastJDayUpdate = getJDay();
1338- secondsOfLastJDayUpdate = StelApp::getTotalRunTime();
1339+ jdOfLastJDUpdate = getJD();
1340+ secondsOfLastJDUpdate = StelApp::getTotalRunTime();
1341 }
1342
1343 void StelCore::setStartupTimeMode(const QString& s)
1344@@ -1395,7 +1413,15 @@
1345 startupTimeMode = s;
1346 }
1347
1348-double StelCore::getDeltaT(double jDay) const
1349+// return precomputed DeltaT in seconds. Public.
1350+double StelCore::getDeltaT() const
1351+{
1352+ return JD.second;
1353+}
1354+
1355+
1356+// compute and return DeltaT in seconds. Try not to call it directly, current DeltaT, JD, and JDE are available.
1357+double StelCore::computeDeltaT(const double JD) const
1358 {
1359 double DeltaT = 0.;
1360 double ndot = 0.;
1361@@ -1410,149 +1436,156 @@
1362 case Schoch:
1363 // Schoch (1931) algorithm for DeltaT
1364 ndot = -29.68; // n.dot = -29.68"/cy/cy
1365- DeltaT = StelUtils::getDeltaTBySchoch(jDay);
1366+ DeltaT = StelUtils::getDeltaTBySchoch(JD);
1367 break;
1368 case Clemence:
1369 // Clemence (1948) algorithm for DeltaT
1370 ndot = -22.44; // n.dot = -22.44 "/cy/cy
1371- DeltaT = StelUtils::getDeltaTByClemence(jDay);
1372+ DeltaT = StelUtils::getDeltaTByClemence(JD);
1373 break;
1374 case IAU:
1375 // IAU (1952) algorithm for DeltaT, based on observations by Spencer Jones (1939)
1376 ndot = -22.44; // n.dot = -22.44 "/cy/cy
1377- DeltaT = StelUtils::getDeltaTByIAU(jDay);
1378+ DeltaT = StelUtils::getDeltaTByIAU(JD);
1379 break;
1380 case AstronomicalEphemeris:
1381 // Astronomical Ephemeris (1960) algorithm for DeltaT
1382 ndot = -22.44; // n.dot = -22.44 "/cy/cy
1383- DeltaT = StelUtils::getDeltaTByAstronomicalEphemeris(jDay);
1384+ DeltaT = StelUtils::getDeltaTByAstronomicalEphemeris(JD);
1385 break;
1386 case TuckermanGoldstine:
1387 // Tuckerman (1962, 1964) & Goldstine (1973) algorithm for DeltaT
1388 //FIXME: n.dot
1389 ndot = -22.44; // n.dot = -22.44 "/cy/cy ???
1390- DeltaT = StelUtils::getDeltaTByTuckermanGoldstine(jDay);
1391+ DeltaT = StelUtils::getDeltaTByTuckermanGoldstine(JD);
1392 break;
1393 case MullerStephenson:
1394 // Muller & Stephenson (1975) algorithm for DeltaT
1395 ndot = -37.5; // n.dot = -37.5 "/cy/cy
1396- DeltaT = StelUtils::getDeltaTByMullerStephenson(jDay);
1397+ DeltaT = StelUtils::getDeltaTByMullerStephenson(JD);
1398 break;
1399 case Stephenson1978:
1400 // Stephenson (1978) algorithm for DeltaT
1401 ndot = -30.0; // n.dot = -30.0 "/cy/cy
1402- DeltaT = StelUtils::getDeltaTByStephenson1978(jDay);
1403+ DeltaT = StelUtils::getDeltaTByStephenson1978(JD);
1404 break;
1405 case SchmadelZech1979:
1406 // Schmadel & Zech (1979) algorithm for DeltaT
1407 ndot = -23.8946; // n.dot = -23.8946 "/cy/cy
1408- DeltaT = StelUtils::getDeltaTBySchmadelZech1979(jDay);
1409+ DeltaT = StelUtils::getDeltaTBySchmadelZech1979(JD);
1410 break;
1411 case MorrisonStephenson1982:
1412 // Morrison & Stephenson (1982) algorithm for DeltaT (used by RedShift)
1413 ndot = -26.0; // n.dot = -26.0 "/cy/cy
1414- DeltaT = StelUtils::getDeltaTByMorrisonStephenson1982(jDay);
1415+ DeltaT = StelUtils::getDeltaTByMorrisonStephenson1982(JD);
1416 break;
1417 case StephensonMorrison1984:
1418 // Stephenson & Morrison (1984) algorithm for DeltaT
1419 ndot = -26.0; // n.dot = -26.0 "/cy/cy
1420- DeltaT = StelUtils::getDeltaTByStephensonMorrison1984(jDay);
1421+ DeltaT = StelUtils::getDeltaTByStephensonMorrison1984(JD);
1422 break;
1423 case StephensonHoulden:
1424 // Stephenson & Houlden (1986) algorithm for DeltaT
1425 ndot = -26.0; // n.dot = -26.0 "/cy/cy
1426- DeltaT = StelUtils::getDeltaTByStephensonHoulden(jDay);
1427+ DeltaT = StelUtils::getDeltaTByStephensonHoulden(JD);
1428 break;
1429 case Espenak:
1430 // Espenak (1987, 1989) algorithm for DeltaT
1431 //FIXME: n.dot
1432 ndot = -23.8946; // n.dot = -23.8946 "/cy/cy ???
1433- DeltaT = StelUtils::getDeltaTByEspenak(jDay);
1434+ DeltaT = StelUtils::getDeltaTByEspenak(JD);
1435 break;
1436 case Borkowski:
1437 // Borkowski (1988) algorithm for DeltaT, relates to ELP2000-85!
1438 ndot = -23.895; // GZ: I see -23.895 in the paper, not -23.859; (?) // n.dot = -23.859 "/cy/cy
1439- DeltaT = StelUtils::getDeltaTByBorkowski(jDay);
1440+ DeltaT = StelUtils::getDeltaTByBorkowski(JD);
1441 break;
1442 case SchmadelZech1988:
1443 // Schmadel & Zech (1988) algorithm for DeltaT
1444 //FIXME: n.dot
1445 ndot = -26.0; // n.dot = -26.0 "/cy/cy ???
1446- DeltaT = StelUtils::getDeltaTBySchmadelZech1988(jDay);
1447+ DeltaT = StelUtils::getDeltaTBySchmadelZech1988(JD);
1448 break;
1449 case ChaprontTouze:
1450 // Chapront-Touzé & Chapront (1991) algorithm for DeltaT
1451 ndot = -23.8946; // n.dot = -23.8946 "/cy/cy
1452- DeltaT = StelUtils::getDeltaTByChaprontTouze(jDay);
1453+ DeltaT = StelUtils::getDeltaTByChaprontTouze(JD);
1454 break;
1455 case StephensonMorrison1995:
1456 // Stephenson & Morrison (1995) algorithm for DeltaT
1457 ndot = -26.0; // n.dot = -26.0 "/cy/cy
1458- DeltaT = StelUtils::getDeltaTByStephensonMorrison1995(jDay);
1459+ DeltaT = StelUtils::getDeltaTByStephensonMorrison1995(JD);
1460 break;
1461 case Stephenson1997:
1462 // Stephenson (1997) algorithm for DeltaT
1463 ndot = -26.0; // n.dot = -26.0 "/cy/cy
1464- DeltaT = StelUtils::getDeltaTByStephenson1997(jDay);
1465+ DeltaT = StelUtils::getDeltaTByStephenson1997(JD);
1466 break;
1467 case ChaprontMeeus:
1468 // Chapront, Chapront-Touze & Francou (1997) & Meeus (1998) algorithm for DeltaT
1469 ndot = -25.7376; // n.dot = -25.7376 "/cy/cy
1470- DeltaT = StelUtils::getDeltaTByChaprontMeeus(jDay);
1471+ DeltaT = StelUtils::getDeltaTByChaprontMeeus(JD);
1472 break;
1473 case JPLHorizons:
1474 // JPL Horizons algorithm for DeltaT
1475 ndot = -25.7376; // n.dot = -25.7376 "/cy/cy
1476- DeltaT = StelUtils::getDeltaTByJPLHorizons(jDay);
1477+ DeltaT = StelUtils::getDeltaTByJPLHorizons(JD);
1478 break;
1479 case MeeusSimons:
1480 // Meeus & Simons (2000) algorithm for DeltaT
1481 ndot = -25.7376; // n.dot = -25.7376 "/cy/cy
1482- DeltaT = StelUtils::getDeltaTByMeeusSimons(jDay);
1483+ DeltaT = StelUtils::getDeltaTByMeeusSimons(JD);
1484 break;
1485 case ReingoldDershowitz:
1486 // Reingold & Dershowitz (2002, 2007) algorithm for DeltaT
1487 // FIXME: n.dot
1488 ndot = -26.0; // n.dot = -26.0 "/cy/cy ???
1489- DeltaT = StelUtils::getDeltaTByReingoldDershowitz(jDay);
1490+ DeltaT = StelUtils::getDeltaTByReingoldDershowitz(JD);
1491 break;
1492 case MontenbruckPfleger:
1493 // Montenbruck & Pfleger (2000) algorithm for DeltaT
1494 // NOTE: book not contains n.dot value
1495 // FIXME: n.dot
1496 ndot = -26.0; // n.dot = -26.0 "/cy/cy ???
1497- DeltaT = StelUtils::getDeltaTByMontenbruckPfleger(jDay);
1498+ DeltaT = StelUtils::getDeltaTByMontenbruckPfleger(JD);
1499 break;
1500 case MorrisonStephenson2004:
1501 // Morrison & Stephenson (2004, 2005) algorithm for DeltaT
1502 ndot = -26.0; // n.dot = -26.0 "/cy/cy
1503- DeltaT = StelUtils::getDeltaTByMorrisonStephenson2004(jDay);
1504+ DeltaT = StelUtils::getDeltaTByMorrisonStephenson2004(JD);
1505 break;
1506 case Reijs:
1507 // Reijs (2006) algorithm for DeltaT
1508 ndot = -26.0; // n.dot = -26.0 "/cy/cy
1509- DeltaT = StelUtils::getDeltaTByReijs(jDay);
1510+ DeltaT = StelUtils::getDeltaTByReijs(JD);
1511 break;
1512 case EspenakMeeus:
1513 // Espenak & Meeus (2006) algorithm for DeltaT
1514 ndot = -25.858; // n.dot = -25.858 "/cy/cy
1515- DeltaT = StelUtils::getDeltaTByEspenakMeeus(jDay);
1516+ DeltaT = StelUtils::getDeltaTByEspenakMeeus(JD);
1517+ break;
1518+ case EspenakMeeusZeroMoonAccel:
1519+ // This is a trying area. Something is wrong with DeltaT, maybe ndot is still not applied correctly.
1520+ // Espenak & Meeus (2006) algorithm for DeltaT
1521+ ndot = -25.858; // n.dot = -25.858 "/cy/cy
1522+ dontUseMoon = true;
1523+ DeltaT = StelUtils::getDeltaTByEspenakMeeus(JD);
1524 break;
1525 case Banjevic:
1526 // Banjevic (2006) algorithm for DeltaT
1527 ndot = -26.0; // n.dot = -26.0 "/cy/cy
1528- DeltaT = StelUtils::getDeltaTByBanjevic(jDay);
1529+ DeltaT = StelUtils::getDeltaTByBanjevic(JD);
1530 break;
1531 case IslamSadiqQureshi:
1532 // Islam, Sadiq & Qureshi (2008 + revisited 2013) algorithm for DeltaT (6 polynomials)
1533 ndot = -26.0; // n.dot = -26.0 "/cy/cy
1534- DeltaT = StelUtils::getDeltaTByIslamSadiqQureshi(jDay);
1535+ DeltaT = StelUtils::getDeltaTByIslamSadiqQureshi(JD);
1536 dontUseMoon = true; // Seems this solutions doesn't use value of secular acceleration of the Moon
1537 break;
1538 case KhalidSultanaZaidi:
1539 // M. Khalid, Mariam Sultana and Faheem Zaidi polinomial approximation of time period 1620-2013 (2014)
1540 ndot = -26.0; // n.dot = -26.0 "/cy/cy
1541- DeltaT = StelUtils::getDeltaTByKhalidSultanaZaidi(jDay);
1542+ DeltaT = StelUtils::getDeltaTByKhalidSultanaZaidi(JD);
1543 dontUseMoon = true; // Seems this solutions doesn't use value of secular acceleration of the Moon
1544 break;
1545 case Custom:
1546@@ -1560,14 +1593,14 @@
1547 ndot = getDeltaTCustomNDot(); // n.dot = custom value "/cy/cy
1548 int year, month, day;
1549 Vec3f coeff = getDeltaTCustomEquationCoefficients();
1550- StelUtils::getDateFromJulianDay(jDay, &year, &month, &day);
1551+ StelUtils::getDateFromJulianDay(JD, &year, &month, &day);
1552 double u = (StelUtils::getDecYear(year,month,day)-getDeltaTCustomYear())/100;
1553 DeltaT = coeff[0] + u*(coeff[1] + u*coeff[2]);
1554 break;
1555 }
1556
1557 if (!dontUseMoon)
1558- DeltaT += StelUtils::getMoonSecularAcceleration(jDay, ndot);
1559+ DeltaT += StelUtils::getMoonSecularAcceleration(JD, ndot);
1560
1561 return DeltaT;
1562 }
1563@@ -1604,91 +1637,94 @@
1564 description = q_("Correction is disabled. Use only if you know what you are doing!");
1565 break;
1566 case Schoch: // historical value.
1567- description = q_("This historical formula was obtained by C. Schoch in 1931 and was used by G. Henriksson in his article <em>Einstein's Theory of Relativity Confirmed by Ancient Solar Eclipses</em> (%1). See for more info %2here%3.").arg("2009").arg("<a href='http://journalofcosmology.com/AncientAstronomy123.html'>").arg("</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));
1568+ description = q_("This historical formula was obtained by C. Schoch in 1931 and was used by G. Henriksson in his article <em>Einstein's Theory of Relativity Confirmed by Ancient Solar Eclipses</em> (%1). See for more info %2here%3.").arg("2009").arg("<a href='http://journalofcosmology.com/AncientAstronomy123.html'>").arg("</a>").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
1569 break;
1570 case Clemence: // historical value.
1571- description = q_("This empirical equation was published by G. M. Clemence in the article <em>On the system of astronomical constants</em> (%1).").arg("<a href='http://adsabs.harvard.edu/abs/1948AJ.....53..169C'>1948</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));
1572+ description = q_("This empirical equation was published by G. M. Clemence in the article <em>On the system of astronomical constants</em> (%1).").arg("<a href='http://adsabs.harvard.edu/abs/1948AJ.....53..169C'>1948</a>").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
1573 break;
1574 case IAU: // historical value.
1575- description = q_("This formula is based on a study of post-1650 observations of the Sun, the Moon and the planets by Spencer Jones (%1) and used by Jean Meeus in his <em>Astronomical Formulae for Calculators</em>. It was also adopted in the PC program SunTracker Pro.").arg("<a href='http://adsabs.harvard.edu/abs/1939MNRAS..99..541S'>1939</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));
1576+ description = q_("This formula is based on a study of post-1650 observations of the Sun, the Moon and the planets by Spencer Jones (%1) and used by Jean Meeus in his <em>Astronomical Formulae for Calculators</em>. It was also adopted in the PC program SunTracker Pro.").arg("<a href='http://adsabs.harvard.edu/abs/1939MNRAS..99..541S'>1939</a>").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
1577 // find year of publication of AFFC
1578 break;
1579 case AstronomicalEphemeris: // historical value.
1580- description = q_("This is a slightly modified version of the IAU (1952) formula which was adopted in the <em>Astronomical Ephemeris</em> and in the <em>Canon of Solar Eclipses</em> by Mucke & Meeus (1983).").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));
1581+ description = q_("This is a slightly modified version of the IAU (1952) formula which was adopted in the <em>Astronomical Ephemeris</em> and in the <em>Canon of Solar Eclipses</em> by Mucke & Meeus (1983).").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
1582 // TODO: expand the sentence: ... adopted ... from 19xx-19yy?
1583 break;
1584 case TuckermanGoldstine: // historical value.
1585- description = q_("The tables of Tuckerman (1962, 1964) list the positions of the Sun, the Moon and the planets at 5- and 10-day intervals from 601 BCE to 1649 CE. The same relation was also implicitly adopted in the syzygy tables of Goldstine (1973).").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));
1586+ description = q_("The tables of Tuckerman (1962, 1964) list the positions of the Sun, the Moon and the planets at 5- and 10-day intervals from 601 BCE to 1649 CE. The same relation was also implicitly adopted in the syzygy tables of Goldstine (1973).").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
1587 // TODO: These tables are sometimes found cited, but I have no details. Maybe add "based on ... " ?
1588 break;
1589 case MullerStephenson:
1590- description = q_("This equation was published by P. M. Muller and F. R. Stephenson in the article <em>The accelerations of the earth and moon from early astronomical observations</em> (%1).").arg("<a href='http://adsabs.harvard.edu/abs/1975grhe.conf..459M'>1975</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));
1591+ description = q_("This equation was published by P. M. Muller and F. R. Stephenson in the article <em>The accelerations of the earth and moon from early astronomical observations</em> (%1).").arg("<a href='http://adsabs.harvard.edu/abs/1975grhe.conf..459M'>1975</a>").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
1592 break;
1593 case Stephenson1978:
1594- description = q_("This equation was published by F. R. Stephenson in the article <em>Pre-Telescopic Astronomical Observations</em> (%1).").arg("<a href='http://adsabs.harvard.edu/abs/1978tfer.conf....5S'>1978</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));
1595+ description = q_("This equation was published by F. R. Stephenson in the article <em>Pre-Telescopic Astronomical Observations</em> (%1).").arg("<a href='http://adsabs.harvard.edu/abs/1978tfer.conf....5S'>1978</a>").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
1596 break;
1597 case SchmadelZech1979: // outdated data fit, historical value?
1598- description = q_("This 12th-order polynomial equation (outdated and superseded by Schmadel & Zech (1988)) was published by L. D. Schmadel and G. Zech in the article <em>Polynomial approximations for the correction delta T E.T.-U.T. in the period 1800-1975</em> (%1) as fit through data published by Brouwer (1952).").arg("<a href='http://adsabs.harvard.edu/abs/1979AcA....29..101S'>1979</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));
1599+ description = q_("This 12th-order polynomial equation (outdated and superseded by Schmadel & Zech (1988)) was published by L. D. Schmadel and G. Zech in the article <em>Polynomial approximations for the correction delta T E.T.-U.T. in the period 1800-1975</em> (%1) as fit through data published by Brouwer (1952).").arg("<a href='http://adsabs.harvard.edu/abs/1979AcA....29..101S'>1979</a>").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
1600 break;
1601 case MorrisonStephenson1982:
1602- description = q_("This algorithm was adopted in P. Bretagnon & L. Simon's <em>Planetary Programs and Tables from -4000 to +2800</em> (1986) and in the PC planetarium program RedShift.").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));
1603+ description = q_("This algorithm was adopted in P. Bretagnon & L. Simon's <em>Planetary Programs and Tables from -4000 to +2800</em> (1986) and in the PC planetarium program RedShift.").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
1604 break;
1605 case StephensonMorrison1984: // PRIMARY SOURCE
1606- description = q_("This formula was published by F. R. Stephenson and L. V. Morrison in the article <em>Long-term changes in the rotation of the earth - 700 B.C. to A.D. 1980</em> (%1).").arg("<a href='http://adsabs.harvard.edu/abs/1984RSPTA.313...47S'>1984</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));
1607+ description = q_("This formula was published by F. R. Stephenson and L. V. Morrison in the article <em>Long-term changes in the rotation of the earth - 700 B.C. to A.D. 1980</em> (%1).").arg("<a href='http://adsabs.harvard.edu/abs/1984RSPTA.313...47S'>1984</a>").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
1608 break;
1609 case StephensonHoulden:
1610- description = q_("This algorithm is used in the PC planetarium program Guide 7.").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));
1611+ description = q_("This algorithm is used in the PC planetarium program Guide 7.").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
1612 break;
1613 case Espenak: // limited range, but wide availability?
1614- description = q_("This algorithm was given by F. Espenak in his <em>Fifty Year Canon of Solar Eclipses: 1986-2035</em> (1987) and in his <em>Fifty Year Canon of Lunar Eclipses: 1986-2035</em> (1989).").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));
1615+ description = q_("This algorithm was given by F. Espenak in his <em>Fifty Year Canon of Solar Eclipses: 1986-2035</em> (1987) and in his <em>Fifty Year Canon of Lunar Eclipses: 1986-2035</em> (1989).").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
1616 break;
1617 case Borkowski: // Linked to ELP2000-85, so it's important...
1618- description = q_("This formula was obtained by K.M. Borkowski (%1) from an analysis of 31 solar eclipse records dating between 2137 BCE and 1715 CE.").arg("<a href='http://adsabs.harvard.edu/abs/1988A&A...205L...8B'>1988</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));
1619+ description = q_("This formula was obtained by K.M. Borkowski (%1) from an analysis of 31 solar eclipse records dating between 2137 BCE and 1715 CE.").arg("<a href='http://adsabs.harvard.edu/abs/1988A&A...205L...8B'>1988</a>").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
1620 break;
1621 case SchmadelZech1988: // data fit through Stephenson&Morrison1984, which itself is important. Unclear who uses this version?
1622- description = q_("This 12th-order polynomial equation was published by L. D. Schmadel and G. Zech in the article <em>Empirical Transformations from U.T. to E.T. for the Period 1800-1988</em> (%1) as data fit through values given by Stephenson & Morrison (1984).").arg("<a href='http://adsabs.harvard.edu/abs/1988AN....309..219S'>1988</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));
1623+ description = q_("This 12th-order polynomial equation was published by L. D. Schmadel and G. Zech in the article <em>Empirical Transformations from U.T. to E.T. for the Period 1800-1988</em> (%1) as data fit through values given by Stephenson & Morrison (1984).").arg("<a href='http://adsabs.harvard.edu/abs/1988AN....309..219S'>1988</a>").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
1624 break;
1625 case ChaprontTouze:
1626- description = q_("This formula was adopted by M. Chapront-Touze & J. Chapront in the shortened version of the ELP 2000-85 lunar theory in their <em>Lunar Tables and Programs from 4000 B.C. to A.D. 8000</em> (1991).").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));
1627+ description = q_("This formula was adopted by M. Chapront-Touze & J. Chapront in the shortened version of the ELP 2000-85 lunar theory in their <em>Lunar Tables and Programs from 4000 B.C. to A.D. 8000</em> (1991).").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
1628 break;
1629 case StephensonMorrison1995:
1630- description = q_("This equation was published by F. R. Stephenson and L. V. Morrison in the article <em>Long-Term Fluctuations in the Earth's Rotation: 700 BC to AD 1990</em> (%1).").arg("<a href='http://adsabs.harvard.edu/abs/1995RSPTA.351..165S'>1995</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));
1631+ description = q_("This equation was published by F. R. Stephenson and L. V. Morrison in the article <em>Long-Term Fluctuations in the Earth's Rotation: 700 BC to AD 1990</em> (%1).").arg("<a href='http://adsabs.harvard.edu/abs/1995RSPTA.351..165S'>1995</a>").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
1632 break;
1633 case Stephenson1997:
1634- description = q_("F. R. Stephenson published this formula in his book <em>Historical Eclipses and Earth's Rotation</em> (%1).").arg("<a href='http://ebooks.cambridge.org/ebook.jsf?bid=CBO9780511525186'>1997</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));
1635+ description = q_("F. R. Stephenson published this formula in his book <em>Historical Eclipses and Earth's Rotation</em> (%1).").arg("<a href='http://ebooks.cambridge.org/ebook.jsf?bid=CBO9780511525186'>1997</a>").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
1636 break;
1637 case ChaprontMeeus:
1638- description = q_("From J. Meeus, <em>Astronomical Algorithms</em> (2nd ed., 1998), and widely used. Table for 1620..2000, and includes a variant of Chapront, Chapront-Touze & Francou (1997) for dates outside 1620..2000.").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));
1639+ description = q_("From J. Meeus, <em>Astronomical Algorithms</em> (2nd ed., 1998), and widely used. Table for 1620..2000, and includes a variant of Chapront, Chapront-Touze & Francou (1997) for dates outside 1620..2000.").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
1640 break;
1641 case JPLHorizons:
1642- description = q_("The JPL Solar System Dynamics Group of the NASA Jet Propulsion Laboratory use this formula in their interactive website %1JPL Horizons%2.").arg("<a href='http://ssd.jpl.nasa.gov/?horizons'>").arg("</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));
1643+ description = q_("The JPL Solar System Dynamics Group of the NASA Jet Propulsion Laboratory use this formula in their interactive website %1JPL Horizons%2.").arg("<a href='http://ssd.jpl.nasa.gov/?horizons'>").arg("</a>").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
1644 break;
1645 case MeeusSimons:
1646- description = q_("This polynome was published by J. Meeus and L. Simons in article <em>Polynomial approximations to Delta T, 1620-2000 AD</em> (%1).").arg("<a href='http://adsabs.harvard.edu/abs/2000JBAA..110..323M'>2000</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));
1647+ description = q_("This polynome was published by J. Meeus and L. Simons in article <em>Polynomial approximations to Delta T, 1620-2000 AD</em> (%1).").arg("<a href='http://adsabs.harvard.edu/abs/2000JBAA..110..323M'>2000</a>").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
1648 break;
1649 case MontenbruckPfleger: // uninspired
1650- description = q_("The fourth edition of O. Montenbruck & T. Pfleger's <em>Astronomy on the Personal Computer</em> (2000) provides simple 3rd-order polynomial data fits for the recent past.").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));
1651+ description = q_("The fourth edition of O. Montenbruck & T. Pfleger's <em>Astronomy on the Personal Computer</em> (2000) provides simple 3rd-order polynomial data fits for the recent past.").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
1652 break;
1653 case ReingoldDershowitz: //
1654- description = q_("E. M. Reingold & N. Dershowitz present this polynomial data fit in <em>Calendrical Calculations</em> (3rd ed. 2007) and in their <em>Calendrical Tabulations</em> (2002). It is based on Jean Meeus' <em>Astronomical Algorithms</em> (1991).").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));
1655+ description = q_("E. M. Reingold & N. Dershowitz present this polynomial data fit in <em>Calendrical Calculations</em> (3rd ed. 2007) and in their <em>Calendrical Tabulations</em> (2002). It is based on Jean Meeus' <em>Astronomical Algorithms</em> (1991).").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
1656 break;
1657 case MorrisonStephenson2004: // PRIMARY SOURCE
1658- description = q_("This important solution was published by L. V. Morrison and F. R. Stephenson in article <em>Historical values of the Earth's clock error %1T and the calculation of eclipses</em> (%2) with addendum in (%3).").arg(QChar(0x0394)).arg("<a href='http://adsabs.harvard.edu/abs/2004JHA....35..327M'>2004</a>").arg("<a href='http://adsabs.harvard.edu/abs/2005JHA....36..339M'>2005</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));
1659+ description = q_("This important solution was published by L. V. Morrison and F. R. Stephenson in article <em>Historical values of the Earth's clock error %1T and the calculation of eclipses</em> (%2) with addendum in (%3).").arg(QChar(0x0394)).arg("<a href='http://adsabs.harvard.edu/abs/2004JHA....35..327M'>2004</a>").arg("<a href='http://adsabs.harvard.edu/abs/2005JHA....36..339M'>2005</a>").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
1660 break;
1661 case Reijs:
1662- description = q_("From the Length of Day (LOD; as determined by Stephenson & Morrison (%2)), Victor Reijs derived a %1T formula by using a Simplex optimisation with a cosine and square function. This is based on a possible periodicy described by Stephenson (%2). See for more info %3here%4.").arg(QChar(0x0394)).arg("<a href='http://adsabs.harvard.edu/abs/2004JHA....35..327M'>2004</a>").arg("<a href='http://www.iol.ie/~geniet/eng/DeltaTeval.htm'>").arg("</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));
1663+ description = q_("From the Length of Day (LOD; as determined by Stephenson & Morrison (%2)), Victor Reijs derived a %1T formula by using a Simplex optimisation with a cosine and square function. This is based on a possible periodicy described by Stephenson (%2). See for more info %3here%4.").arg(QChar(0x0394)).arg("<a href='http://adsabs.harvard.edu/abs/2004JHA....35..327M'>2004</a>").arg("<a href='http://www.iol.ie/~geniet/eng/DeltaTeval.htm'>").arg("</a>").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
1664 break;
1665 case EspenakMeeus: // GENERAL SOLUTION
1666- description = q_("This solution by F. Espenak and J. Meeus, based on Morrison & Stephenson (2004) and a polynomial fit through tabulated values for 1600-2000, is used for the %1NASA Eclipse Web Site%2 and in their <em>Five Millennium Canon of Solar Eclipses: -1900 to +3000</em> (2006). This formula is also used in the solar, lunar and planetary ephemeris program SOLEX.").arg("<a href='http://eclipse.gsfc.nasa.gov/eclipse.html'>").arg("</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker)).append(" <em>").append(q_("Used by default.")).append("</em>");
1667+ description = q_("This solution by F. Espenak and J. Meeus, based on Morrison & Stephenson (2004) and a polynomial fit through tabulated values for 1600-2000, is used for the %1NASA Eclipse Web Site%2 and in their <em>Five Millennium Canon of Solar Eclipses: -1900 to +3000</em> (2006). This formula is also used in the solar, lunar and planetary ephemeris program SOLEX.").arg("<a href='http://eclipse.gsfc.nasa.gov/eclipse.html'>").arg("</a>").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker)).append(" <em>").append(q_("Used by default.")).append("</em>");
1668+ break;
1669+ case EspenakMeeusZeroMoonAccel: // PATCHED SOLUTION
1670+ description = q_("PATCHED VERSION WITHOUT ADDITIONAL LUNAR ACCELERATION. This solution by F. Espenak and J. Meeus, based on Morrison & Stephenson (2004) and a polynomial fit through tabulated values for 1600-2000, is used for the %1NASA Eclipse Web Site%2 and in their <em>Five Millennium Canon of Solar Eclipses: -1900 to +3000</em> (2006). This formula is also used in the solar, lunar and planetary ephemeris program SOLEX.").arg("<a href='http://eclipse.gsfc.nasa.gov/eclipse.html'>").arg("</a>").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker)).append(" <em>").append("</em>");
1671 break;
1672 case Banjevic:
1673- description = q_("This solution by B. Banjevic, based on Stephenson & Morrison (1984), was published in article <em>Ancient eclipses and dating the fall of Babylon</em> (%1).").arg("<a href='http://adsabs.harvard.edu/abs/2006POBeo..80..251B'>2006</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));
1674+ description = q_("This solution by B. Banjevic, based on Stephenson & Morrison (1984), was published in article <em>Ancient eclipses and dating the fall of Babylon</em> (%1).").arg("<a href='http://adsabs.harvard.edu/abs/2006POBeo..80..251B'>2006</a>").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
1675 break;
1676 case IslamSadiqQureshi:
1677- description = q_("This solution by S. Islam, M. Sadiq and M. S. Qureshi, based on Meeus & Simons (2000), was published in article <em>Error Minimization of Polynomial Approximation of DeltaT</em> (%1) and revisited by Sana Islam in 2013.").arg("<a href='http://www.ias.ac.in/jaa/dec2008/JAA610.pdf'>2008</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));
1678+ description = q_("This solution by S. Islam, M. Sadiq and M. S. Qureshi, based on Meeus & Simons (2000), was published in article <em>Error Minimization of Polynomial Approximation of DeltaT</em> (%1) and revisited by Sana Islam in 2013.").arg("<a href='http://www.ias.ac.in/jaa/dec2008/JAA610.pdf'>2008</a>").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
1679 break;
1680 case KhalidSultanaZaidi:
1681- description = q_("This polynomial approximation with 0.6 seconds of accuracy by M. Khalid, Mariam Sultana and Faheem Zaidi was published in <em>Delta T: Polynomial Approximation of Time Period 1620-2013</em> (%1).").arg("<a href='http://dx.doi.org/10.1155/2014/480964'>2014</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));
1682+ description = q_("This polynomial approximation with 0.6 seconds of accuracy by M. Khalid, Mariam Sultana and Faheem Zaidi was published in <em>Delta T: Polynomial Approximation of Time Period 1620-2013</em> (%1).").arg("<a href='http://dx.doi.org/10.1155/2014/480964'>2014</a>").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
1683 break;
1684 case Custom:
1685 description = q_("This is a quadratic formula for calculation of %1T with coefficients defined by the user.").arg(QChar(0x0394));
1686@@ -1699,7 +1735,7 @@
1687 return description;
1688 }
1689
1690-QString StelCore::getCurrentDeltaTAlgorithmValidRange(double jDay, QString *marker) const
1691+QString StelCore::getCurrentDeltaTAlgorithmValidRangeDescription(const double JD, QString *marker) const
1692 {
1693 QString validRange = "";
1694 QString validRangeAppendix = "";
1695@@ -1707,7 +1743,7 @@
1696 int year, month, day;
1697 int start = 0;
1698 int finish = 0;
1699- StelUtils::getDateFromJulianDay(jDay, &year, &month, &day);
1700+ StelUtils::getDateFromJulianDay(JD, &year, &month, &day);
1701 switch (getCurrentDeltaTAlgorithm())
1702 {
1703 case WithoutCorrection:
1704@@ -1818,6 +1854,7 @@
1705 finish = 1100; // not 1620; // GZ: Not applicable for telescopic era, and better not after 1100 (pers.comm.)
1706 break;
1707 case EspenakMeeus: // the default, range stated in the Canon, p. 14.
1708+ case EspenakMeeusZeroMoonAccel:
1709 start = -1999;
1710 finish = 3000;
1711 break;
1712@@ -1847,7 +1884,7 @@
1713 validRange = q_("Valid range of usage: between years %1 and %2, %3.").arg(start).arg(finish).arg(validRangeAppendix);
1714 else
1715 validRange = q_("Valid range of usage: between years %1 and %2.").arg(start).arg(finish);
1716- if (start > year || year > finish)
1717+ if ((year < start) || (finish < year))
1718 *marker = "*";
1719 }
1720 else
1721@@ -1857,8 +1894,7 @@
1722 }
1723
1724 // return if sky plus atmosphere is bright enough from sunlight so that e.g. screen labels should be rendered dark.
1725-// Could be renamed to isBrightDaylight()
1726-bool StelCore::isDay() const
1727+bool StelCore::isBrightDaylight() const
1728 {
1729 const Vec3d& sunPos = GETSTELMODULE(SolarSystem)->getSun()->getAltAzPosGeometric(this);
1730 return sunPos[2] > -0.12; // Nautical twilight (0.12 > sin (6 deg),
1731@@ -1866,5 +1902,5 @@
1732
1733 double StelCore::getCurrentEpoch() const
1734 {
1735- return 2000.0 + (getJDay() - 2451545.0)/365.25;
1736+ return 2000.0 + (getJD() - 2451545.0)/365.25;
1737 }
1738
1739=== modified file 'src/core/StelCore.hpp'
1740--- src/core/StelCore.hpp 2015-08-02 17:12:29 +0000
1741+++ src/core/StelCore.hpp 2015-08-03 13:17:13 +0000
1742@@ -28,6 +28,7 @@
1743 #include <QString>
1744 #include <QStringList>
1745 #include <QTime>
1746+#include <QPair>
1747
1748 class StelToneReproducer;
1749 class StelSkyDrawer;
1750@@ -124,6 +125,7 @@
1751 MorrisonStephenson2004, //!< Morrison & Stephenson (2004, 2005) algorithm for DeltaT
1752 Reijs, //!< Reijs (2006) algorithm for DeltaT
1753 EspenakMeeus, //!< Espenak & Meeus (2006) algorithm for DeltaT (Recommended, default)
1754+ EspenakMeeusZeroMoonAccel, // Espenak & Meeus (2006) algorithm for DeltaT (but without additional Lunar acceleration. FOR TESTING ONLY, NONPUBLIC)
1755 Banjevic, //!< Banjevic (2006) algorithm for DeltaT
1756 IslamSadiqQureshi, //!< Islam, Sadiq & Qureshi (2008 + revisited 2013) algorithm for DeltaT (6 polynomials)
1757 KhalidSultanaZaidi, //!< M. Khalid, Mariam Sultana and Faheem Zaidi polinomial approximation of time period 1620-2013 (2014)
1758@@ -269,7 +271,7 @@
1759 //! This is used only if the destination planet is different from the starting one.
1760 void moveObserverTo(const StelLocation& target, double duration=1., double durationIfPlanetChange=1.);
1761
1762- // Conversion in standar Julian time format
1763+ // Conversion in standard Julian time format
1764 static const double JD_SECOND;
1765 static const double JD_MINUTE;
1766 static const double JD_HOUR;
1767@@ -286,26 +288,21 @@
1768 //! Get the duration of a sidereal year for the current observer in days.
1769 double getLocalSiderealYearLength() const;
1770
1771- //! Return the startup mode, can be preset|Preset or anything else
1772+ //! Return the startup mode, can be "actual" (i.e. take current time from system),
1773+ //! "today" (take some time e.g. on the evening of today) or "preset" (completely preconfigured).
1774 QString getStartupTimeMode();
1775 void setStartupTimeMode(const QString& s);
1776
1777- //! Get Delta-T estimation for a given date.
1778- //! @param jDay the date and time expressed as a julian day
1779- //! @return Delta-T in seconds
1780- //! @note Thanks to Rob van Gent which create a collection from many formulas for calculation of Delta-T: http://www.staff.science.uu.nl/~gent0113/deltat/deltat.htm
1781- double getDeltaT(double jDay) const;
1782-
1783 //! Get info about valid range for current algorithm for calculation of Delta-T
1784- //! @param jDay the JD
1785- //! @param marker the marker for valid range
1786- //! @return valid range
1787- QString getCurrentDeltaTAlgorithmValidRange(double jDay, QString* marker) const;
1788+ //! @param JD the Julian Day number to test.
1789+ //! @param marker receives a string: "*" if jDay is outside valid range, or "?" if range unknown, else an empty string.
1790+ //! @return valid range as explanatory string.
1791+ QString getCurrentDeltaTAlgorithmValidRangeDescription(const double JD, QString* marker) const;
1792
1793 //! Checks for altitude of sun - is it night or day?
1794 //! @return true if sun higher than about -6 degrees, i.e. "day" includes civil twilight.
1795 //! @note Useful mostly for brightness-controlled GUI decisions like font colors.
1796- bool isDay() const;
1797+ bool isBrightDaylight() const;
1798
1799 //! Get value of the current Julian epoch (i.e. current year with decimal fraction, e.g. 2012.34567)
1800 double getCurrentEpoch() const;
1801@@ -367,16 +364,43 @@
1802 //! Return to the default location and set default landscape with atmosphere and fog effects
1803 void returnToHome();
1804
1805- //! Set the current date in Julian Day
1806- void setJDay(double JD);
1807- //! Get the current date in Julian Day
1808- double getJDay() const;
1809+ //! Set the current date in Julian Day (UT)
1810+ void setJD(double newJD);
1811+ //! Set the current date in Julian Day (TT).
1812+ //! The name is derived from the classical name "Ephemeris Time", of which TT is the successor.
1813+ //! It is still frequently used in the literature.
1814+ void setJDE(double newJDE);
1815+ //! Get the current date in Julian Day (UT).
1816+ double getJD() const;
1817+ //! Get the current date in Julian Day (TT).
1818+ //! The name is derived from the classical name "Ephemeris Time", of which TT is the successor.
1819+ //! It is still frequently used in the literature.
1820+ double getJDE() const;
1821
1822- //! Set the current date in Modified Julian Day
1823+ //! Set the current date in Modified Julian Day (UT).
1824+ //! MJD is simply JD-2400000.5, getting rid of large numbers and starting days at midnight.
1825+ //! It is mostly used in satellite contexts.
1826 void setMJDay(double MJD);
1827- //! Get the current date in Modified Julian Day
1828+ //! Get the current date in Modified Julian Day (UT)
1829 double getMJDay() const;
1830
1831+ //! Compute Delta-T estimation for a given date.
1832+ //! DeltaT is the accumulated effect of earth's rotation slowly getting slower, mostly caused by tidal braking by the Moon.
1833+ //! For accurate positioning of objects in the sky, we must compute earth-based clock-dependent things like earth rotation, hour angles etc.
1834+ //! using plain UT, but all orbital motions or rotation of the other planets must be computed in TT, which is a regular time frame.
1835+ //! Also satellites are computed in the UT frame because (1) they are short-lived and (2) must follow paths over earth ground.
1836+ //! (Note that we make no further difference between TT and DT, those are regarded equivalent for our purpose.)
1837+ //!
1838+ //! @param JD the date and time expressed as a Julian Day
1839+ //! @return DeltaT in seconds
1840+ //! @note Thanks to Rob van Gent which create a collection from many formulas for calculation of Delta-T: http://www.staff.science.uu.nl/~gent0113/deltat/deltat.htm
1841+ //! @note Use this only if needed, prefer calling getDeltaT() for access to the current value.
1842+ double computeDeltaT(const double JD) const;
1843+ //! Get current DeltaT.
1844+ double getDeltaT() const;
1845+
1846+
1847+
1848 //! Return the preset sky time in JD
1849 double getPresetSkyTime() const;
1850 //! Set the preset sky time from a JD
1851@@ -415,9 +439,9 @@
1852 //! get the initial "today time" from the config file
1853 QTime getInitTodayTime(void);
1854 //! set the initial "today time" from the config file
1855- void setInitTodayTime(const QTime& t);
1856+ void setInitTodayTime(const QTime& time);
1857 //! Set the preset sky time from a QDateTime
1858- void setPresetSkyTime(QDateTime dt);
1859+ void setPresetSkyTime(QDateTime dateTime);
1860
1861 //! Add one [Earth, solar] hour to the current simulation time.
1862 void addHour();
1863@@ -529,7 +553,7 @@
1864 //! the selected object is of the correct type - i.e. a planet.
1865 void moveObserverToSelected();
1866
1867- //! Set year for custom equation for calculation of Delta-T
1868+ //! Set central year for custom equation for calculation of Delta-T
1869 //! @param y the year, e.g. 1820
1870 void setDeltaTCustomYear(float y) { deltaTCustomYear=y; }
1871 //! Set n-dot for custom equation for calculation of Delta-T
1872@@ -539,7 +563,7 @@
1873 //! @param y the coefficients, e.g. -20,0,32
1874 void setDeltaTCustomEquationCoefficients(Vec3f c) { deltaTCustomEquationCoeff=c; }
1875
1876- //! Get year for custom equation for calculation of Delta-T
1877+ //! Get central year for custom equation for calculation of Delta-T
1878 float getDeltaTCustomYear() const { return deltaTCustomYear; }
1879 //! Get n-dot for custom equation for calculation of Delta-T
1880 float getDeltaTCustomNDot() const { return deltaTCustomNDot; }
1881@@ -573,6 +597,8 @@
1882 void updateTime(double deltaTime);
1883 void resetSync();
1884
1885+
1886+
1887 // Matrices used for every coordinate transfo
1888 Mat4d matHeliocentricEclipticJ2000ToAltAz; // Transform from heliocentric ecliptic Cartesian (VSOP87A) to topocentric (StelObserver) altazimuthal coordinate
1889 Mat4d matAltAzToHeliocentricEclipticJ2000; // Transform from topocentric (StelObserver) altazimuthal coordinate to heliocentric ecliptic Cartesian (VSOP87A)
1890@@ -597,12 +623,14 @@
1891
1892 // Time variables
1893 double timeSpeed; // Positive : forward, Negative : Backward, 1 = 1sec/sec
1894- double JDay; // Curent time in Julian day
1895+ //double JDay; // Current time in Julian day. IN V0.12 TO V0.14, this was JD in TT, and all places where UT was required had to subtract getDeltaT() explicitly.
1896+ QPair<double,double> JD; // From 0.14 on: JD.first=JD_UT, JD.second=DeltaT=TT-UT. To gain JD_TT, compute JDE=JD.first+JD.second or just call getJDE()
1897+ // Use is best with calls getJD()/setJD() and getJDE()/setJDE() to explicitly state which flavour of JD you need.
1898 double presetSkyTime;
1899 QTime initTodayTime;
1900 QString startupTimeMode;
1901- double secondsOfLastJDayUpdate; // Time in seconds when the time rate or time last changed
1902- double JDayOfLastJDayUpdate; // JDay when the time rate or time last changed
1903+ double secondsOfLastJDUpdate; // Time in seconds when the time rate or time last changed
1904+ double jdOfLastJDUpdate; // JD when the time rate or time last changed
1905
1906 // Variables for custom equation of Delta-T
1907 Vec3f deltaTCustomEquationCoeff;
1908
1909=== modified file 'src/core/StelMovementMgr.cpp'
1910--- src/core/StelMovementMgr.cpp 2015-07-24 14:56:52 +0000
1911+++ src/core/StelMovementMgr.cpp 2015-08-03 13:17:13 +0000
1912@@ -321,7 +321,7 @@
1913 {
1914 DragHistoryEntry e;
1915 e.runTime=StelApp::getInstance().getTotalRunTime();
1916- e.jd=core->getJDay();
1917+ e.jd=core->getJD();
1918 e.x=x;
1919 e.y=y;
1920 timeDragHistory.append(e);
1921@@ -907,7 +907,7 @@
1922 viewDirectionMountFrame = j2000ToMountFrame(v);
1923 }
1924
1925-void StelMovementMgr::panView(double deltaAz, double deltaAlt)
1926+void StelMovementMgr::panView(const double deltaAz, const double deltaAlt)
1927 {
1928 double azVision, altVision;
1929 StelUtils::rectToSphe(&azVision,&altVision,j2000ToMountFrame(viewDirectionJ2000));
1930@@ -947,7 +947,7 @@
1931 v2[2]=0; v2.normalize();
1932 double angle = (v2^v1)[2];
1933 double deltaDay = angle/(2.*M_PI)*core->getLocalSiderealDayLength();
1934- core->setJDay(core->getJDay()+deltaDay);
1935+ core->setJD(core->getJD()+deltaDay);
1936 addTimeDragPoint(x2, y2);
1937 }
1938 else
1939
1940=== modified file 'src/core/StelMovementMgr.hpp'
1941--- src/core/StelMovementMgr.hpp 2015-07-24 14:56:52 +0000
1942+++ src/core/StelMovementMgr.hpp 2015-08-03 13:17:13 +0000
1943@@ -117,7 +117,7 @@
1944 //! Changes to viewing direction are instantaneous.
1945 //! @param deltaAz change in azimuth angle in radians
1946 //! @param deltaAlt change in altitude angle in radians
1947- void panView(double deltaAz, double deltaAlt);
1948+ void panView(const double deltaAz, const double deltaAlt);
1949
1950 //! Set automove duration in seconds
1951 //! @param f the number of seconds it takes for an auto-move operation to complete.
1952
1953=== modified file 'src/core/StelObject.cpp'
1954--- src/core/StelObject.cpp 2015-07-28 13:22:40 +0000
1955+++ src/core/StelObject.cpp 2015-08-03 13:17:13 +0000
1956@@ -42,21 +42,15 @@
1957 // Get observer local sidereal coordinate
1958 Vec3d StelObject::getSiderealPosGeometric(const StelCore* core) const
1959 {
1960- // Hour Angle corrected to Delta-T value
1961- // TODO: make code readable by calling siderealTime(JD_UT), this should not contain a deltaT in its algorithm.
1962- double dt = (core->getDeltaT(core->getJDay())/240.)*M_PI/180.;
1963- return Mat4d::zrotation(-core->getLocalSiderealTime()+dt)* getEquinoxEquatorialPos(core);
1964+ return Mat4d::zrotation(-core->getLocalSiderealTime())* getEquinoxEquatorialPos(core);
1965 }
1966
1967 // Get observer local sidereal coordinates, deflected by refraction
1968 Vec3d StelObject::getSiderealPosApparent(const StelCore* core) const
1969 {
1970- Vec3d v=getAltAzPosApparent(core);
1971+ Vec3d v=getAltAzPosApparent(core); // These already come with refraction!
1972 v = core->altAzToEquinoxEqu(v, StelCore::RefractionOff);
1973- // Hour Angle corrected to Delta-T value
1974- // TODO: make code readable by calling siderealTime(JD_UT), this should not contain a deltaT in its algorithm.
1975- double dt = (core->getDeltaT(core->getJDay())/240.)*M_PI/180.;
1976- return Mat4d::zrotation(-core->getLocalSiderealTime()+dt)*v;
1977+ return Mat4d::zrotation(-core->getLocalSiderealTime())*v;
1978 }
1979
1980 Vec3d StelObject::getAltAzPosGeometric(const StelCore* core) const
1981@@ -204,9 +198,8 @@
1982 // and because the ecliptical grid of J2000 is also shown for observers on other planets.
1983 // The formulation here has never computed the true position of any observer planet's orbital plane except for Earth,
1984 // or ever displayed the coordinates in the observer planet's equivalent to Earth's ecliptical coordinates.
1985- // As quick test you can observe if in any "Ecliptic coordinate" as seen from e.g. Mars or Jupiter the Sun was ever close to beta=0.
1986+ // As quick test you can observe if in any "Ecliptic coordinate" as seen from e.g. Mars or Jupiter the Sun was ever close to beta=0 (except if crossing the node...).
1987
1988- //double ecl = core->getCurrentPlanet()->getRotObliquity(2451545.0);
1989 double ecl=GETSTELMODULE(SolarSystem)->getEarth()->getRotObliquity(2451545.0);
1990 double ra_equ, dec_equ, lambda, beta;
1991 StelUtils::rectToSphe(&ra_equ,&dec_equ,getJ2000EquatorialPos(core));
1992@@ -267,7 +260,7 @@
1993 {
1994 Vec3f color = getInfoColor();
1995 StelCore* core = StelApp::getInstance().getCore();
1996- if (core->isDay() && core->getSkyDrawer()->getFlagHasAtmosphere()==true)
1997+ if (core->isBrightDaylight() && core->getSkyDrawer()->getFlagHasAtmosphere()==true)
1998 {
1999 // make info text more readable when atmosphere enabled at daylight.
2000 color = StelUtils::strToVec3f(StelApp::getInstance().getSettings()->value("color/daylight_text_color", "0.0,0.0,0.0").toString());
2001
2002=== modified file 'src/core/StelObserver.cpp'
2003--- src/core/StelObserver.cpp 2015-07-27 21:55:05 +0000
2004+++ src/core/StelObserver.cpp 2015-08-03 13:17:13 +0000
2005@@ -77,9 +77,9 @@
2006
2007 // rotation:
2008 const RotationElements &r(dest->getRotationElements());
2009- lastJD = StelApp::getInstance().getCore()->getJDay();
2010+ lastJDE = StelApp::getInstance().getCore()->getJDE();
2011
2012- re.offset = r.offset + fmod(re.offset - r.offset + 360.0*( (lastJD-re.epoch)/re.period - (lastJD-r.epoch)/r.period), 360.0);
2013+ re.offset = r.offset + fmod(re.offset - r.offset + 360.0*( (lastJDE-re.epoch)/re.period - (lastJDE-r.epoch)/r.period), 360.0);
2014
2015 re.epoch = r.epoch;
2016 re.period = r.period;
2017@@ -218,25 +218,19 @@
2018 return rho*a;
2019 }
2020
2021-Mat4d StelObserver::getRotAltAzToEquatorial(double jd) const
2022+// For Earth we require JD, for other planets JDE to describe rotation!
2023+Mat4d StelObserver::getRotAltAzToEquatorial(double JD, double JDE) const
2024 {
2025 double lat = currentLocation.latitude;
2026 // TODO: Figure out how to keep continuity in sky as we reach poles
2027 // otherwise sky jumps in rotation when reach poles in equatorial mode
2028 // This is a kludge
2029- // GZ: Actually, why would that be? Lat should be clamped elsewhere. Added tests.
2030+ // GZ: Actually, why would that be? Lat should be clamped elsewhere. Added tests to track down problems in other locations.
2031 Q_ASSERT(lat <= 90.0);
2032 Q_ASSERT(lat >= -90.0);
2033 if( lat > 90.0 ) lat = 90.0;
2034 if( lat < -90.0 ) lat = -90.0;
2035- // Include a DeltaT correction. Sidereal time and longitude here are both in degrees, but DeltaT in seconds of time.
2036- // 360 degrees = 24hrs; 15 degrees = 1hr = 3600s; 1 degree = 240s
2037- // Apply DeltaT correction only for Earth
2038- // TODO: make code readable by calling siderealTime(JD_UT), this should not contain a deltaT in its algorithm.
2039- double deltaT = 0.;
2040- if (getHomePlanet()->getEnglishName()=="Earth")
2041- deltaT = StelApp::getInstance().getCore()->getDeltaT(jd)/240.;
2042- return Mat4d::zrotation((getHomePlanet()->getSiderealTime(jd)+currentLocation.longitude-deltaT)*M_PI/180.)
2043+ return Mat4d::zrotation((getHomePlanet()->getSiderealTime(JD, JDE)+currentLocation.longitude)*M_PI/180.)
2044 * Mat4d::yrotation((90.-lat)*M_PI/180.);
2045 }
2046
2047
2048=== modified file 'src/core/StelObserver.hpp'
2049--- src/core/StelObserver.hpp 2014-02-18 06:36:58 +0000
2050+++ src/core/StelObserver.hpp 2015-08-03 13:17:13 +0000
2051@@ -50,7 +50,10 @@
2052 Vec3d getCenterVsop87Pos(void) const;
2053 //! Get the distance between observer and home planet center in AU
2054 double getDistanceFromCenter(void) const;
2055- Mat4d getRotAltAzToEquatorial(double jd) const;
2056+
2057+ //! returns rotation matrix for conversion of alt-azimuthal to equatorial coordinates
2058+ //! For Earth we need JD(UT), for other planets JDE! To be general, just have both in here!
2059+ Mat4d getRotAltAzToEquatorial(double JD, double JDE) const;
2060 Mat4d getRotEquatorialToVsop87(void) const;
2061
2062 virtual const QSharedPointer<Planet> getHomePlanet(void) const;
2063
2064=== modified file 'src/core/StelUtils.hpp'
2065--- src/core/StelUtils.hpp 2015-05-10 08:29:58 +0000
2066+++ src/core/StelUtils.hpp 2015-08-03 13:17:13 +0000
2067@@ -326,7 +326,7 @@
2068 return Vec3f(max, 0, 0);
2069 }
2070
2071- //! Calculate and getting sidereal period in days from semi-major axis (in AU)
2072+ //! Calculate and return sidereal period in days from semi-major axis (in AU)
2073 double calculateSiderealPeriod(const double SemiMajorAxis);
2074
2075 //! Convert decimal hours to hours, minutes, seconds
2076
2077=== modified file 'src/core/TrailGroup.cpp'
2078--- src/core/TrailGroup.cpp 2015-05-12 07:00:45 +0000
2079+++ src/core/TrailGroup.cpp 2015-08-03 13:17:13 +0000
2080@@ -36,7 +36,7 @@
2081 {
2082 glEnable(GL_BLEND);
2083 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
2084- float currentTime = core->getJDay();
2085+ float currentTime = core->getJDE();
2086 StelProjector::ModelViewTranformP transfo = core->getJ2000ModelViewTransform();
2087 transfo->combine(j2000ToTrailNativeInverted);
2088 sPainter->setProjector(core->getProjection(transfo));
2089@@ -66,12 +66,12 @@
2090 // Add 1 point to all the curves at current time and suppress too old points
2091 void TrailGroup::update()
2092 {
2093- times.append(StelApp::getInstance().getCore()->getJDay());
2094+ times.append(StelApp::getInstance().getCore()->getJDE());
2095 for (QList<Trail>::Iterator iter=allTrails.begin();iter!=allTrails.end();++iter)
2096 {
2097 iter->posHistory.append(j2000ToTrailNative*iter->stelObject->getJ2000EquatorialPos(StelApp::getInstance().getCore()));
2098 }
2099- if (StelApp::getInstance().getCore()->getJDay()-times.at(0)>timeExtent)
2100+ if (StelApp::getInstance().getCore()->getJDE()-times.at(0)>timeExtent)
2101 {
2102 times.pop_front();
2103 for (QList<Trail>::Iterator iter=allTrails.begin();iter!=allTrails.end();++iter)
2104
2105=== modified file 'src/core/modules/Atmosphere.cpp'
2106--- src/core/modules/Atmosphere.cpp 2015-02-01 20:44:54 +0000
2107+++ src/core/modules/Atmosphere.cpp 2015-08-03 13:17:13 +0000
2108@@ -220,7 +220,7 @@
2109 }
2110 else
2111 eclipseFactor = 1.f;
2112-
2113+ // TODO: compute eclipse factor also for Lunar eclipses! (lp:#1471546)
2114
2115 // No need to calculate if not visible
2116 if (!fader.getInterstate())
2117
2118=== modified file 'src/core/modules/Comet.cpp'
2119--- src/core/modules/Comet.cpp 2015-03-15 15:47:35 +0000
2120+++ src/core/modules/Comet.cpp 2015-08-03 13:17:13 +0000
2121@@ -89,10 +89,10 @@
2122 dustTailBrightnessFactor(dustTailBrightnessFact)
2123 {
2124 texMapName = atexMapName;
2125- lastOrbitJD =0;
2126- deltaJD = StelCore::JD_SECOND;
2127- deltaJDtail=15.0*StelCore::JD_MINUTE; // update tail geometry every 15 minutes only
2128- lastJDtail=0.0;
2129+ lastOrbitJDE =0;
2130+ deltaJDE = StelCore::JD_SECOND;
2131+ deltaJDEtail=15.0*StelCore::JD_MINUTE; // update tail geometry every 15 minutes only
2132+ lastJDEtail=0.0;
2133 orbitCached = 0;
2134 closeOrbit = acloseOrbit;
2135
2136@@ -314,27 +314,27 @@
2137 {
2138 Planet::update(deltaTime);
2139
2140- // The rest used to be in computePosition(), but is better in update(). Unfortunately we need date (JD).
2141+ // The rest deals with updating tail geometries and brightness
2142 StelCore* core=StelApp::getInstance().getCore();
2143- double date=core->getJDay();
2144+ double dateJDE=core->getJDE();
2145
2146 // The CometOrbit is in fact available in userDataPtr!
2147 CometOrbit* orbit=(CometOrbit*)userDataPtr;
2148 Q_ASSERT(orbit);
2149- if (!orbit->objectDateValid(core->getJDay())) return; // don't do anything if out of useful date range. This allows having hundreds of comet elements.
2150+ if (!orbit->objectDateValid(dateJDE)) return; // don't do anything if out of useful date range. This allows having hundreds of comet elements.
2151
2152
2153 //GZ: I think we can make deltaJDtail adaptive, depending on distance to sun! For some reason though, this leads to a crash!
2154 //deltaJDtail=StelCore::JD_SECOND * qMax(1.0, qMin(eclipticPos.length(), 20.0));
2155
2156- if (fabs(lastJDtail-date)>deltaJDtail)
2157+ if (fabs(lastJDEtail-dateJDE)>deltaJDEtail)
2158 {
2159- lastJDtail=date;
2160+ lastJDEtail=dateJDE;
2161
2162 // The CometOrbit is in fact available in userDataPtr!
2163 CometOrbit* orbit=(CometOrbit*)userDataPtr;
2164 Q_ASSERT(orbit);
2165- if (!orbit->objectDateValid(date)) return; // out of useful date range. This should allow having hundreds of comet elements.
2166+ if (!orbit->objectDateValid(dateJDE)) return; // out of useful date range. This should allow having hundreds of comet elements.
2167
2168 if (orbit->getUpdateTails()){
2169 // Compute lengths and orientations from orbit object, but only if required.
2170@@ -457,7 +457,7 @@
2171 gastailColorArr.fill(gasColor, gastailVertexArr.length());
2172 dusttailColorArr.fill(dustColor, dusttailVertexArr.length());
2173 }
2174- //qDebug() << "Comet " << getEnglishName() << "JD: " << date << "gasR" << gasColor[0] << " dustR" << dustColor[0];
2175+ //qDebug() << "Comet " << getEnglishName() << "JDE: " << date << "gasR" << gasColor[0] << " dustR" << dustColor[0];
2176 }
2177
2178
2179@@ -483,7 +483,7 @@
2180 // The CometOrbit is in fact available in userDataPtr!
2181 CometOrbit* orbit=(CometOrbit*)userDataPtr;
2182 Q_ASSERT(orbit);
2183- if (!orbit->objectDateValid(core->getJDay())) return; // don't draw at all if out of useful date range. This allows having hundreds of comet elements.
2184+ if (!orbit->objectDateValid(core->getJDE())) return; // don't draw at all if out of useful date range. This allows having hundreds of comet elements.
2185
2186 Mat4d mat = Mat4d::translation(eclipticPos) * rotLocalToParent;
2187 // This removed totally the Planet shaking bug!!!
2188
2189=== modified file 'src/core/modules/Comet.hpp'
2190--- src/core/modules/Comet.hpp 2014-11-25 13:02:40 +0000
2191+++ src/core/modules/Comet.hpp 2015-08-03 13:17:13 +0000
2192@@ -96,14 +96,10 @@
2193 //! get sidereal period for comet, days, or returns 0 if not possible (paraboloid, hyperboloid orbit)
2194 virtual double getSiderealPeriod() const;
2195
2196- //! GZ: override from Planet: extend with tail details.
2197- //virtual void computePosition(const double date);
2198-
2199 //! re-implementation of Planet's draw()
2200 virtual void draw(StelCore* core, float maxMagLabels, const QFont& planetNameFont);
2201
2202 // re-implementation of Planet's update() to prepare tails (extinction etc). @param deltaTime: ms (since last call)
2203- // TODO: computePosition can be removed and things added here!
2204 virtual void update(int deltaTime);
2205
2206 private:
2207@@ -139,8 +135,8 @@
2208 Vec2f tailFactors; // result of latest call to getComaDiameterAndTailLengthAU(); Results cached here for infostring. [0]=Coma diameter, [1] gas tail length.
2209 bool tailActive; //! true if there is a tail long enough to be worth drawing. Drawing tails is quite costly.
2210 bool tailBright; //! true if tail is bright enough to draw.
2211- double deltaJDtail; //! like deltaJD, but time difference between tail geometry updates.
2212- double lastJDtail; //! like lastJD, but time of last tail geometry update.
2213+ double deltaJDEtail; //! like deltaJDE, but time difference between tail geometry updates.
2214+ double lastJDEtail; //! like lastJDE, but time of last tail geometry update.
2215 Mat4d gasTailRot; //! rotation matrix for gas tail parabola
2216 Mat4d dustTailRot; //! rotation matrix for the skewed dust tail parabola
2217 float dustTailWidthFactor; //!< empirical individual broadening of the dust tail end, compared to the gas tail end. Actually, dust tail width=2*comaWidth*dustTailWidthFactor. Default 1.5
2218
2219=== modified file 'src/core/modules/Constellation.cpp'
2220--- src/core/modules/Constellation.cpp 2015-07-27 14:57:16 +0000
2221+++ src/core/modules/Constellation.cpp 2015-08-03 13:17:13 +0000
2222@@ -260,7 +260,7 @@
2223 bool visible = false;
2224 int year, month, day;
2225 // Get the current month
2226- StelUtils::getDateFromJulianDay(StelApp::getInstance().getCore()->getJDay(), &year, &month, &day);
2227+ StelUtils::getDateFromJulianDay(StelApp::getInstance().getCore()->getJD(), &year, &month, &day);
2228 if (endSeason >= beginSeason)
2229 {
2230 // OK, it's a "normal" season rule...
2231
2232=== modified file 'src/core/modules/LandscapeMgr.cpp'
2233--- src/core/modules/LandscapeMgr.cpp 2015-07-13 13:42:56 +0000
2234+++ src/core/modules/LandscapeMgr.cpp 2015-08-03 13:17:13 +0000
2235@@ -233,7 +233,8 @@
2236 Vec3d sunPos = ssystem->getSun()->getAltAzPosApparent(core);
2237 // Compute the moon position in local coordinate
2238 Vec3d moonPos = ssystem->getMoon()->getAltAzPosApparent(core);
2239- atmosphere->computeColor(core->getJDay(), sunPos, moonPos,
2240+ // GZ: First parameter in next call is used for particularly earth-bound computations in Schaefer's sky brightness model. Difference DeltaT makes no difference here.
2241+ atmosphere->computeColor(core->getJDE(), sunPos, moonPos,
2242 ssystem->getMoon()->getPhaseAngle(ssystem->getEarth()->getHeliocentricEclipticPos()),
2243 core, core->getCurrentLocation().latitude, core->getCurrentLocation().altitude,
2244 15.f, 40.f); // Temperature = 15c, relative humidity = 40%
2245
2246=== modified file 'src/core/modules/MinorPlanet.cpp'
2247--- src/core/modules/MinorPlanet.cpp 2015-01-30 17:31:11 +0000
2248+++ src/core/modules/MinorPlanet.cpp 2015-08-03 13:17:13 +0000
2249@@ -64,8 +64,8 @@
2250 pTypeStr)
2251 {
2252 texMapName = atexMapName;
2253- lastOrbitJD =0;
2254- deltaJD = StelCore::JD_SECOND;
2255+ lastOrbitJDE =0;
2256+ deltaJDE = StelCore::JD_SECOND;
2257 orbitCached = 0;
2258 closeOrbit = acloseOrbit;
2259 semiMajorAxis = 0.;
2260@@ -143,7 +143,7 @@
2261 {
2262 semiMajorAxis = value;
2263 // GZ: in case we have very many asteroids, this helps improving speed usually without sacrificing accuracy:
2264- deltaJD = 2.0*semiMajorAxis*StelCore::JD_SECOND;
2265+ deltaJDE = 2.0*semiMajorAxis*StelCore::JD_SECOND;
2266 }
2267
2268 void MinorPlanet::setMinorPlanetNumber(int number)
2269
2270=== modified file 'src/core/modules/Orbit.cpp'
2271--- src/core/modules/Orbit.cpp 2015-02-23 09:56:53 +0000
2272+++ src/core/modules/Orbit.cpp 2015-08-03 13:17:13 +0000
2273@@ -222,15 +222,6 @@
2274 const double cj = cos(parentRotJ2000Longitude);
2275 const double sj = sin(parentRotJ2000Longitude);
2276
2277-// rotateToVsop87[0] = c_nod;
2278-// rotateToVsop87[1] = -s_nod * c_obl;
2279-// rotateToVsop87[2] = s_nod * s_obl;
2280-// rotateToVsop87[3] = s_nod;
2281-// rotateToVsop87[4] = c_nod * c_obl;
2282-// rotateToVsop87[5] = -c_nod * s_obl;
2283-// rotateToVsop87[6] = 0.0;
2284-// rotateToVsop87[7] = s_obl;
2285-// rotateToVsop87[8] = c_obl;
2286 rotateToVsop87[0] = c_nod*cj-s_nod*c_obl*sj;
2287 rotateToVsop87[1] = -c_nod*sj-s_nod*c_obl*cj;
2288 rotateToVsop87[2] = s_nod*s_obl;
2289@@ -243,20 +234,20 @@
2290 // qDebug() << "CometOrbit::()...done";
2291 }
2292
2293-void CometOrbit::positionAtTimevInVSOP87Coordinates(double JD, double *v, bool updateVelocityVector)
2294+void CometOrbit::positionAtTimevInVSOP87Coordinates(double JDE, double *v, bool updateVelocityVector)
2295 {
2296- JD -= t0;
2297+ JDE -= t0;
2298 double rCosNu,rSinNu;
2299 // temporary solve freezes for near-parabolic comets - using (e < 0.9999) for elliptical orbits
2300 // TODO: improve calculations orbits for near-parabolic comets --AW
2301 // if (e < 0.9999) InitEll(q,n,e,JD,a1,a2);
2302- if (e < 1.0) InitEll(q,n,e,JD,rCosNu,rSinNu); // GZ: After solving with Laguerre-Conway, I dare to go for 1.0.
2303+ if (e < 1.0) InitEll(q,n,e,JDE,rCosNu,rSinNu); // GZ: After solving with Laguerre-Conway, I dare to go for 1.0.
2304 else if (e > 1.0)
2305 {
2306 // qDebug() << "Hyperbolic orbit for ecc=" << e << ", i=" << i << ", w=" << w << ", Mean Motion n=" << n;
2307- InitHyp(q,n,e,JD,rCosNu,rSinNu);
2308+ InitHyp(q,n,e,JDE,rCosNu,rSinNu);
2309 }
2310- else InitPar(q,n,JD,rCosNu,rSinNu);
2311+ else InitPar(q,n,JDE,rCosNu,rSinNu);
2312 double p0,p1,p2, s0, s1, s2;
2313 Init3D(i,Om,w,rCosNu,rSinNu,p0,p1,p2, s0, s1, s2, updateVelocityVector, e, q);
2314 v[0] = rotateToVsop87[0]*p0 + rotateToVsop87[1]*p1 + rotateToVsop87[2]*p2;
2315@@ -475,34 +466,34 @@
2316 }
2317
2318 // Return the offset from the center.
2319-Vec3d EllipticalOrbit::positionAtTime(const double JD) const
2320+Vec3d EllipticalOrbit::positionAtTime(const double JDE) const
2321 {
2322 double meanMotion = 2.0 * M_PI / period;
2323- double meanAnomaly = meanAnomalyAtEpoch + (JD-epoch) * meanMotion;
2324+ double meanAnomaly = meanAnomalyAtEpoch + (JDE-epoch) * meanMotion;
2325 double E = eccentricAnomaly(meanAnomaly);
2326
2327 return positionAtE(E);
2328 }
2329
2330-//void EllipticalOrbit::positionAtTime(double JD, double * X, double * Y, double * Z) const
2331+//void EllipticalOrbit::positionAtTime(double JDE, double * X, double * Y, double * Z) const
2332 //{
2333-// Vec3d pos = positionAtTime(JD);
2334+// Vec3d pos = positionAtTime(JDE);
2335 // *X=pos[2];
2336 // *Y=pos[0];
2337 // *Z=pos[1];
2338 //}
2339
2340-//void EllipticalOrbit::positionAtTimev(double JD, double* v)
2341+//void EllipticalOrbit::positionAtTimev(double JDE, double* v)
2342 //{
2343-// Vec3d pos = positionAtTime(JD);
2344+// Vec3d pos = positionAtTime(JDE);
2345 // v[0]=pos[2];
2346 // v[1]=pos[0];
2347 // v[2]=pos[1];
2348 //}
2349
2350-void EllipticalOrbit::positionAtTimevInVSOP87Coordinates(const double JD, double* v) const
2351+void EllipticalOrbit::positionAtTimevInVSOP87Coordinates(const double JDE, double* v) const
2352 {
2353- Vec3d pos = positionAtTime(JD);
2354+ Vec3d pos = positionAtTime(JDE);
2355 v[0] = rotateToVsop87[0]*pos[0] + rotateToVsop87[1]*pos[1] + rotateToVsop87[2]*pos[2];
2356 v[1] = rotateToVsop87[3]*pos[0] + rotateToVsop87[4]*pos[1] + rotateToVsop87[5]*pos[2];
2357 v[2] = rotateToVsop87[6]*pos[0] + rotateToVsop87[7]*pos[1] + rotateToVsop87[8]*pos[2];
2358@@ -529,12 +520,12 @@
2359 }
2360
2361
2362-Vec3d CachingOrbit::positionAtTime(double jd) const
2363+Vec3d CachingOrbit::positionAtTime(double JDE) const
2364 {
2365- if (jd != lastTime)
2366+ if (JDE != lastTime)
2367 {
2368- lastTime = jd;
2369- lastPosition = computePosition(jd);
2370+ lastTime = JDE;
2371+ lastPosition = computePosition(JDE);
2372 }
2373 return lastPosition;
2374 }
2375
2376=== modified file 'src/core/modules/Orbit.hpp'
2377--- src/core/modules/Orbit.hpp 2015-02-23 09:56:53 +0000
2378+++ src/core/modules/Orbit.hpp 2015-08-03 13:17:13 +0000
2379@@ -51,10 +51,10 @@
2380 // which is the reference frame for VSOP87
2381 // In order to rotate to VSOP87
2382 // parentRotObliquity and parentRotAscendingnode must be supplied.
2383- void positionAtTimevInVSOP87Coordinates(const double JD, double* v) const;
2384+ void positionAtTimevInVSOP87Coordinates(const double JDE, double* v) const;
2385
2386 // Original one
2387- Vec3d positionAtTime(const double JD) const;
2388+ Vec3d positionAtTime(const double JDE) const;
2389 double getPeriod() const;
2390 double getBoundingRadius() const;
2391 virtual void sample(double, double, int, OrbitSampleProc&) const;
2392@@ -92,13 +92,13 @@
2393 );
2394 // Compute the orbit for a specified Julian day and return a "stellarium compliant" function
2395 // GZ: new optional variable: updateVelocityVector, true required for dust tail orientation!
2396- void positionAtTimevInVSOP87Coordinates(double JD, double* v, bool updateVelocityVector=true);
2397+ void positionAtTimevInVSOP87Coordinates(double JDE, double* v, bool updateVelocityVector=true);
2398 // updating the tails is a bit expensive. try not to overdo it.
2399 bool getUpdateTails() const { return updateTails; }
2400 void setUpdateTails(const bool update){ updateTails=update; }
2401- //! return speed value [AU/d] last computed by positionAtTimevInVSOP87Coordinates(JD, v, true)
2402+ //! return speed value [AU/d] last computed by positionAtTimevInVSOP87Coordinates(JDE, v, true)
2403 Vec3d getVelocity() const { return rdot; }
2404- bool objectDateValid(const double JD) const { return (fabs(t0-JD)<orbitGood); }
2405+ bool objectDateValid(const double JDE) const { return (fabs(t0-JDE)<orbitGood); }
2406 private:
2407 const double q; //! perihel distance
2408 const double e; //! eccentricity
2409@@ -134,11 +134,11 @@
2410 public:
2411 CachingOrbit() : lastTime(1.0e-30) {} //;
2412
2413- virtual Vec3d computePosition(double jd) const = 0;
2414+ virtual Vec3d computePosition(double JDE) const = 0;
2415 virtual double getPeriod() const = 0;
2416 virtual double getBoundingRadius() const = 0;
2417
2418- Vec3d positionAtTime(double jd) const;
2419+ Vec3d positionAtTime(double JDE) const;
2420
2421 virtual void sample(double, double, int, OrbitSampleProc& proc) const;
2422
2423
2424=== modified file 'src/core/modules/Planet.cpp'
2425--- src/core/modules/Planet.cpp 2015-07-28 13:20:32 +0000
2426+++ src/core/modules/Planet.cpp 2015-08-03 13:17:13 +0000
2427@@ -86,7 +86,7 @@
2428 axisRotation(0.),
2429 rings(NULL),
2430 sphereScale(1.f),
2431- lastJD(J2000),
2432+ lastJDE(J2000),
2433 coordFunc(coordFunc),
2434 userDataPtr(auserDataPtr),
2435 osculatingFunc(osculatingFunc),
2436@@ -97,11 +97,11 @@
2437 {
2438 texMapName = atexMapName;
2439 normalMapName = anormalMapName;
2440- lastOrbitJD =0;
2441- deltaJD = StelCore::JD_SECOND;
2442+ lastOrbitJDE =0;
2443+ deltaJDE = StelCore::JD_SECOND;
2444 orbitCached = 0;
2445 closeOrbit = acloseOrbit;
2446- deltaOrbitJD = 0;
2447+ deltaOrbitJDE = 0;
2448 distance = 0;
2449
2450 // Initialize pType with the key found in pTypeMap, or mark planet type as undefined.
2451@@ -118,7 +118,7 @@
2452 nativeName = "";
2453 if (englishName!="Pluto")
2454 {
2455- deltaJD = 0.001*StelCore::JD_SECOND;
2456+ deltaJDE = 0.001*StelCore::JD_SECOND;
2457 }
2458 flagLabels = true;
2459 flagNativeName = true;
2460@@ -383,7 +383,7 @@
2461 re.precessionRate = _precessionRate;
2462 re.siderealPeriod = _siderealPeriod; // used for drawing orbit lines
2463
2464- deltaOrbitJD = re.siderealPeriod/ORBIT_SEGMENTS;
2465+ deltaOrbitJDE = re.siderealPeriod/ORBIT_SEGMENTS;
2466 }
2467
2468 Vec3d Planet::getJ2000EquatorialPos(const StelCore *core) const
2469@@ -393,12 +393,12 @@
2470
2471 // Compute the position in the parent Planet coordinate system
2472 // Actually call the provided function to compute the ecliptical position
2473-void Planet::computePositionWithoutOrbits(const double dateJD)
2474+void Planet::computePositionWithoutOrbits(const double dateJDE)
2475 {
2476- if (fabs(lastJD-dateJD)>deltaJD)
2477+ if (fabs(lastJDE-dateJDE)>deltaJDE)
2478 {
2479- coordFunc(dateJD, eclipticPos, userDataPtr);
2480- lastJD = dateJD;
2481+ coordFunc(dateJDE, eclipticPos, userDataPtr);
2482+ lastJDE = dateJDE;
2483 }
2484 }
2485
2486@@ -406,11 +406,11 @@
2487 // TODO: For earth, decide whether this should be Capitaine's omega_A (angle eclipticPoleJ2000//axis) or epsilon_A (angle axis//current ecliptic pole)
2488 // For now, it is epsilon_A, the angle between earth's rotational axis and mean ecliptic of date.
2489 // Details: e.g. Hilton etal, Report on Precession and the Ecliptic, Cel.Mech.Dyn.Astr.94:351-67 (2006), Fig1.
2490-double Planet::getRotObliquity(double JDay) const
2491+double Planet::getRotObliquity(double JDE) const
2492 {
2493 // JDay=2451545.0 for J2000.0
2494 if (englishName=="Earth")
2495- return get_mean_ecliptical_obliquity(JDay) *M_PI/180.0;
2496+ return get_mean_ecliptical_obliquity(JDE) *M_PI/180.0;
2497 else
2498 return re.obliquity;
2499 }
2500@@ -459,28 +459,30 @@
2501 return res;
2502 }
2503
2504-void Planet::computePosition(const double dateJD)
2505+void Planet::computePosition(const double dateJDE)
2506 {
2507 // Make sure the parent position is computed for the dateJD, otherwise
2508 // getHeliocentricPos() would return incorect values.
2509 if (parent)
2510- parent->computePositionWithoutOrbits(dateJD);
2511+ parent->computePositionWithoutOrbits(dateJDE);
2512
2513- if (orbitFader.getInterstate()>0.000001 && deltaOrbitJD > 0 && (fabs(lastOrbitJD-dateJD)>deltaOrbitJD || !orbitCached))
2514+ if (orbitFader.getInterstate()>0.000001 && deltaOrbitJDE > 0 && (fabs(lastOrbitJDE-dateJDE)>deltaOrbitJDE || !orbitCached))
2515 {
2516+ StelCore *core=StelApp::getInstance().getCore();
2517+
2518 double calc_date;
2519 // int delta_points = (int)(0.5 + (date - lastOrbitJD)/date_increment);
2520 int delta_points;
2521
2522- if( dateJD > lastOrbitJD )
2523+ if( dateJDE > lastOrbitJDE )
2524 {
2525- delta_points = (int)(0.5 + (dateJD - lastOrbitJD)/deltaOrbitJD);
2526+ delta_points = (int)(0.5 + (dateJDE - lastOrbitJDE)/deltaOrbitJDE);
2527 }
2528 else
2529 {
2530- delta_points = (int)(-0.5 + (dateJD - lastOrbitJD)/deltaOrbitJD);
2531+ delta_points = (int)(-0.5 + (dateJDE - lastOrbitJDE)/deltaOrbitJDE);
2532 }
2533- double new_date = lastOrbitJD + delta_points*deltaOrbitJD;
2534+ double new_date = lastOrbitJDE + delta_points*deltaOrbitJDE;
2535
2536 // qDebug( "Updating orbit coordinates for %s (delta %f) (%d points)\n", getEnglishName().toUtf8().data(), deltaOrbitJD, delta_points);
2537
2538@@ -492,13 +494,13 @@
2539 if(d + delta_points >= ORBIT_SEGMENTS )
2540 {
2541 // calculate new points
2542- calc_date = new_date + (d-ORBIT_SEGMENTS/2)*deltaOrbitJD;
2543+ calc_date = new_date + (d-ORBIT_SEGMENTS/2)*deltaOrbitJDE;
2544
2545 // date increments between points will not be completely constant though
2546- computeTransMatrix(calc_date);
2547+ computeTransMatrix(calc_date-core->computeDeltaT(calc_date)/86400.0, calc_date);
2548 if (osculatingFunc)
2549 {
2550- (*osculatingFunc)(dateJD,calc_date,eclipticPos);
2551+ (*osculatingFunc)(dateJDE,calc_date,eclipticPos);
2552 }
2553 else
2554 {
2555@@ -514,7 +516,7 @@
2556 }
2557 }
2558
2559- lastOrbitJD = new_date;
2560+ lastOrbitJDE = new_date;
2561 }
2562 else if( delta_points < 0 && abs(delta_points) < ORBIT_SEGMENTS && orbitCached)
2563 {
2564@@ -524,11 +526,11 @@
2565 if(d + delta_points < 0 )
2566 {
2567 // calculate new points
2568- calc_date = new_date + (d-ORBIT_SEGMENTS/2)*deltaOrbitJD;
2569+ calc_date = new_date + (d-ORBIT_SEGMENTS/2)*deltaOrbitJDE;
2570
2571- computeTransMatrix(calc_date);
2572+ computeTransMatrix(calc_date-core->computeDeltaT(calc_date)/86400.0, calc_date);
2573 if (osculatingFunc) {
2574- (*osculatingFunc)(dateJD,calc_date,eclipticPos);
2575+ (*osculatingFunc)(dateJDE,calc_date,eclipticPos);
2576 }
2577 else
2578 {
2579@@ -544,7 +546,7 @@
2580 }
2581 }
2582
2583- lastOrbitJD = new_date;
2584+ lastOrbitJDE = new_date;
2585
2586 }
2587 else if( delta_points || !orbitCached)
2588@@ -553,11 +555,11 @@
2589 // update all points (less efficient)
2590 for( int d=0; d<ORBIT_SEGMENTS; d++ )
2591 {
2592- calc_date = dateJD + (d-ORBIT_SEGMENTS/2)*deltaOrbitJD;
2593- computeTransMatrix(calc_date);
2594+ calc_date = dateJDE + (d-ORBIT_SEGMENTS/2)*deltaOrbitJDE;
2595+ computeTransMatrix(calc_date-core->computeDeltaT(calc_date)/86400.0, calc_date);
2596 if (osculatingFunc)
2597 {
2598- (*osculatingFunc)(dateJD,calc_date,eclipticPos);
2599+ (*osculatingFunc)(dateJDE,calc_date,eclipticPos);
2600 }
2601 else
2602 {
2603@@ -567,36 +569,36 @@
2604 orbit[d] = getHeliocentricEclipticPos();
2605 }
2606
2607- lastOrbitJD = dateJD;
2608+ lastOrbitJDE = dateJDE;
2609 if (!osculatingFunc) orbitCached = 1;
2610 }
2611
2612
2613 // calculate actual Planet position
2614- coordFunc(dateJD, eclipticPos, userDataPtr);
2615+ coordFunc(dateJDE, eclipticPos, userDataPtr);
2616
2617- lastJD = dateJD;
2618+ lastJDE = dateJDE;
2619
2620 }
2621- else if (fabs(lastJD-dateJD)>deltaJD)
2622+ else if (fabs(lastJDE-dateJDE)>deltaJDE)
2623 {
2624 // calculate actual Planet position
2625- coordFunc(dateJD, eclipticPos, userDataPtr);
2626+ coordFunc(dateJDE, eclipticPos, userDataPtr);
2627 // XXX: do we need to do that even when the orbit is not visible?
2628 for( int d=0; d<ORBIT_SEGMENTS; d++ )
2629 orbit[d]=getHeliocentricPos(orbitP[d]);
2630- lastJD = dateJD;
2631+ lastJDE = dateJDE;
2632 }
2633
2634 }
2635
2636 // Compute the transformation matrix from the local Planet coordinate system to the parent Planet coordinate system.
2637-// In case of the planets, this makes the axis point to the respective celestial pole.
2638+// In case of the planets, this makes the axis point to their respective celestial poles.
2639 // TODO: Verify for the other planets if their axes are relative to J2000 ecliptic (VSOP87A XY plane) or relative to (precessed) ecliptic of date?
2640-void Planet::computeTransMatrix(double jd)
2641+void Planet::computeTransMatrix(double JD, double JDE)
2642 {
2643- // TODO: correct this for earth with the new model.
2644- axisRotation = getSiderealTime(jd);
2645+ // We have to call with both to correct this for earth with the new model.
2646+ axisRotation = getSiderealTime(JD, JDE);
2647
2648 // Special case - heliocentric coordinates are relative to eclipticJ2000 (VSOP87A XY plane),
2649 // not solar equator...
2650@@ -611,7 +613,7 @@
2651 // ADS: 2011A&A...534A..22V = A&A 534, A22 (2011): Vondrak, Capitane, Wallace: New Precession Expressions, valid for long time intervals:
2652 // See also Hilton et al, Report on Precession and the Ecliptic. Cel.Mech.Dyn.Astr. 94:351-367 (2006).
2653 double eps_A, chi_A, omega_A, psi_A;
2654- getPrecessionAnglesVondrak(jd, &eps_A, &chi_A, &omega_A, &psi_A);
2655+ getPrecessionAnglesVondrak(JDE, &eps_A, &chi_A, &omega_A, &psi_A);
2656 // GZ This is the right combination for precession of the equator: Nodal rotation psi_A,
2657 // then rotation by omega_A, the angle between EclPoleJ2000 and EarthPoleOfDate.
2658 // The final rotation by chi_A rotates the equinox (zero degree).
2659@@ -619,7 +621,7 @@
2660 rotLocalToParent= Mat4d::zrotation(-psi_A) * Mat4d::xrotation(-omega_A) * Mat4d::zrotation(chi_A);
2661 }
2662 else
2663- rotLocalToParent = Mat4d::zrotation(re.ascendingNode - re.precessionRate*(jd-re.epoch)) * Mat4d::xrotation(re.obliquity);
2664+ rotLocalToParent = Mat4d::zrotation(re.ascendingNode - re.precessionRate*(JDE-re.epoch)) * Mat4d::xrotation(re.obliquity);
2665 }
2666 }
2667
2668@@ -646,15 +648,16 @@
2669 }
2670
2671
2672-// Compute the z rotation to use from equatorial to geographic coordinates
2673-double Planet::getSiderealTime(double jd) const
2674+// Compute the z rotation to use from equatorial to geographic coordinates.
2675+// We need both JD and JDE here: For Earth we use JD(UT), for other planets JDE(TT).
2676+double Planet::getSiderealTime(double JD, double JDE) const
2677 {
2678 if (englishName=="Earth")
2679 { // GZ I wanted to be sure that nutation is just those ignorable few arcseconds.
2680 //qDebug() << "Difference apparent-mean sidereal times (s): " << (get_apparent_sidereal_time(jd)- get_mean_sidereal_time(jd))* 240.0; // 1degree=4min=240s.
2681 // TODO: Reactivate Nutation (but following IAU-2000A) after fixing JD_UT/JD_ET issues, then change this call back to apparent_sidereal_time.
2682 //return get_apparent_sidereal_time(jd);
2683- return get_mean_sidereal_time(jd);
2684+ return get_mean_sidereal_time(JD);
2685
2686 // In the newer precession/nutation literature (starting around 2006) there are two sets of algorithms:
2687 // "Classical" sidereal time (Greenwich hour angle GHA) and a solution based on Earth Rotational Angle ERA.
2688@@ -663,7 +666,7 @@
2689
2690 }
2691
2692- double t = jd - re.epoch;
2693+ double t = JDE - re.epoch;
2694 // oops... avoid division by zero (typical case for moons with chaotic period of rotation)
2695 double rotations = 1.f; // NOTE: Maybe 1e-3 will be better?
2696 if (re.period!=0.) // OK, it's not a moon with chaotic period of rotation :)
2697@@ -679,24 +682,24 @@
2698 {
2699 // use semi-empirical coefficient for GRS drift
2700 // qDebug() << "Jupiter: offset = " << re.offset << " --> rotation = " << (remainder * 360. + re.offset - 0.2483 * qAbs(jd - 2456172));
2701- return remainder * 360. + re.offset - 0.2483 * qAbs(jd - 2456172);
2702+ return remainder * 360. + re.offset - 0.2483 * qAbs(JDE - 2456172);
2703 }
2704 else
2705 {
2706 // http://www.projectpluto.com/grs_form.htm
2707 // CM( System II) = 181.62 + 870.1869147 * jd + correction [870d rotation every day]
2708 const double rad = M_PI/180.;
2709- double jup_mean = (jd - 2455636.938) * 360. / 4332.89709;
2710+ double jup_mean = (JDE - 2455636.938) * 360. / 4332.89709;
2711 double eqn_center = 5.55 * sin( rad*jup_mean);
2712- double angle = (jd - 2451870.628) * 360. / 398.884 - eqn_center;
2713+ double angle = (JDE - 2451870.628) * 360. / 398.884 - eqn_center;
2714 //double correction = 11 * sin( rad*angle) + 5 * cos( rad*angle)- 1.25 * cos( rad*jup_mean) - eqn_center; // original correction
2715 double correction = 25.8 + 11 * sin( rad*angle) - 2.5 * cos( rad*jup_mean) - eqn_center; // light speed correction not used because in stellarium the jd is manipulated for that
2716- double cm2=181.62 + 870.1869147 * jd + correction;
2717+ double cm2=181.62 + 870.1869147 * JDE + correction; // Central Meridian II
2718 cm2=cm2 - 360.0*(int)(cm2/360.);
2719 // http://www.skyandtelescope.com/observing/transit-times-of-jupiters-great-red-spot/ writes:
2720 // The predictions assume the Red Spot was at Jovian System II longitude 216° in September 2014 and continues to drift 1.25° per month, based on historical trends noted by JUPOS.
2721 // GRS longitude was at 2014-09-08 216d with a drift of 1.25d every month
2722- double longitudeGRS=216+1.25*( jd - 2456908)/30;
2723+ double longitudeGRS=216+1.25*( JDE - 2456908)/30;
2724 // qDebug() << "Jupiter: CM2 = " << cm2 << " longitudeGRS = " << longitudeGRS << " --> rotation = " << (cm2 - longitudeGRS);
2725 return cm2 - longitudeGRS + 25.; // + 25 = Jupiter Texture not 0d
2726 // To verify:
2727@@ -799,7 +802,7 @@
2728 distance = (obsHelioPos-getHeliocentricEclipticPos()).length();
2729 // improve fps by juggling updates for asteroids. They must be fast if close to observer, but can be slow if further away.
2730 if (pType == Planet::isAsteroid)
2731- deltaJD=distance*StelCore::JD_SECOND;
2732+ deltaJDE=distance*StelCore::JD_SECOND;
2733 return distance;
2734 }
2735
2736@@ -929,8 +932,8 @@
2737 {
2738 // add rings computation
2739 // implemented from Meeus, Astr.Alg.1992
2740- const double jd=core->getJDay();
2741- const double T=(jd-2451545.0)/36525.0;
2742+ const double jde=core->getJDE();
2743+ const double T=(jde-2451545.0)/36525.0;
2744 const double i=((0.000004*T-0.012998)*T+28.075216)*M_PI/180.0;
2745 const double Omega=((0.000412*T+1.394681)*T+169.508470)*M_PI/180.0;
2746 static SolarSystem *ssystem=GETSTELMODULE(SolarSystem);
2747@@ -968,8 +971,8 @@
2748 {
2749 // add rings computation
2750 // implemented from Meeus, Astr.Alg.1992
2751- const double jd=core->getJDay();
2752- const double T=(jd-2451545.0)/36525.0;
2753+ const double jde=core->getJDE();
2754+ const double T=(jde-2451545.0)/36525.0;
2755 const double i=((0.000004*T-0.012998)*T+28.075216)*M_PI/180.0;
2756 const double Omega=((0.000412*T+1.394681)*T+169.508470)*M_PI/180.0;
2757 SolarSystem *ssystem=GETSTELMODULE(SolarSystem);
2758@@ -1006,8 +1009,8 @@
2759 {
2760 // add rings computation
2761 // implemented from Meeus, Astr.Alg.1992
2762- const double jd=core->getJDay();
2763- const double T=(jd-2451545.0)/36525.0;
2764+ const double jde=core->getJDE();
2765+ const double T=(jde-2451545.0)/36525.0;
2766 const double i=((0.000004*T-0.012998)*T+28.075216)*M_PI/180.0;
2767 const double Omega=((0.000412*T+1.394681)*T+169.508470)*M_PI/180.0;
2768 static SolarSystem *ssystem=GETSTELMODULE(SolarSystem);
2769
2770=== modified file 'src/core/modules/Planet.hpp'
2771--- src/core/modules/Planet.hpp 2015-07-27 13:25:39 +0000
2772+++ src/core/modules/Planet.hpp 2015-08-03 13:17:13 +0000
2773@@ -33,7 +33,7 @@
2774 // The last variable is the userData pointer.
2775 typedef void (*posFuncType)(double, double*, void*);
2776
2777-typedef void (OsculatingFunctType)(double jd0,double jd,double xyz[3]);
2778+typedef void (OsculatingFunctType)(double jde0,double jde,double xyz[3]);
2779
2780 // epoch J2000: 12 UT on 1 Jan 2000
2781 #define J2000 2451545.0
2782@@ -51,7 +51,7 @@
2783 RotationElements(void) : period(1.), offset(0.), epoch(J2000), obliquity(0.), ascendingNode(0.), precessionRate(0.), siderealPeriod(0.) {}
2784 float period; // (sidereal) rotation period [earth days]
2785 float offset; // rotation at epoch [degrees]
2786- double epoch; // JD (TD) of epoch for these elements
2787+ double epoch; // JDE (JD TT) of epoch for these elements
2788 float obliquity; // tilt of rotation axis w.r.t. ecliptic [radians]
2789 float ascendingNode; // long. of ascending node of equator on the ecliptic [radians]
2790 float precessionRate; // rate of precession of rotation axis in [rads/JulianCentury(36525d)]
2791@@ -192,20 +192,22 @@
2792 const QString getApparentMagnitudeAlgorithmString() const { return vMagAlgorithmMap.value(vMagAlgorithm); }
2793 void setApparentMagnitudeAlgorithm(QString algorithm);
2794
2795- // Compute the z rotation to use from equatorial to geographic coordinates
2796- double getSiderealTime(double jd) const;
2797+ //! Compute the z rotation to use from equatorial to geographic coordinates. For general applicability we need both time flavours:
2798+ //! @param JD is JD(UT) for Earth
2799+ //! @param JDE is used for other locations
2800+ double getSiderealTime(double JD, double JDE) const;
2801 Mat4d getRotEquatorialToVsop87(void) const;
2802 void setRotEquatorialToVsop87(const Mat4d &m);
2803
2804 const RotationElements &getRotationElements(void) const {return re;}
2805
2806 // Compute the position in the parent Planet coordinate system
2807- void computePositionWithoutOrbits(const double dateJD);
2808- //virtual void computePosition(const double dateJD);// GZ: gets overridden in Comet!
2809- void computePosition(const double dateJD);// GZ: gets overridden in Comet!
2810+ void computePositionWithoutOrbits(const double dateJDE);
2811+ void computePosition(const double dateJDE);
2812
2813- // Compute the transformation matrix from the local Planet coordinate to the parent Planet coordinate
2814- void computeTransMatrix(double date);
2815+ // Compute the transformation matrix from the local Planet coordinate to the parent Planet coordinate.
2816+ // This requires both flavours of JD in cases involving Earth.
2817+ void computeTransMatrix(double JD, double JDE);
2818
2819 // Get the phase angle (rad) for an observer at pos obsPos in heliocentric coordinates (in AU)
2820 double getPhaseAngle(const Vec3d& obsPos) const;
2821@@ -223,7 +225,7 @@
2822 double getRotAscendingnode(void) const {return re.ascendingNode;}
2823 // return angle between axis and normal of ecliptic plane (or, for a moon, equatorial/reference plane defined by parent).
2824 // TODO: decide if this is always angle between axis and J2000 ecliptic, or should be axis//current ecliptic!
2825- double getRotObliquity(double JDay) const;
2826+ double getRotObliquity(double JDE) const;
2827
2828 //! Get the Planet position in the parent Planet ecliptic coordinate in AU
2829 Vec3d getEclipticPos() const;
2830@@ -277,9 +279,9 @@
2831 void drawOrbit(const StelCore*);
2832 Vec3d orbit[ORBIT_SEGMENTS+1]; // store heliocentric coordinates for drawing the orbit
2833 Vec3d orbitP[ORBIT_SEGMENTS+1]; // store local coordinate for orbit
2834- double lastOrbitJD;
2835- double deltaJD; // time difference between positional updates.
2836- double deltaOrbitJD;
2837+ double lastOrbitJDE;
2838+ double deltaJDE; // time difference between positional updates.
2839+ double deltaOrbitJDE;
2840 bool orbitCached; // whether orbit calculations are cached for drawing orbit yet
2841 bool closeOrbit; // whether to connect the beginning of the orbit line to
2842 // the end: good for elliptical orbits, bad for parabolic
2843@@ -336,8 +338,8 @@
2844 double distance; // Temporary variable used to store the distance to a given point
2845 // it is used for sorting while drawing
2846 float sphereScale; // Artificial scaling for better viewing
2847- double lastJD; // caches JD of last positional computation
2848- // The callback for the calculation of the equatorial rect heliocentric position at time JD.
2849+ double lastJDE; // caches JDE of last positional computation
2850+ // The callback for the calculation of the equatorial rect heliocentric position at time JDE.
2851 posFuncType coordFunc;
2852 void* userDataPtr; // this is always used with an Orbit object.
2853
2854
2855=== modified file 'src/core/modules/SolarSystem.cpp'
2856--- src/core/modules/SolarSystem.cpp 2015-07-27 14:57:16 +0000
2857+++ src/core/modules/SolarSystem.cpp 2015-08-03 13:17:13 +0000
2858@@ -1024,47 +1024,49 @@
2859
2860 // Compute the position for every elements of the solar system.
2861 // The order is not important since the position is computed relatively to the mother body
2862-void SolarSystem::computePositions(double date, const Vec3d& observerPos)
2863+void SolarSystem::computePositions(double dateJDE, const Vec3d& observerPos)
2864 {
2865 if (flagLightTravelTime)
2866 {
2867 foreach (PlanetP p, systemPlanets)
2868 {
2869- p->computePositionWithoutOrbits(date);
2870+ p->computePositionWithoutOrbits(dateJDE);
2871 }
2872 foreach (PlanetP p, systemPlanets)
2873 {
2874 const double light_speed_correction = (p->getHeliocentricEclipticPos()-observerPos).length() * (AU / (SPEED_OF_LIGHT * 86400));
2875- p->computePosition(date-light_speed_correction);
2876+ p->computePosition(dateJDE-light_speed_correction);
2877 }
2878 }
2879 else
2880 {
2881 foreach (PlanetP p, systemPlanets)
2882 {
2883- p->computePosition(date);
2884+ p->computePosition(dateJDE);
2885 }
2886 }
2887- computeTransMatrices(date, observerPos);
2888+ computeTransMatrices(dateJDE, observerPos);
2889 }
2890
2891 // Compute the transformation matrix for every elements of the solar system.
2892 // The elements have to be ordered hierarchically, eg. it's important to compute earth before moon.
2893-void SolarSystem::computeTransMatrices(double date, const Vec3d& observerPos)
2894+void SolarSystem::computeTransMatrices(double dateJDE, const Vec3d& observerPos)
2895 {
2896+ double dateJD=dateJDE - (StelApp::getInstance().getCore()->computeDeltaT(dateJDE))/86400.0;
2897+
2898 if (flagLightTravelTime)
2899 {
2900 foreach (PlanetP p, systemPlanets)
2901 {
2902 const double light_speed_correction = (p->getHeliocentricEclipticPos()-observerPos).length() * (AU / (SPEED_OF_LIGHT * 86400));
2903- p->computeTransMatrix(date-light_speed_correction);
2904+ p->computeTransMatrix(dateJD-light_speed_correction, dateJDE-light_speed_correction);
2905 }
2906 }
2907 else
2908 {
2909 foreach (PlanetP p, systemPlanets)
2910 {
2911- p->computeTransMatrix(date);
2912+ p->computeTransMatrix(dateJD, dateJDE);
2913 }
2914 }
2915 }
2916
2917=== modified file 'src/core/modules/SolarSystem.hpp'
2918--- src/core/modules/SolarSystem.hpp 2015-07-05 19:48:33 +0000
2919+++ src/core/modules/SolarSystem.hpp 2015-08-03 13:17:13 +0000
2920@@ -342,9 +342,9 @@
2921
2922 //! Compute the position and transform matrix for every element of the solar system.
2923 //! @param observerPos Position of the observer in heliocentric ecliptic frame (Required for light travel time computation).
2924- //! @param date the date in JDay
2925+ //! @param dateJDE the Julian Day in JDE (Ephemeris Time or equivalent)
2926 //! \deprecated ??? In the "deprecated" section, but used in SolarSystem::init()
2927- void computePositions(double date, const Vec3d& observerPos = Vec3d(0.));
2928+ void computePositions(double dateJDE, const Vec3d& observerPos = Vec3d(0.));
2929
2930 //! Get the list of all the bodies of the solar system.
2931 //! \deprecated Used in LandscapeMgr::update(), but commented out.
2932@@ -372,7 +372,7 @@
2933
2934 //! Compute the transformation matrix for every elements of the solar system.
2935 //! observerPos is needed for light travel time computation.
2936- void computeTransMatrices(double date, const Vec3d& observerPos = Vec3d(0.));
2937+ void computeTransMatrices(double dateJDE, const Vec3d& observerPos = Vec3d(0.));
2938
2939 //! Draw a nice animated pointer around the object.
2940 void drawPointer(const StelCore* core);
2941
2942=== modified file 'src/core/modules/StarWrapper.cpp'
2943--- src/core/modules/StarWrapper.cpp 2015-06-12 18:45:39 +0000
2944+++ src/core/modules/StarWrapper.cpp 2015-08-03 13:17:13 +0000
2945@@ -247,7 +247,7 @@
2946 {
2947 // Calculate next minimum or maximum light
2948 double vsEpoch = 2400000+vEpoch;
2949- double npDate = vsEpoch + vPeriod * ::floor(1.0 + (core->getJDay() - vsEpoch)/vPeriod);
2950+ double npDate = vsEpoch + vPeriod * ::floor(1.0 + (core->getJDE() - vsEpoch)/vPeriod);
2951 QString nextDate = StelUtils::julianDayToISO8601String(npDate).replace("T", " ");
2952 if (ebsFlag)
2953 oss << q_("Next minimum light: %1 UTC").arg(nextDate) << "<br />";
2954
2955=== modified file 'src/core/modules/StarWrapper.hpp'
2956--- src/core/modules/StarWrapper.hpp 2015-01-02 16:18:33 +0000
2957+++ src/core/modules/StarWrapper.hpp 2015-08-03 13:17:13 +0000
2958@@ -77,7 +77,7 @@
2959 {
2960 static const double d2000 = 2451545.0;
2961 Vec3f v;
2962- s->getJ2000Pos(z, (M_PI/180.)*(0.0001/3600.) * ((core->getJDay()-d2000)/365.25) / a->star_position_scale, v);
2963+ s->getJ2000Pos(z, (M_PI/180.)*(0.0001/3600.) * ((core->getJDE()-d2000)/365.25) / a->star_position_scale, v);
2964 return Vec3d(v[0], v[1], v[2]);
2965 }
2966 Vec3f getInfoColor(void) const
2967
2968=== modified file 'src/core/modules/ZodiacalLight.cpp'
2969--- src/core/modules/ZodiacalLight.cpp 2015-06-30 18:34:14 +0000
2970+++ src/core/modules/ZodiacalLight.cpp 2015-08-03 13:17:13 +0000
2971@@ -93,7 +93,7 @@
2972 // Test if we are not on Earth. Texture would not fit, so don't draw then.
2973 if (core->getCurrentLocation().planetName != "Earth") return;
2974
2975- double currentJD=core->getJDay();
2976+ double currentJD=core->getJD();
2977 if (qAbs(currentJD - lastJD) > 0.25f) // should be enough to update position every 6 hours.
2978 {
2979 // update vertices
2980
2981=== modified file 'src/core/modules/ZoneArray.cpp'
2982--- src/core/modules/ZoneArray.cpp 2015-02-08 15:35:27 +0000
2983+++ src/core/modules/ZoneArray.cpp 2015-08-03 13:17:13 +0000
2984@@ -467,7 +467,7 @@
2985 StelSkyDrawer* drawer = core->getSkyDrawer();
2986 Vec3f vf;
2987 static const double d2000 = 2451545.0;
2988- const float movementFactor = (M_PI/180)*(0.0001/3600) * ((core->getJDay()-d2000)/365.25) / star_position_scale;
2989+ const float movementFactor = (M_PI/180)*(0.0001/3600) * ((core->getJDE()-d2000)/365.25) / star_position_scale;
2990
2991 // GZ, added for extinction
2992 const Extinction& extinction=core->getSkyDrawer()->getExtinction();
2993@@ -549,7 +549,7 @@
2994 QList<StelObjectP > &result)
2995 {
2996 static const double d2000 = 2451545.0;
2997- const double movementFactor = (M_PI/180.)*(0.0001/3600.) * ((core->getJDay()-d2000)/365.25)/ star_position_scale;
2998+ const double movementFactor = (M_PI/180.)*(0.0001/3600.) * ((core->getJDE()-d2000)/365.25)/ star_position_scale;
2999 const SpecialZoneData<Star> *const z = getZones()+index;
3000 Vec3f tmp;
3001 Vec3f vf(v[0], v[1], v[2]);
3002
3003=== modified file 'src/core/planetsephems/sidereal_time.c'
3004--- src/core/planetsephems/sidereal_time.c 2015-07-27 11:16:32 +0000
3005+++ src/core/planetsephems/sidereal_time.c 2015-08-03 13:17:13 +0000
3006@@ -209,18 +209,18 @@
3007 {-3.0, 0.0, 0.0, 0.0}};
3008
3009 /* cache values */
3010-static double c_JD = 0.0, c_longitude = 0.0, c_obliquity = 0.0, c_ecliptic = 0.0;
3011+static double c_JDE = 0.0, c_longitude = 0.0, c_obliquity = 0.0, c_ecliptic = 0.0;
3012
3013
3014 /* Calculate nutation of longitude and obliquity in degrees from Julian Ephemeris Day
3015-* params : JD Julian Day, nutation Pointer to store nutation.
3016+* params : JDE Julian Day (ET/TT), nutation Pointer to store nutation.
3017 * Meeus, Astr. Alg. (1st ed., 1994), Chapter 21 pg 131-134 Using Table 21A */
3018 /* GZ: Changed: ecliptic obliquity used to be constant J2000.0.
3019 * If you don't compute this, you may as well forget about nutation!
3020 * 2015: Laskar's 1986 formula replaced by Vondrak 2011. c_ecliptic is now epsilon_A, Vondrak's obliquity of date.
3021 * TODO: replace this whole function with Nutation IAU2000A or compatible version.
3022 */
3023-void get_nutation (double JD, struct ln_nutation * nutation)
3024+void get_nutation (double JDE, struct ln_nutation * nutation)
3025 {
3026
3027 double D,M,MM,F,O,T;
3028@@ -228,16 +228,16 @@
3029 int i;
3030
3031 /* should we bother recalculating nutation */
3032- if (fabs(JD - c_JD) > LN_NUTATION_EPOCH_THRESHOLD)
3033+ if (fabs(JDE - c_JDE) > LN_NUTATION_EPOCH_THRESHOLD)
3034 {
3035 /* set the new epoch */
3036- c_JD = JD;
3037+ c_JDE = JDE;
3038
3039 /* set ecliptic. GZ: This is constant only, J2000.0. WRONG! */
3040 /* c_ecliptic = 23.0 + 26.0 / 60.0 + 27.407 / 3600.0; */
3041
3042 /* calc T */
3043- T = (JD - 2451545.0)/36525;
3044+ T = (JDE - 2451545.0)/36525;
3045 /* GZotti: we don't need those. * /
3046 T2 = T * T;
3047 T3 = T2 * T;
3048@@ -361,7 +361,7 @@
3049 /* Calculate the apparent sidereal time at the meridian of Greenwich of a given date.
3050 * returns apparent sidereal time (degrees).
3051 * Formula 11.1, 11.4 pg 83 */
3052-double get_apparent_sidereal_time (double JD)
3053+double get_apparent_sidereal_time (double JD, double JDE)
3054 {
3055 double correction, sidereal;
3056 struct ln_nutation nutation;
3057@@ -371,9 +371,9 @@
3058 /* get the mean sidereal time */
3059 sidereal = get_mean_sidereal_time (JD);
3060
3061- /* add corrections for nutation in longitude and for the true obliquity of
3062- the ecliptic */
3063- get_nutation (JD, &nutation);
3064+ /* add corrections for nutation in longitude and for the true obliquity of the ecliptic
3065+ */
3066+ get_nutation (JDE, &nutation);
3067
3068 /* GZ: This was the only place where this was used. I added the summation here. */
3069 correction = (nutation.deltaPsi * cos ((nutation.ecliptic+nutation.deltaEps)*M_PI/180.));
3070
3071=== modified file 'src/core/planetsephems/sidereal_time.h'
3072--- src/core/planetsephems/sidereal_time.h 2014-02-05 17:01:25 +0000
3073+++ src/core/planetsephems/sidereal_time.h 2015-08-03 13:17:13 +0000
3074@@ -28,8 +28,8 @@
3075 /* Calculate mean sidereal time from date. */
3076 double get_mean_sidereal_time (double JD);
3077
3078-/* Calculate apparent sidereal time from date.*/
3079-double get_apparent_sidereal_time (double JD);
3080+/* Calculate apparent sidereal time from date. We need JD(UT) and JDE(TT) here to accurately compute nutation. */
3081+double get_apparent_sidereal_time (double JD, double JDE);
3082 /* Calculate mean ecliptical obliquity in degrees. */
3083 double get_mean_ecliptical_obliquity(double JDE);
3084 /* Calculate nutation in longitude in degrees. */
3085
3086=== modified file 'src/gui/ConfigurationDialog.cpp'
3087--- src/gui/ConfigurationDialog.cpp 2015-07-27 14:57:16 +0000
3088+++ src/gui/ConfigurationDialog.cpp 2015-08-03 13:17:13 +0000
3089@@ -931,8 +931,8 @@
3090 void ConfigurationDialog::setFixedDateTimeToCurrent(void)
3091 {
3092 StelCore* core = StelApp::getInstance().getCore();
3093- double JD = core->getJDay();
3094- ui->fixedDateTimeEdit->setDateTime(StelUtils::jdToQDateTime(JD+StelUtils::getGMTShiftFromQT(JD)/24-core->getDeltaT(JD)/86400));
3095+ double JD = core->getJD();
3096+ ui->fixedDateTimeEdit->setDateTime(StelUtils::jdToQDateTime(JD+StelUtils::getGMTShiftFromQT(JD)/24));
3097 ui->fixedTimeRadio->setChecked(true);
3098 setStartupTimeMode();
3099 }
3100@@ -1252,6 +1252,8 @@
3101 algorithms->addItem(q_("Morrison & Stephenson (2004, 2005)"), "MorrisonStephenson2004");
3102 // Espenak & Meeus (2006) used by default
3103 algorithms->addItem(q_("Espenak & Meeus (2006)").append(" *"), "EspenakMeeus");
3104+ // GZ: I want to try out some things. Something is still wrong with eclipses, see lp:1275092.
3105+ //algorithms->addItem(q_("Espenak & Meeus (2006) no extra moon acceleration"), "EspenakMeeusZeroMoonAccel");
3106 algorithms->addItem(q_("Reijs (2006)"), "Reijs");
3107 algorithms->addItem(q_("Banjevic (2006)"), "Banjevic");
3108 algorithms->addItem(q_("Islam, Sadiq & Qureshi (2008, 2013)"), "IslamSadiqQureshi");
3109
3110=== modified file 'src/gui/DateTimeDialog.cpp'
3111--- src/gui/DateTimeDialog.cpp 2015-02-05 15:36:01 +0000
3112+++ src/gui/DateTimeDialog.cpp 2015-08-03 13:17:13 +0000
3113@@ -54,13 +54,9 @@
3114 void DateTimeDialog::createDialogContent()
3115 {
3116 ui->setupUi(dialog);
3117- double cjd = StelApp::getInstance().getCore()->getJDay();
3118+ double jd = StelApp::getInstance().getCore()->getJD();
3119 // UTC -> local tz
3120- // Add in a DeltaT correction. Divide DeltaT by 86400 to convert from seconds to days.
3121- double deltaT = 0.;
3122- if (StelApp::getInstance().getCore()->getCurrentLocation().planetName=="Earth")
3123- deltaT = StelApp::getInstance().getCore()->getDeltaT(cjd)/86400.;
3124- setDateTime(cjd + (StelApp::getInstance().getLocaleMgr().getGMTShift(cjd)/24.0)-deltaT);
3125+ setDateTime(jd + (StelApp::getInstance().getLocaleMgr().getGMTShift(jd)/24.0));
3126
3127 connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
3128 connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));
3129@@ -115,15 +111,15 @@
3130 minute = dmin;
3131 second = ds;
3132 pushToWidgets();
3133- StelApp::getInstance().getCore()->setJDay(newJd());
3134+ StelApp::getInstance().getCore()->setJD(newJd());
3135 return true;
3136 }
3137
3138 bool DateTimeDialog::validJd(double jday)
3139 {
3140 pushToWidgets();
3141- StelCore *core = StelApp::getInstance().getCore();
3142- core->setJDay(jday+core->getDeltaT(jday)/86400.);
3143+ StelApp::getInstance().getCore()->setJD(jday);
3144+
3145 return true;
3146 }
3147
3148@@ -211,11 +207,8 @@
3149 {
3150 double cjd;
3151 StelUtils::getJDFromDate(&cjd, year, month, day, hour, minute, second);
3152- // Add in a DeltaT correction. Divide DeltaT by 86400 to convert from seconds to days.
3153- double deltaT = 0.;
3154- if (StelApp::getInstance().getCore()->getCurrentLocation().planetName=="Earth")
3155- deltaT = StelApp::getInstance().getCore()->getDeltaT(cjd)/86400.;
3156- cjd -= (StelApp::getInstance().getLocaleMgr().getGMTShift(cjd)/24.0-deltaT); // local tz -> UTC
3157+ cjd -= (StelApp::getInstance().getLocaleMgr().getGMTShift(cjd)/24.0); // local tz -> UTC
3158+
3159 return cjd;
3160 }
3161
3162@@ -236,25 +229,25 @@
3163 }
3164 ui->spinner_jd->setValue(jd);
3165 ui->spinner_mjd->setValue(mjd);
3166+ if (jd<2299161) // 1582-10-15
3167+ ui->dateTimeTab->setToolTip(q_("Date and Time in Julian calendar"));
3168+ else
3169+ ui->dateTimeTab->setToolTip(q_("Date and Time in Gregorian calendar"));
3170 connectSpinnerEvents();
3171 }
3172
3173 /************************************************************************
3174-Send newJd to spinner_*
3175+Prepare date elements from newJd and send to spinner_*
3176 ************************************************************************/
3177 void DateTimeDialog::setDateTime(double newJd)
3178 {
3179 if (this->visible()) {
3180- // Add in a DeltaT correction. Divide DeltaT by 86400 to convert from seconds to days.
3181- double deltaT = 0.;
3182- if (StelApp::getInstance().getCore()->getCurrentLocation().planetName=="Earth")
3183- deltaT = StelApp::getInstance().getCore()->getDeltaT(newJd)/86400.;
3184- double newJdC = newJd - deltaT;
3185- newJd += (StelApp::getInstance().getLocaleMgr().getGMTShift(newJd)/24.0-deltaT); // UTC -> local tz
3186+ newJd += (StelApp::getInstance().getLocaleMgr().getGMTShift(newJd)/24.0); // UTC -> local tz
3187 StelUtils::getDateFromJulianDay(newJd, &year, &month, &day);
3188 StelUtils::getTimeFromJulianDay(newJd, &hour, &minute, &second);
3189- jd = newJdC;
3190- mjd = newJdC-2400000.5;
3191+ jd = newJd;
3192+ mjd = newJd-2400000.5;
3193+
3194 pushToWidgets();
3195 }
3196 }
3197
3198=== modified file 'src/gui/SearchDialog.cpp'
3199--- src/gui/SearchDialog.cpp 2015-05-09 10:26:41 +0000
3200+++ src/gui/SearchDialog.cpp 2015-08-03 13:17:13 +0000
3201@@ -478,7 +478,7 @@
3202 case ecliptic:
3203 {
3204 double ra, dec;
3205- StelUtils::eclToEqu(ui->AxisXSpinBox->valueRadians(), ui->AxisYSpinBox->valueRadians(), core->getCurrentPlanet()->getRotObliquity(core->getJDay()), &ra, &dec);
3206+ StelUtils::eclToEqu(ui->AxisXSpinBox->valueRadians(), ui->AxisYSpinBox->valueRadians(), core->getCurrentPlanet()->getRotObliquity(core->getJDE()), &ra, &dec);
3207 StelUtils::spheToRect(ra, dec, pos);
3208 pos = core->equinoxEquToJ2000(pos);
3209 break;
3210
3211=== modified file 'src/gui/StelGui.cpp'
3212--- src/gui/StelGui.cpp 2015-03-09 12:26:02 +0000
3213+++ src/gui/StelGui.cpp 2015-08-03 13:17:13 +0000
3214@@ -523,7 +523,7 @@
3215 forceRefreshGui();
3216 }
3217
3218- dateTimeDialog->setDateTime(core->getJDay());
3219+ dateTimeDialog->setDateTime(core->getJD());
3220 }
3221
3222 #ifndef DISABLE_SCRIPTING
3223
3224=== modified file 'src/gui/StelGuiItems.cpp'
3225--- src/gui/StelGuiItems.cpp 2015-08-02 17:12:29 +0000
3226+++ src/gui/StelGuiItems.cpp 2015-08-03 13:17:13 +0000
3227@@ -537,56 +537,49 @@
3228 updateText(true);
3229 }
3230
3231+// create text elements and tooltips in bottom toolbar.
3232 // Make sure to avoid any change if not necessary to avoid triggering useless redraw
3233 void BottomStelBar::updateText(bool updatePos)
3234 {
3235 StelCore* core = StelApp::getInstance().getCore();
3236- double jd = core->getJDay();
3237- double deltaT = 0.;
3238- double sigma = -1.;
3239- QString sigmaInfo = "";
3240- QString validRangeInfo = "";
3241- bool displayDeltaT = false;
3242- if (core->getCurrentLocation().planetName.contains("Earth"))
3243- {
3244- deltaT = core->getDeltaT(jd);
3245- displayDeltaT = true;
3246- sigma = StelUtils::getDeltaTStandardError(jd);
3247- core->getCurrentDeltaTAlgorithmValidRange(jd, &validRangeInfo);
3248- }
3249+ double jd = core->getJD();
3250+ double deltaT = core->getDeltaT();
3251+ double sigma = StelUtils::getDeltaTStandardError(jd);
3252+ QString sigmaInfo = "";
3253+ QString validRangeMarker = "";
3254+ core->getCurrentDeltaTAlgorithmValidRangeDescription(jd, &validRangeMarker);
3255
3256 const StelLocaleMgr& locmgr = StelApp::getInstance().getLocaleMgr();
3257- double dt = deltaT/86400.; // A DeltaT correction. Divide DeltaT by 86400 to convert from seconds to days.
3258- QString tz = locmgr.getPrintableTimeZoneLocal(jd-dt);
3259+ QString tz = locmgr.getPrintableTimeZoneLocal(jd);
3260 QString newDateInfo = " ";
3261 if (getFlagShowTime())
3262 {
3263 if (getFlagShowTz())
3264- newDateInfo = QString("%1 %2 %3").arg(locmgr.getPrintableDateLocal(jd-dt)).arg(locmgr.getPrintableTimeLocal(jd-dt)).arg(tz);
3265+ newDateInfo = QString("%1 %2 %3").arg(locmgr.getPrintableDateLocal(jd)).arg(locmgr.getPrintableTimeLocal(jd)).arg(tz);
3266 else
3267- newDateInfo = QString("%1 %2").arg(locmgr.getPrintableDateLocal(jd-dt)).arg(locmgr.getPrintableTimeLocal(jd-dt));
3268+ newDateInfo = QString("%1 %2").arg(locmgr.getPrintableDateLocal(jd)).arg(locmgr.getPrintableTimeLocal(jd));
3269 }
3270- QString newDateAppx = QString("JD %1").arg(jd-dt, 0, 'f', 5);
3271+ QString newDateAppx = QString("JD %1").arg(jd, 0, 'f', 5);
3272 if (getFlagTimeJd())
3273 {
3274 newDateAppx = newDateInfo;
3275- newDateInfo = QString("JD %1").arg(jd-dt, 0, 'f', 5);
3276+ newDateInfo = QString("JD %1").arg(jd, 0, 'f', 5);
3277 }
3278
3279 if (datetime->text()!=newDateInfo)
3280 {
3281 updatePos = true;
3282 datetime->setText(newDateInfo);
3283- if (displayDeltaT && core->getCurrentDeltaTAlgorithm()!=StelCore::WithoutCorrection)
3284+ if (core->getCurrentDeltaTAlgorithm()!=StelCore::WithoutCorrection)
3285 {
3286 if (sigma>0)
3287 sigmaInfo = QString("; %1(%2T) = %3s").arg(QChar(0x03c3)).arg(QChar(0x0394)).arg(sigma, 3, 'f', 1);
3288
3289 QString deltaTInfo = "";
3290 if (qAbs(deltaT)>60.)
3291- deltaTInfo = QString("%1 (%2s)%3").arg(StelUtils::hoursToHmsStr(deltaT/3600.)).arg(deltaT, 5, 'f', 2).arg(validRangeInfo);
3292+ deltaTInfo = QString("%1 (%2s)%3").arg(StelUtils::hoursToHmsStr(deltaT/3600.)).arg(deltaT, 5, 'f', 2).arg(validRangeMarker);
3293 else
3294- deltaTInfo = QString("%1s%2").arg(deltaT, 3, 'f', 3).arg(validRangeInfo);
3295+ deltaTInfo = QString("%1s%2").arg(deltaT, 3, 'f', 3).arg(validRangeMarker);
3296
3297 datetime->setToolTip(QString("<p style='white-space:pre'>%1T = %2 [n-dot @ -23.8946\"/cy%3%4]<br>%5</p>").arg(QChar(0x0394)).arg(deltaTInfo).arg(QChar(0x00B2)).arg(sigmaInfo).arg(newDateAppx));
3298 }
3299@@ -594,6 +587,7 @@
3300 datetime->setToolTip(QString("%1").arg(newDateAppx));
3301 }
3302
3303+ // build location tooltip
3304 QString newLocation = "";
3305 const StelLocation* loc = &core->getCurrentLocation();
3306 const StelTranslator& trans = locmgr.getSkyTranslator();
3307@@ -633,6 +627,8 @@
3308 }
3309
3310 QString str;
3311+
3312+ // build fov tooltip
3313 QTextStream wos(&str);
3314 if (getFlagFovDms())
3315 {
3316@@ -659,6 +655,8 @@
3317 }
3318
3319 str="";
3320+
3321+ // build fps tooltip
3322 QTextStream wos2(&str);
3323 wos2 << qSetRealNumberPrecision(3) << StelApp::getInstance().getFps() << " FPS";
3324 if (fps->text()!=str)
3325
3326=== modified file 'src/gui/dateTimeDialogGui.ui'
3327--- src/gui/dateTimeDialogGui.ui 2015-02-05 15:36:01 +0000
3328+++ src/gui/dateTimeDialogGui.ui 2015-08-03 13:17:13 +0000
3329@@ -557,7 +557,7 @@
3330 </widget>
3331 <widget class="QWidget" name="julianDateTab">
3332 <attribute name="title">
3333- <string>Julian Date</string>
3334+ <string>Julian Day</string>
3335 </attribute>
3336 <layout class="QGridLayout" name="gridLayout_3">
3337 <property name="leftMargin">
3338@@ -599,7 +599,7 @@
3339 <item>
3340 <widget class="QLabel" name="label_5">
3341 <property name="toolTip">
3342- <string>Julian Date</string>
3343+ <string>Julian Day</string>
3344 </property>
3345 <property name="text">
3346 <string notr="true">JD:</string>
3347@@ -664,7 +664,7 @@
3348 <item>
3349 <widget class="QLabel" name="label_6">
3350 <property name="toolTip">
3351- <string>Modified Julian Date</string>
3352+ <string>Modified Julian Day</string>
3353 </property>
3354 <property name="text">
3355 <string notr="true">MJD:</string>
3356
3357=== modified file 'src/scripting/StelMainScriptAPI.cpp'
3358--- src/scripting/StelMainScriptAPI.cpp 2015-07-21 20:42:50 +0000
3359+++ src/scripting/StelMainScriptAPI.cpp 2015-08-03 13:17:13 +0000
3360@@ -104,17 +104,17 @@
3361 }
3362
3363 //! Set the current date in Julian Day
3364-//! @param JD the Julian Date
3365+//! @param JD the Julian Date (UT)
3366 void StelMainScriptAPI::setJDay(double JD)
3367 {
3368- StelApp::getInstance().getCore()->setJDay(JD);
3369+ StelApp::getInstance().getCore()->setJD(JD);
3370 }
3371
3372 //! Get the current date in Julian Day
3373-//! @return the Julian Date
3374+//! @return the Julian Date (UT)
3375 double StelMainScriptAPI::getJDay() const
3376 {
3377- return StelApp::getInstance().getCore()->getJDay();
3378+ return StelApp::getInstance().getCore()->getJD();
3379 }
3380
3381 //! Set the current date in Modified Julian Day
3382@@ -131,31 +131,42 @@
3383 return StelApp::getInstance().getCore()->getMJDay();
3384 }
3385
3386-void StelMainScriptAPI::setDate(const QString& dt, const QString& spec, const bool &enableDeltaT)
3387+void StelMainScriptAPI::setDate(const QString& dateStr, const QString& spec, const bool &dateIsDT)
3388 {
3389- bool relativeTime = false;
3390- if (dt.startsWith("+") || dt.startsWith("-") || (dt.startsWith("now") && (dt.startsWith("+") || dt.startsWith("-"))))
3391- relativeTime = true;
3392- double JD = jdFromDateString(dt, spec);
3393 StelCore* core = StelApp::getInstance().getCore();
3394- if (relativeTime)
3395+ double JD = jdFromDateString(dateStr, spec);
3396+ if (dateIsDT)
3397 {
3398- core->setJDay(JD);
3399+ qWarning() << "StelMainScriptAPI::setDate() called with final Boolean set to indicate Dynamical Time. This is new in 0.14, make sure you did this intentionally.";
3400+ qWarning() << "This warning will go away in Stellarium 0.16, please update the script by then to be sure.";
3401+ core->setJDE(JD);
3402 }
3403 else
3404- {
3405- if (enableDeltaT)
3406- {
3407- // add Delta-T correction for date
3408- core->setJDay(JD + core->getDeltaT(JD)/86400);
3409- }
3410- else
3411- {
3412- // set date without Delta-T correction
3413- // compatible with 0.11
3414- core->setJDay(JD);
3415- }
3416- }
3417+ core->setJD(JD);
3418+
3419+// bool relativeTime = false;
3420+// if (dateStr.startsWith("+") || dateStr.startsWith("-") || (dateStr.startsWith("now") && (dateStr.startsWith("+") || dateStr.startsWith("-"))))
3421+// relativeTime = true;
3422+// double JD = jdFromDateString(dateStr, spec);
3423+// StelCore* core = StelApp::getInstance().getCore();
3424+// if (relativeTime)
3425+// {
3426+// core->setJDay(JD);
3427+// }
3428+// else
3429+// {
3430+// if (dateIsDT)
3431+// {
3432+// // add Delta-T correction for date
3433+// core->setJDay(JD + core->getDeltaT(JD)/86400);
3434+// }
3435+// else
3436+// {
3437+// // set date without Delta-T correction
3438+// // compatible with 0.11
3439+// core->setJDay(JD);
3440+// }
3441+// }
3442 }
3443
3444 QString StelMainScriptAPI::getDate(const QString& spec)
3445@@ -168,7 +179,7 @@
3446
3447 QString StelMainScriptAPI::getDeltaT() const
3448 {
3449- return StelUtils::hoursToHmsStr(StelApp::getInstance().getCore()->getDeltaT(getJDay())/3600.);
3450+ return StelUtils::hoursToHmsStr(StelApp::getInstance().getCore()->getDeltaT()/3600.);
3451 }
3452
3453 QString StelMainScriptAPI::getDeltaTAlgorithm() const
3454@@ -691,7 +702,7 @@
3455 if (nowRe.capturedTexts().at(1)=="now")
3456 jd = StelUtils::getJDFromSystem();
3457 else
3458- jd = core->getJDay();
3459+ jd = core->getJD();
3460
3461 if (nowRe.capturedTexts().at(8) == "sidereal")
3462 {
3463
3464=== modified file 'src/scripting/StelMainScriptAPI.hpp'
3465--- src/scripting/StelMainScriptAPI.hpp 2015-07-21 20:42:50 +0000
3466+++ src/scripting/StelMainScriptAPI.hpp 2015-08-03 13:17:13 +0000
3467@@ -44,22 +44,22 @@
3468
3469 // These functions will be available in scripts
3470 public slots:
3471- //! Set the current date in Julian Day
3472- //! @param JD the Julian Date
3473+ //! Set the current date as Julian Day number
3474+ //! @param JD the Julian Day number
3475 void setJDay(double JD);
3476- //! Get the current date in Julian Day
3477- //! @return the Julian Date
3478+ //! Get the current date as Julian Day number
3479+ //! @return the Julian Day number
3480 double getJDay() const;
3481
3482- //! Set the current date in Modified Julian Day
3483- //! @param MJD the Modified Julian Date
3484+ //! Set the current date as Modified Julian Day
3485+ //! @param MJD the Modified Julian Day
3486 void setMJDay(double MJD);
3487- //! Get the current date in Modified Julian Day
3488- //! @return the Modified Julian Date
3489+ //! Get the current date as Modified Julian Day
3490+ //! @return the Modified Julian Day
3491 double getMJDay() const;
3492
3493 //! set the date in ISO format, e.g. "2008-03-24T13:21:01"
3494- //! @param dt the date string to use. Formats:
3495+ //! @param dateStr the date string to use. Formats:
3496 //! - ISO, e.g. "2008-03-24T13:21:01"
3497 //! - "now" (set sim time to real time)
3498 //! - relative, e.g. "+ 4 days", "-2 weeks". can use these
3499@@ -71,8 +71,9 @@
3500 //! of the unit is 1. i.e. use "+ 1 days" not "+1 day".
3501 //! @note when sidereal time is used, the length of time for
3502 //! each unit is dependent on the current planet. By contrast
3503- //! when sidereal timeis not specified (i.e. solar time is used)
3504+ //! when sidereal time is not specified (i.e. solar time is used)
3505 //! the value is conventional - i.e. 1 day means 1 Earth Solar day.
3506+ // TODO: This calls for implementing "sol" days (planets's solar days)!
3507 //! @param spec "local" or "utc" - only has an effect when
3508 //! the ISO date type is used. Defaults to "utc".
3509 //! @param enableDeltaT is \a true or \a false - enable Delta-T correction or not.
3510@@ -81,7 +82,11 @@
3511 //! or earlier, you should call \b core.setDeltaTAlgorithm("WithoutCorrection");
3512 //! before running \b core.setDate(); for disabling DeltaT correction.
3513 //! @note starting with version 0.13.2 all relative dates are set without DeltaT correction.
3514- void setDate(const QString& dt, const QString& spec="utc", const bool& enableDeltaT=true);
3515+ //! @note starting with version 0.14.0 the final optional Boolean argument has a different meaning and default!
3516+ //! @param dateIsTT \a true if the given date is formulated in Dynamical Time, i.e. with DeltaT added.
3517+ // GZ JDfix for 0.14: I estimate 99.7% of users will want to set UT-based dates here. We could use an awkward name like dateIsUTbased=true to keep default value true.
3518+ //void setDate(const QString& dt, const QString& spec="utc", const bool& enableDeltaT=true);
3519+ void setDate(const QString& dateStr, const QString& spec="utc", const bool& dateIsDT=false);
3520
3521 //! get the simulation date and time as a string in ISO format,
3522 //! e.g. "2008-03-24T13:21:01"