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
=== modified file 'plugins/AngleMeasure/src/AngleMeasure.hpp'
--- plugins/AngleMeasure/src/AngleMeasure.hpp 2015-05-31 09:35:00 +0000
+++ plugins/AngleMeasure/src/AngleMeasure.hpp 2015-08-03 13:17:13 +0000
@@ -34,8 +34,10 @@
34/*! @defgroup angleMeasure Angle Measure plug-in34/*! @defgroup angleMeasure Angle Measure plug-in
35@{35@{
36The Angle Measure plugin is a small tool which is used to measure36The Angle Measure plugin is a small tool which is used to measure
37the angular distance between two points on the sky. *goes misty eyed*37the angular distance between two points on the sky.
38I recall measuring the size of the Cassini Division when I was a student.38
39*goes misty eyed* I recall measuring the size of the Cassini Division
40when I was a student.
39It was not the high academic glamor one might expect... It was cloudy...41It was not the high academic glamor one might expect... It was cloudy...
40It was rainy... The observatory lab had some old scopes set up at one end,42It was rainy... The observatory lab had some old scopes set up at one end,
41pointing at a photograph of Saturn at the other end of the lab. We measured.43pointing at a photograph of Saturn at the other end of the lab. We measured.
@@ -64,7 +66,7 @@
64//! Main class of the Angle Measure plug-in.66//! Main class of the Angle Measure plug-in.
65//! @author Matthew Gates67//! @author Matthew Gates
66//! @author Alexander Wolf68//! @author Alexander Wolf
67//! @anchor Georg Zotti69//! @author Georg Zotti
68class AngleMeasure : public StelModule70class AngleMeasure : public StelModule
69{71{
70 Q_OBJECT72 Q_OBJECT
7173
=== modified file 'plugins/ArchaeoLines/src/ArchaeoLines.cpp'
--- plugins/ArchaeoLines/src/ArchaeoLines.cpp 2015-05-16 10:23:09 +0000
+++ plugins/ArchaeoLines/src/ArchaeoLines.cpp 2015-08-03 13:17:13 +0000
@@ -79,7 +79,7 @@
79 , flagShowCurrentSun(false)79 , flagShowCurrentSun(false)
80 , flagShowCurrentMoon(false)80 , flagShowCurrentMoon(false)
81 , enumShowCurrentPlanet(ArchaeoLine::CurrentPlanetNone)81 , enumShowCurrentPlanet(ArchaeoLine::CurrentPlanetNone)
82 , lastJD(0.0)82 , lastJDE(0.0)
83 , toolbarButton(NULL)83 , toolbarButton(NULL)
84{84{
85 setObjectName("ArchaeoLines");85 setObjectName("ArchaeoLines");
@@ -212,6 +212,9 @@
212212
213void ArchaeoLines::update(double deltaTime)213void ArchaeoLines::update(double deltaTime)
214{214{
215 if (core->getCurrentPlanet()->getEnglishName()!="Earth")
216 return;
217
215 static SolarSystem *ssystem=GETSTELMODULE(SolarSystem);218 static SolarSystem *ssystem=GETSTELMODULE(SolarSystem);
216 static const double lunarI=5.145396; // inclination of lunar orbit219 static const double lunarI=5.145396; // inclination of lunar orbit
217 // compute min and max distance values for horizontal parallax.220 // compute min and max distance values for horizontal parallax.
@@ -244,16 +247,16 @@
244 currentPlanetLine->setDeclination(dec_equ * 180.0/M_PI);247 currentPlanetLine->setDeclination(dec_equ * 180.0/M_PI);
245 }248 }
246249
247 double newJD=core->getJDay();250 double newJDE=core->getJDE();
248 if (fabs(newJD-lastJD) > 10.0) // enough to compute this every 10 days?251 if (fabs(newJDE-lastJDE) > 10.0) // enough to compute this every 10 days?
249 {252 {
250 eps= ssystem->getEarth()->getRotObliquity(core->getJDay()) *180.0/M_PI;253 eps= ssystem->getEarth()->getRotObliquity(newJDE) *180.0/M_PI;
251 static const double invSqrt2=1.0/std::sqrt(2.0);254 static const double invSqrt2=1.0/std::sqrt(2.0);
252 northernSolsticeLine->setDeclination( eps);255 northernSolsticeLine->setDeclination( eps);
253 southernSolsticeLine->setDeclination(-eps);256 southernSolsticeLine->setDeclination(-eps);
254 northernCrossquarterLine->setDeclination( eps*invSqrt2);257 northernCrossquarterLine->setDeclination( eps*invSqrt2);
255 southernCrossquarterLine->setDeclination(-eps*invSqrt2);258 southernCrossquarterLine->setDeclination(-eps*invSqrt2);
256 lastJD=newJD;259 lastJDE=newJDE;
257 }260 }
258 StelLocation loc=core->getCurrentLocation();261 StelLocation loc=core->getCurrentLocation();
259262
@@ -347,6 +350,9 @@
347//! Draw any parts on the screen which are for our module350//! Draw any parts on the screen which are for our module
348void ArchaeoLines::draw(StelCore* core)351void ArchaeoLines::draw(StelCore* core)
349{352{
353 if (core->getCurrentPlanet()->getEnglishName()!="Earth")
354 return;
355
350 equinoxLine->draw(core, lineFader.getInterstate());356 equinoxLine->draw(core, lineFader.getInterstate());
351 northernSolsticeLine->draw(core, lineFader.getInterstate());357 northernSolsticeLine->draw(core, lineFader.getInterstate());
352 southernSolsticeLine->draw(core, lineFader.getInterstate());358 southernSolsticeLine->draw(core, lineFader.getInterstate());
353359
=== modified file 'plugins/ArchaeoLines/src/ArchaeoLines.hpp'
--- plugins/ArchaeoLines/src/ArchaeoLines.hpp 2015-05-30 19:56:47 +0000
+++ plugins/ArchaeoLines/src/ArchaeoLines.hpp 2015-08-03 13:17:13 +0000
@@ -272,7 +272,7 @@
272 bool flagShowCurrentSun;272 bool flagShowCurrentSun;
273 bool flagShowCurrentMoon;273 bool flagShowCurrentMoon;
274 ArchaeoLine::Line enumShowCurrentPlanet;274 ArchaeoLine::Line enumShowCurrentPlanet;
275 double lastJD; // cache last-time-computed to 1/month or so?275 double lastJDE; // cache last-time-computed to every 10 days or so?
276276
277 ArchaeoLine * equinoxLine;277 ArchaeoLine * equinoxLine;
278 ArchaeoLine * northernSolsticeLine;278 ArchaeoLine * northernSolsticeLine;
279279
=== modified file 'plugins/EquationOfTime/src/EquationOfTime.cpp'
--- plugins/EquationOfTime/src/EquationOfTime.cpp 2015-03-22 09:33:56 +0000
+++ plugins/EquationOfTime/src/EquationOfTime.cpp 2015-08-03 13:17:13 +0000
@@ -113,6 +113,8 @@
113{113{
114 if (!isEnabled())114 if (!isEnabled())
115 return;115 return;
116 if (core->getCurrentPlanet()->getEnglishName()!="Earth")
117 return;
116118
117 StelPainter sPainter(core->getProjection2d());119 StelPainter sPainter(core->getProjection2d());
118 sPainter.setColor(textColor[0], textColor[1], textColor[2], 1.f);120 sPainter.setColor(textColor[0], textColor[1], textColor[2], 1.f);
@@ -120,26 +122,26 @@
120 sPainter.setFont(font);122 sPainter.setFont(font);
121123
122 QString timeText;124 QString timeText;
123 double time = getSolutionEquationOfTime(core->getJDay());125 double eqTime = getSolutionEquationOfTime(core->getJDE());
124126
125 if (getFlagInvertedValue())127 if (getFlagInvertedValue())
126 time *= -1;128 eqTime *= -1;
127129
128 if (getFlagMsFormat())130 if (getFlagMsFormat())
129 {131 {
130 int seconds = qRound((time - (int)time)*60);132 int seconds = qRound((eqTime - (int)eqTime)*60);
131 QString messageSecondsValue = QString("%1").arg(qAbs(seconds), 2, 10, QLatin1Char('0'));133 QString messageSecondsValue = QString("%1").arg(qAbs(seconds), 2, 10, QLatin1Char('0'));
132134
133 timeText = QString("%1: %2%3%4%5%6").arg(messageEquation, (time<0? QString(QLatin1Char('-')):QString()), QString::number((int)qAbs(time)), messageEquationMinutes, messageSecondsValue, messageEquationSeconds);135 timeText = QString("%1: %2%3%4%5%6").arg(messageEquation, (eqTime<0? QString(QLatin1Char('-')):QString()), QString::number((int)qAbs(eqTime)), messageEquationMinutes, messageSecondsValue, messageEquationSeconds);
134 }136 }
135 else137 else
136 timeText = QString("%1: %2%3").arg(messageEquation, QString::number(time, 'f', 2), messageEquationMinutes);138 timeText = QString("%1: %2%3").arg(messageEquation, QString::number(eqTime, 'f', 2), messageEquationMinutes);
137139
138140
139 QFontMetrics fm(font);141 QFontMetrics fm(font);
140 QSize fs = fm.size(Qt::TextSingleLine, timeText); 142 QSize fs = fm.size(Qt::TextSingleLine, timeText);
141 if (core->getCurrentPlanet().data()->getEnglishName()=="Earth")143
142 sPainter.drawText(gui->getSkyGui()->getSkyGuiWidth()/2 - fs.width()/2, gui->getSkyGui()->getSkyGuiHeight() - fs.height()*1.5, timeText);144 sPainter.drawText(gui->getSkyGui()->getSkyGuiWidth()/2 - fs.width()/2, gui->getSkyGui()->getSkyGuiHeight() - fs.height()*1.5, timeText);
143145
144 //qDebug() << timeText;146 //qDebug() << timeText;
145}147}
@@ -212,11 +214,11 @@
212 conf->endGroup();214 conf->endGroup();
213}215}
214216
215double EquationOfTime::getSolutionEquationOfTime(const double JDay) const217double EquationOfTime::getSolutionEquationOfTime(const double JDE) const
216{218{
217 StelCore* core = StelApp::getInstance().getCore();219 StelCore* core = StelApp::getInstance().getCore();
218220
219 double tau = (JDay - 2451545.0)/365250.0;221 double tau = (JDE - 2451545.0)/365250.0;
220 double sunMeanLongitude = 280.4664567 + tau*(360007.6892779 + tau*(0.03032028 + tau*(1./49931. - tau*(1./15300. - tau/2000000.))));222 double sunMeanLongitude = 280.4664567 + tau*(360007.6892779 + tau*(0.03032028 + tau*(1./49931. - tau*(1./15300. - tau/2000000.))));
221223
222 // reduce the angle224 // reduce the angle
@@ -233,7 +235,7 @@
233 // force it to be the positive remainder, so that 0 <= angle < 360235 // force it to be the positive remainder, so that 0 <= angle < 360
234 alpha = std::fmod(alpha + 360., 360.);236 alpha = std::fmod(alpha + 360., 360.);
235237
236 double equation = 4*(sunMeanLongitude - 0.0057183 - alpha + get_nutation_longitude(JDay)*cos(get_mean_ecliptical_obliquity(JDay)));238 double equation = 4*(sunMeanLongitude - 0.0057183 - alpha + get_nutation_longitude(JDE)*cos(get_mean_ecliptical_obliquity(JDE)));
237 // The equation of time is always smaller 20 minutes in absolute value239 // The equation of time is always smaller 20 minutes in absolute value
238 if (qAbs(equation)>20)240 if (qAbs(equation)>20)
239 {241 {
240242
=== modified file 'plugins/EquationOfTime/src/EquationOfTime.hpp'
--- plugins/EquationOfTime/src/EquationOfTime.hpp 2015-05-31 09:35:00 +0000
+++ plugins/EquationOfTime/src/EquationOfTime.hpp 2015-08-03 13:17:13 +0000
@@ -87,9 +87,9 @@
8787
88 //! Get solution of equation of time88 //! Get solution of equation of time
89 //! Source: J. Meeus "Astronomical Algorithms" (2nd ed., with corrections as of August 10, 2009) p.183-187.89 //! Source: J. Meeus "Astronomical Algorithms" (2nd ed., with corrections as of August 10, 2009) p.183-187.
90 //! @param JDay JD90 //! @param JDE JD in Dynamical Time (previously called Ephemeris Time)
91 //! @return time in minutes91 //! @return time in minutes
92 double getSolutionEquationOfTime(const double JDay) const;92 double getSolutionEquationOfTime(const double JDE) const;
9393
94 //! Is plugin enabled?94 //! Is plugin enabled?
95 bool isEnabled() const95 bool isEnabled() const
9696
=== modified file 'plugins/Exoplanets/src/Exoplanet.cpp'
--- plugins/Exoplanets/src/Exoplanet.cpp 2015-01-16 19:33:33 +0000
+++ plugins/Exoplanets/src/Exoplanet.cpp 2015-08-03 13:17:13 +0000
@@ -417,7 +417,7 @@
417 QList<int> discovery;417 QList<int> discovery;
418 // For getting value of new year from midnight at 1 Jan we need increase a value of JD on 0.5.418 // For getting value of new year from midnight at 1 Jan we need increase a value of JD on 0.5.
419 // This hack need for correct display of discovery mode of exoplanets.419 // This hack need for correct display of discovery mode of exoplanets.
420 StelUtils::getDateFromJulianDay(core->getJDay()+0.5, &year, &month, &day);420 StelUtils::getDateFromJulianDay(core->getJD()+0.5, &year, &month, &day);
421 discovery.clear();421 discovery.clear();
422 foreach(const exoplanetData &p, exoplanets)422 foreach(const exoplanetData &p, exoplanets)
423 {423 {
424424
=== modified file 'plugins/MeteorShowers/src/MeteorShower.cpp'
--- plugins/MeteorShowers/src/MeteorShower.cpp 2015-04-22 01:04:29 +0000
+++ plugins/MeteorShowers/src/MeteorShower.cpp 2015-08-03 13:17:13 +0000
@@ -206,9 +206,9 @@
206QDateTime MeteorShower::getSkyQDateTime() const206QDateTime MeteorShower::getSkyQDateTime() const
207{207{
208 StelCore* core = StelApp::getInstance().getCore();208 StelCore* core = StelApp::getInstance().getCore();
209 //get the current sky date209 //get the current sky date (zone time)
210 double JD = core->getJDay();210 double JD = core->getJD();
211 return StelUtils::jdToQDateTime(JD+StelUtils::getGMTShiftFromQT(JD)/24-core->getDeltaT(JD)/86400);211 return StelUtils::jdToQDateTime(JD+ StelUtils::getGMTShiftFromQT(JD)/24);
212}212}
213213
214void MeteorShower::updateCurrentData(QDateTime skyDate)214void MeteorShower::updateCurrentData(QDateTime skyDate)
215215
=== modified file 'plugins/MeteorShowers/src/MeteorShowers.cpp'
--- plugins/MeteorShowers/src/MeteorShowers.cpp 2015-04-11 13:25:02 +0000
+++ plugins/MeteorShowers/src/MeteorShowers.cpp 2015-08-03 13:17:13 +0000
@@ -215,7 +215,8 @@
215 updateTimer->start();215 updateTimer->start();
216216
217 // skyDate startup217 // skyDate startup
218 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());
219220
220 GETSTELMODULE(StelObjectMgr)->registerStelObjectMgr(this);221 GETSTELMODULE(StelObjectMgr)->registerStelObjectMgr(this);
221}222}
@@ -273,8 +274,8 @@
273274
274bool MeteorShowers::changedSkyDate(StelCore* core)275bool MeteorShowers::changedSkyDate(StelCore* core)
275{276{
276 double JD = core->getJDay();277 double JD = core->getJD();
277 skyDate = StelUtils::jdToQDateTime(JD+StelUtils::getGMTShiftFromQT(JD)/24-core->getDeltaT(JD)/86400);278 skyDate = StelUtils::jdToQDateTime(JD+StelUtils::getGMTShiftFromQT(JD)/24);
278 if (skyDate.toString("MM.dd.yyyy") != lastSkyDate.toString("MM.dd.yyyy")) //if the sky date changed279 if (skyDate.toString("MM.dd.yyyy") != lastSkyDate.toString("MM.dd.yyyy")) //if the sky date changed
279 {280 {
280 return true;281 return true;
281282
=== modified file 'plugins/MeteorShowers/src/gui/MeteorShowerDialog.cpp'
--- plugins/MeteorShowers/src/gui/MeteorShowerDialog.cpp 2015-07-29 18:56:52 +0000
+++ plugins/MeteorShowers/src/gui/MeteorShowerDialog.cpp 2015-08-03 13:17:13 +0000
@@ -237,7 +237,8 @@
237 //Change date237 //Change date
238 QString dateString = treeWidget->currentItem()->text(ColumnPeak);238 QString dateString = treeWidget->currentItem()->text(ColumnPeak);
239 QDateTime qDateTime = QDateTime::fromString(dateString, "dd/MMM/yyyy");239 QDateTime qDateTime = QDateTime::fromString(dateString, "dd/MMM/yyyy");
240 core->setJDay(StelUtils::qDateTimeToJd(qDateTime));240 // GZ JDfix for V0.14 this used to set JDE, so again. If IMO ephemerides are JD(UT), please change.
241 core->setJDE(StelUtils::qDateTimeToJd(qDateTime));
241242
242 //Select object243 //Select object
243 QString namel18n = treeWidget->currentItem()->text(ColumnName);244 QString namel18n = treeWidget->currentItem()->text(ColumnName);
244245
=== modified file 'plugins/Novae/src/Nova.cpp'
--- plugins/Novae/src/Nova.cpp 2015-02-08 15:35:27 +0000
+++ plugins/Novae/src/Nova.cpp 2015-08-03 13:17:13 +0000
@@ -167,7 +167,7 @@
167{167{
168 // OK, start from minimal brightness168 // OK, start from minimal brightness
169 double vmag = minMagnitude;169 double vmag = minMagnitude;
170 double currentJD = core->getJDay();170 double currentJD = core->getJDE();
171 double deltaJD = qAbs(peakJD-currentJD);171 double deltaJD = qAbs(peakJD-currentJD);
172 172
173 // Fill "default" values for mX173 // Fill "default" values for mX
174174
=== modified file 'plugins/Novae/src/Nova.hpp'
--- plugins/Novae/src/Nova.hpp 2015-05-30 19:56:47 +0000
+++ plugins/Novae/src/Nova.hpp 2015-08-03 13:17:13 +0000
@@ -37,6 +37,11 @@
37//! Details about the novae are passed using a QVariant which contains37//! Details about the novae are passed using a QVariant which contains
38//! a map of data from the json file.38//! a map of data from the json file.
39//! @ingroup brightNovae39//! @ingroup brightNovae
40//
41// GZ NOTE from JDfix for V0.14:
42// TODO: I don't know whether the peak times given are UT or DT times.
43// If DT, please change relevant calls from core->getJD() to getJDE() etc
44// and rename variables to include JDE for clarity.
4045
41class Nova : public StelObject46class Nova : public StelObject
42{47{
4348
=== modified file 'plugins/Observability/src/Observability.cpp'
--- plugins/Observability/src/Observability.cpp 2014-11-26 18:14:09 +0000
+++ plugins/Observability/src/Observability.cpp 2015-08-03 13:17:13 +0000
@@ -72,6 +72,17 @@
72 return info;72 return info;
73}73}
7474
75// TODO: Migrate to static const? --BM ==> GZ during JDfix for 0.14: SURE!
76// Some useful constants:
77const double Observability::Rad2Deg = 180./M_PI; // Convert degrees into radians
78const double Observability::Rad2Hr = 12./M_PI; // Convert hours into radians
79const double Observability::UA = AU; // 1.4958e+8; // Astronomical Unit in Km. ==> HAS BEEN DEFINED IN StelUtils.hpp!
80const double Observability::TFrac = 0.9972677595628414; // Convert sidereal time into Solar time
81const double Observability::JDsec = 1./86400.; // A second in days. ==> TODO USE StelCore::JD_SECOND instead
82const double Observability::halfpi = M_PI * 0.5; // 1.57079632675; // pi/2
83const double Observability::MoonT = 29.530588; // Moon synodic period (used as first estimate of Full Moon). ==> FIND MORE DEC. PLACES!
84const double Observability::RefFullMoon = 2451564.696; // Reference Julian date of a Full Moon.
85const double Observability::MoonPerilune = 0.0024236308; // Smallest Earth-Moon distance (in AU).
7586
7687
77Observability::Observability()88Observability::Observability()
@@ -110,17 +121,6 @@
110 setObjectName("Observability");121 setObjectName("Observability");
111 configDialog = new ObservabilityDialog();122 configDialog = new ObservabilityDialog();
112123
113 // TODO: Migrate to static const? --BM
114 // Some useful constants:
115 Rad2Deg = 180./3.1415927; // Convert degrees into radians
116 Rad2Hr = 12./3.1415927; // Convert hours into radians
117 UA = 1.4958e+8; // Astronomical Unit in Km.
118 TFrac = 0.9972677595628414; // Convert sidereal time into Solar time
119 JDsec = 1./86400.; // A second in days.
120 halfpi = 1.57079632675; // pi/2
121 MoonT = 29.530588; // Moon synodic period (used as first estimate of Full Moon).
122 RefFullMoon = 2451564.696; // Reference Julian date of a Full Moon.
123 MoonPerilune = 0.0024236308; // Smallest Earth-Moon distance (in AU).
124 124
125 nextFullMoon = 0.0;125 nextFullMoon = 0.0;
126 prevFullMoon = 0.0;126 prevFullMoon = 0.0;
@@ -129,7 +129,8 @@
129129
130 // Dummy initial values for parameters and data vectors:130 // Dummy initial values for parameters and data vectors:
131 mylat = 1000.; mylon = 1000.;131 mylat = 1000.; mylon = 1000.;
132 myJD = 0.0;132 myJD.first = 0.0;
133 myJD.second = 0.0;
133 curYear = 0;134 curYear = 0;
134 isStar = true;135 isStar = true;
135 isMoon = false;136 isMoon = false;
@@ -146,13 +147,21 @@
146147
147 // I think this can be done in a more simple way...--BM148 // I think this can be done in a more simple way...--BM
148 for (int i=0;i<366;i++) {149 for (int i=0;i<366;i++) {
149 sunRA[i] = 0.0; sunDec[i] = 0.0;150// sunRA[i] = 0.0; sunDec[i] = 0.0;
150 objectRA[i] = 0.0; objectDec[i]=0.0;151// objectRA[i] = 0.0; objectDec[i]=0.0;
151 sunSidT[0][i]=0.0; sunSidT[1][i]=0.0;152// sunSidT[0][i]=0.0; sunSidT[1][i]=0.0;
152 objectSidT[0][i]=0.0; objectSidT[1][i]=0.0;153// objectSidT[0][i]=0.0; objectSidT[1][i]=0.0;
153 objectH0[i] = 0.0;154// objectH0[i] = 0.0;
154 yearJD[i] = 0.0;155 yearJD[i]=QPair<double, double>(0.0, 0.0);
155 };156 };
157 // GZ Sure:
158 memset(sunRA, 0, 366*sizeof(double));
159 memset(sunDec, 0, 366*sizeof(double));
160 memset(objectRA, 0, 366*sizeof(double));
161 memset(objectDec, 0, 366*sizeof(double));
162 memset(sunSidT, 0, 2*366*sizeof(double));
163 memset(objectSidT, 0, 2*366*sizeof(double));
164 memset(objectH0, 0, 366*sizeof(double));
156165
157}166}
158167
@@ -281,7 +290,7 @@
281 double currlat = (core->getCurrentLocation().latitude)/Rad2Deg;290 double currlat = (core->getCurrentLocation().latitude)/Rad2Deg;
282 double currlon = (core->getCurrentLocation().longitude)/Rad2Deg;291 double currlon = (core->getCurrentLocation().longitude)/Rad2Deg;
283 double currheight = (6371.+(core->getCurrentLocation().altitude)/1000.)/UA;292 double currheight = (6371.+(core->getCurrentLocation().altitude)/1000.)/UA;
284 double currJD = core->getJDay();293 double currJD = core->getJD();
285 double currJDint;294 double currJDint;
286// GMTShift = StelUtils::getGMTShiftFromQT(currJD)/24.0;295// GMTShift = StelUtils::getGMTShiftFromQT(currJD)/24.0;
287 GMTShift = StelApp::getInstance().getLocaleMgr().getGMTShift(currJD)/24.0;296 GMTShift = StelApp::getInstance().getLocaleMgr().getGMTShift(currJD)/24.0;
@@ -302,7 +311,7 @@
302// NOW WE CHECK THE CHANGED PARAMETERS W.R.T. THE PREVIOUS FRAME:311// NOW WE CHECK THE CHANGED PARAMETERS W.R.T. THE PREVIOUS FRAME:
303312
304// Update JD.313// Update JD.
305 myJD = currJD;314 myJD.first = currJD;
306315
307// If the year changed, we must recompute the Sun's position for each new day:316// If the year changed, we must recompute the Sun's position for each new day:
308 if (auxy != curYear)317 if (auxy != curYear)
@@ -494,12 +503,12 @@
494 503
495 // Returns false if the calculation fails...504 // Returns false if the calculation fails...
496 solvedMoon = calculateSolarSystemEvents(core, type);505 solvedMoon = calculateSolarSystemEvents(core, type);
497 currH = qAbs(24.*(MoonCulm-myJD)/TFrac);506 currH = qAbs(24.*(MoonCulm-myJD.first)/TFrac);
498 transit = MoonCulm-myJD<0.0;507 transit = MoonCulm-myJD.first<0.0;
499 if (solvedMoon)508 if (solvedMoon)
500 { // If failed, Set and Rise will be dummy.509 { // If failed, Set and Rise will be dummy.
501 settingTime = qAbs(24.*(MoonSet-myJD)/TFrac);510 settingTime = qAbs(24.*(MoonSet-myJD.first)/TFrac);
502 risingTime = qAbs(24.*(MoonRise-myJD)/TFrac);511 risingTime = qAbs(24.*(MoonRise-myJD.first)/TFrac);
503 }512 }
504 }513 }
505 else if (horizH>0.0)514 else if (horizH>0.0)
@@ -947,7 +956,7 @@
947QString Observability::formatAsDate(int dayNumber)956QString Observability::formatAsDate(int dayNumber)
948{957{
949 int day, month, year;958 int day, month, year;
950 StelUtils::getDateFromJulianDay(yearJD[dayNumber], &year, &month, &day);959 StelUtils::getDateFromJulianDay(yearJD[dayNumber].first, &year, &month, &day);
951960
952 QString formatString = (getDateFormat()) ? "%1 %2" : "%2 %1";961 QString formatString = (getDateFormat()) ? "%1 %2" : "%2 %1";
953 QString result = formatString.arg(day).arg(monthNames[month-1]);962 QString result = formatString.arg(day).arg(monthNames[month-1]);
@@ -960,8 +969,8 @@
960{969{
961 int sDay, sMonth, sYear, eDay, eMonth, eYear;970 int sDay, sMonth, sYear, eDay, eMonth, eYear;
962 QString range;971 QString range;
963 StelUtils::getDateFromJulianDay(yearJD[startDay], &sYear, &sMonth, &sDay);972 StelUtils::getDateFromJulianDay(yearJD[startDay].first, &sYear, &sMonth, &sDay);
964 StelUtils::getDateFromJulianDay(yearJD[endDay], &eYear, &eMonth, &eDay);973 StelUtils::getDateFromJulianDay(yearJD[endDay].first, &eYear, &eMonth, &eDay);
965 if (endDay == 0)974 if (endDay == 0)
966 {975 {
967 eDay = 31;976 eDay = 31;
@@ -1017,7 +1026,7 @@
1017{1026{
1018 int day, month, year, sameYear;1027 int day, month, year, sameYear;
1019// Get current date:1028// Get current date:
1020 StelUtils::getDateFromJulianDay(myJD,&year,&month,&day);1029 StelUtils::getDateFromJulianDay(myJD.first,&year,&month,&day);
10211030
1022// Get JD for the Jan 1 of current year:1031// Get JD for the Jan 1 of current year:
1023 StelUtils::getJDFromDate(&Jan1stJD,year,1,1,0,0,0);1032 StelUtils::getJDFromDate(&Jan1stJD,year,1,1,0,0,0);
@@ -1030,9 +1039,10 @@
1030 Vec3d pos, sunPos;1039 Vec3d pos, sunPos;
1031 for (int i=0; i<nDays; i++)1040 for (int i=0; i<nDays; i++)
1032 {1041 {
1033 yearJD[i] = Jan1stJD + (double)i;1042 yearJD[i].first = Jan1stJD + (double)i;
1034 myEarth->computePosition(yearJD[i]);1043 yearJD[i].second = yearJD[i].first+core->computeDeltaT(yearJD[i].first)/86400.0;
1035 myEarth->computeTransMatrix(yearJD[i]);1044 myEarth->computePosition(yearJD[i].second);
1045 myEarth->computeTransMatrix(yearJD[i].first, yearJD[i].second);
1036 pos = myEarth->getHeliocentricEclipticPos();1046 pos = myEarth->getHeliocentricEclipticPos();
1037 sunPos = core->j2000ToEquinoxEqu((core->matVsop87ToJ2000)*(-pos));1047 sunPos = core->j2000ToEquinoxEqu((core->matVsop87ToJ2000)*(-pos));
1038 EarthPos[i] = -pos;1048 EarthPos[i] = -pos;
@@ -1040,8 +1050,8 @@
1040 };1050 };
10411051
1042//Return the Earth to its current time:1052//Return the Earth to its current time:
1043 myEarth->computePosition(myJD);1053 myEarth->computePosition(myJD.second);
1044 myEarth->computeTransMatrix(myJD);1054 myEarth->computeTransMatrix(myJD.first, myJD.second);
1045}1055}
1046///////////////////////////////////////////////////1056///////////////////////////////////////////////////
10471057
@@ -1261,24 +1271,24 @@
1261//////////////////////////1271//////////////////////////
1262// Get the coordinates of Sun or Moon for a given JD:1272// Get the coordinates of Sun or Moon for a given JD:
1263// getBack controls whether Earth and Moon must be returned to their original positions after computation.1273// getBack controls whether Earth and Moon must be returned to their original positions after computation.
1264void Observability::getSunMoonCoords(StelCore *core, double jd,1274void Observability::getSunMoonCoords(StelCore *core, QPair<double, double> JD,
1265 double &raSun, double &decSun,1275 double &raSun, double &decSun,
1266 double &raMoon, double &decMoon,1276 double &raMoon, double &decMoon,
1267 double &eclLon, bool getBack) 1277 double &eclLon, bool getBack)
1268 //, Vec3d &AltAzVector)1278 //, Vec3d &AltAzVector)
1269{1279{
12701280
1271 if (getBack) // Return the Moon and Earth to their current position:1281 if (getBack) // Return the Moon and Earth to their current position:
1272 {1282 {
1273 myEarth->computePosition(jd);1283 myEarth->computePosition(JD.second);
1274 myEarth->computeTransMatrix(jd);1284 myEarth->computeTransMatrix(JD.first, JD.second);
1275 myMoon->computePosition(jd);1285 myMoon->computePosition(JD.second);
1276 myMoon->computeTransMatrix(jd);1286 myMoon->computeTransMatrix(JD.first, JD.second);
1277 } 1287 }
1278 else // Compute coordinates:1288 else // Compute coordinates:
1279 {1289 {
1280 myEarth->computePosition(jd);1290 myEarth->computePosition(JD.second);
1281 myEarth->computeTransMatrix(jd);1291 myEarth->computeTransMatrix(JD.first, JD.second);
1282 Vec3d earthPos = myEarth->getHeliocentricEclipticPos();1292 Vec3d earthPos = myEarth->getHeliocentricEclipticPos();
1283 double curSidT;1293 double curSidT;
12841294
@@ -1287,11 +1297,11 @@
1287 toRADec(sunPos, raSun, decSun);1297 toRADec(sunPos, raSun, decSun);
12881298
1289// Moon coordinates:1299// Moon coordinates:
1290 curSidT = myEarth->getSiderealTime(jd)/Rad2Deg;1300 curSidT = myEarth->getSiderealTime(JD.first, JD.second)/Rad2Deg;
1291 RotObserver = (Mat4d::zrotation(curSidT))*ObserverLoc;1301 RotObserver = (Mat4d::zrotation(curSidT))*ObserverLoc;
1292 LocTrans = (core->matVsop87ToJ2000)*(Mat4d::translation(-earthPos));1302 LocTrans = (core->matVsop87ToJ2000)*(Mat4d::translation(-earthPos));
1293 myMoon->computePosition(jd);1303 myMoon->computePosition(JD.second);
1294 myMoon->computeTransMatrix(jd);1304 myMoon->computeTransMatrix(JD.first, JD.second);
1295 Vec3d moonPos = myMoon->getHeliocentricEclipticPos();1305 Vec3d moonPos = myMoon->getHeliocentricEclipticPos();
1296 sunPos = (core->j2000ToEquinoxEqu(LocTrans*moonPos))-RotObserver;1306 sunPos = (core->j2000ToEquinoxEqu(LocTrans*moonPos))-RotObserver;
1297 1307
@@ -1307,20 +1317,20 @@
1307//////////////////////////1317//////////////////////////
1308// Get the Observer-to-Moon distance JD:1318// Get the Observer-to-Moon distance JD:
1309// getBack controls whether Earth and Moon must be returned to their original positions after computation.1319// getBack controls whether Earth and Moon must be returned to their original positions after computation.
1310void Observability::getMoonDistance(StelCore *core, double jd, double &distance, bool getBack)1320void Observability::getMoonDistance(StelCore *core, QPair<double, double> JD, double &distance, bool getBack)
1311{1321{
13121322
1313 if (getBack) // Return the Moon and Earth to their current position:1323 if (getBack) // Return the Moon and Earth to their current position:
1314 {1324 {
1315 myEarth->computePosition(jd);1325 myEarth->computePosition(JD.second);
1316 myEarth->computeTransMatrix(jd);1326 myEarth->computeTransMatrix(JD.first, JD.second);
1317 myMoon->computePosition(jd);1327 myMoon->computePosition(JD.second);
1318 myMoon->computeTransMatrix(jd);1328 myMoon->computeTransMatrix(JD.first, JD.second);
1319 } 1329 }
1320 else1330 else
1321 { // Compute coordinates:1331 { // Compute coordinates:
1322 myEarth->computePosition(jd);1332 myEarth->computePosition(JD.second);
1323 myEarth->computeTransMatrix(jd);1333 myEarth->computeTransMatrix(JD.first, JD.second);
1324 Vec3d earthPos = myEarth->getHeliocentricEclipticPos();1334 Vec3d earthPos = myEarth->getHeliocentricEclipticPos();
1325// double curSidT;1335// double curSidT;
13261336
@@ -1332,8 +1342,8 @@
1332// curSidT = myEarth->getSiderealTime(JD)/Rad2Deg;1342// curSidT = myEarth->getSiderealTime(JD)/Rad2Deg;
1333// RotObserver = (Mat4d::zrotation(curSidT))*ObserverLoc;1343// RotObserver = (Mat4d::zrotation(curSidT))*ObserverLoc;
1334 LocTrans = (core->matVsop87ToJ2000)*(Mat4d::translation(-earthPos));1344 LocTrans = (core->matVsop87ToJ2000)*(Mat4d::translation(-earthPos));
1335 myMoon->computePosition(jd);1345 myMoon->computePosition(JD.second);
1336 myMoon->computeTransMatrix(jd);1346 myMoon->computeTransMatrix(JD.first, JD.second);
1337 Pos1 = myMoon->getHeliocentricEclipticPos();1347 Pos1 = myMoon->getHeliocentricEclipticPos();
1338 Pos2 = (core->j2000ToEquinoxEqu(LocTrans*Pos1)); //-RotObserver;1348 Pos2 = (core->j2000ToEquinoxEqu(LocTrans*Pos1)); //-RotObserver;
13391349
@@ -1349,24 +1359,24 @@
13491359
1350//////////////////////////////////////////////1360//////////////////////////////////////////////
1351// Get the Coords of a planet:1361// Get the Coords of a planet:
1352void Observability::getPlanetCoords(StelCore *core, double JD, double &RA, double &Dec, bool getBack)1362void Observability::getPlanetCoords(StelCore *core, QPair<double, double> JD, double &RA, double &Dec, bool getBack)
1353{1363{
13541364
1355 if (getBack)1365 if (getBack)
1356 {1366 {
1357 // Return the planet to its current time:1367 // Return the planet to its current time:
1358 myPlanet->computePosition(JD);1368 myPlanet->computePosition(JD.second);
1359 myPlanet->computeTransMatrix(JD);1369 myPlanet->computeTransMatrix(JD.first, JD.second);
1360 myEarth->computePosition(JD);1370 myEarth->computePosition(JD.second);
1361 myEarth->computeTransMatrix(JD);1371 myEarth->computeTransMatrix(JD.first, JD.second);
1362 } else1372 } else
1363 {1373 {
1364 // Compute planet's position:1374 // Compute planet's position:
1365 myPlanet->computePosition(JD);1375 myPlanet->computePosition(JD.second);
1366 myPlanet->computeTransMatrix(JD);1376 myPlanet->computeTransMatrix(JD.first, JD.second);
1367 Pos1 = myPlanet->getHeliocentricEclipticPos();1377 Pos1 = myPlanet->getHeliocentricEclipticPos();
1368 myEarth->computePosition(JD);1378 myEarth->computePosition(JD.second);
1369 myEarth->computeTransMatrix(JD);1379 myEarth->computeTransMatrix(JD.first, JD.second);
1370 Pos2 = myEarth->getHeliocentricEclipticPos();1380 Pos2 = myEarth->getHeliocentricEclipticPos();
1371 LocTrans = (core->matVsop87ToJ2000)*(Mat4d::translation(-Pos2));1381 LocTrans = (core->matVsop87ToJ2000)*(Mat4d::translation(-Pos2));
1372 Pos2 = core->j2000ToEquinoxEqu(LocTrans*Pos1);1382 Pos2 = core->j2000ToEquinoxEqu(LocTrans*Pos1);
@@ -1385,7 +1395,8 @@
13851395
1386 const int NUM_ITER = 100;1396 const int NUM_ITER = 100;
1387 int i;1397 int i;
1388 double hHoriz, ra, dec, raSun, decSun, tempH, tempJd, tempEphH, curSidT, eclLon;1398 double hHoriz, ra, dec, raSun, decSun, tempH, /* tempJd, */ tempEphH, curSidT, eclLon;
1399 QPair<double, double> tempJd;
1389 //Vec3d Observer;1400 //Vec3d Observer;
13901401
1391 hHoriz = calculateHourAngle(mylat, refractedHorizonAlt, selDec);1402 hHoriz = calculateHourAngle(mylat, refractedHorizonAlt, selDec);
@@ -1394,15 +1405,15 @@
13941405
1395// Only recompute ephemeris from second to second (at least)1406// Only recompute ephemeris from second to second (at least)
1396// or if the source has changed (i.e., Sun <-> Moon). This saves resources:1407// or if the source has changed (i.e., Sun <-> Moon). This saves resources:
1397 if (qAbs(myJD-lastJDMoon)>JDsec || lastType!=bodyType || souChanged)1408 if (qAbs(myJD.first-lastJDMoon)>JDsec || lastType!=bodyType || souChanged)
1398 {1409 {
13991410
1400// qDebug() << q_("%1 %2 %3 %4").arg(Kind).arg(LastObject).arg(myJD,0,'f',5).arg(lastJDMoon,0,'f',5);1411// qDebug() << q_("%1 %2 %3 %4").arg(Kind).arg(LastObject).arg(myJD,0,'f',5).arg(lastJDMoon,0,'f',5);
14011412
1402 lastType = bodyType;1413 lastType = bodyType;
14031414
1404 myEarth->computePosition(myJD);1415 myEarth->computePosition(myJD.second);
1405 myEarth->computeTransMatrix(myJD);1416 myEarth->computeTransMatrix(myJD.first, myJD.second);
1406 Vec3d earthPos = myEarth->getHeliocentricEclipticPos();1417 Vec3d earthPos = myEarth->getHeliocentricEclipticPos();
14071418
1408 if (bodyType == 1) // Sun position1419 if (bodyType == 1) // Sun position
@@ -1411,18 +1422,18 @@
1411 }1422 }
1412 else if (bodyType==2) // Moon position1423 else if (bodyType==2) // Moon position
1413 {1424 {
1414 curSidT = myEarth->getSiderealTime(myJD)/Rad2Deg;1425 curSidT = myEarth->getSiderealTime(myJD.first, myJD.second)/Rad2Deg;
1415 RotObserver = (Mat4d::zrotation(curSidT))*ObserverLoc;1426 RotObserver = (Mat4d::zrotation(curSidT))*ObserverLoc;
1416 LocTrans = (core->matVsop87ToJ2000)*(Mat4d::translation(-earthPos));1427 LocTrans = (core->matVsop87ToJ2000)*(Mat4d::translation(-earthPos));
1417 myMoon->computePosition(myJD);1428 myMoon->computePosition(myJD.second);
1418 myMoon->computeTransMatrix(myJD);1429 myMoon->computeTransMatrix(myJD.first, myJD.second);
1419 Pos1 = myMoon->getHeliocentricEclipticPos();1430 Pos1 = myMoon->getHeliocentricEclipticPos();
1420 Pos2 = (core->j2000ToEquinoxEqu(LocTrans*Pos1))-RotObserver;1431 Pos2 = (core->j2000ToEquinoxEqu(LocTrans*Pos1))-RotObserver;
1421 }1432 }
1422 else // Planet position1433 else // Planet position
1423 {1434 {
1424 myPlanet->computePosition(myJD);1435 myPlanet->computePosition(myJD.second);
1425 myPlanet->computeTransMatrix(myJD);1436 myPlanet->computeTransMatrix(myJD.first, myJD.second);
1426 Pos1 = myPlanet->getHeliocentricEclipticPos();1437 Pos1 = myPlanet->getHeliocentricEclipticPos();
1427 LocTrans = (core->matVsop87ToJ2000)*(Mat4d::translation(-earthPos));1438 LocTrans = (core->matVsop87ToJ2000)*(Mat4d::translation(-earthPos));
1428 Pos2 = core->j2000ToEquinoxEqu(LocTrans*Pos1);1439 Pos2 = core->j2000ToEquinoxEqu(LocTrans*Pos1);
@@ -1452,11 +1463,12 @@
14521463
1453// Rise time:1464// Rise time:
1454 tempEphH = MoonRise*TFrac;1465 tempEphH = MoonRise*TFrac;
1455 MoonRise = myJD + (MoonRise/24.);1466 MoonRise = myJD.first + (MoonRise/24.);
1456 for (i=0; i<NUM_ITER; i++)1467 for (i=0; i<NUM_ITER; i++)
1457 {1468 {
1458 // Get modified coordinates:1469 // Get modified coordinates:
1459 tempJd = MoonRise;1470 tempJd.first = MoonRise;
1471 tempJd.second=tempJd.first+core->computeDeltaT(tempJd.first)/86400.0;
1460 1472
1461 if (bodyType<3)1473 if (bodyType<3)
1462 {1474 {
@@ -1485,16 +1497,18 @@
1485 if (qAbs(tempH-tempEphH)<JDsec) break;1497 if (qAbs(tempH-tempEphH)<JDsec) break;
1486 // Update rise-time estimate:1498 // Update rise-time estimate:
1487 tempEphH = tempH;1499 tempEphH = tempH;
1488 MoonRise = myJD + (tempEphH/24.);1500 MoonRise = myJD.first + (tempEphH/24.);
1489 };1501 };
14901502
1491// Set time: 1503// Set time:
1492 tempEphH = MoonSet;1504 tempEphH = MoonSet;
1493 MoonSet = myJD + (MoonSet/24.);1505 MoonSet = myJD.first + (MoonSet/24.);
1494 for (i=0; i<NUM_ITER; i++)1506 for (i=0; i<NUM_ITER; i++)
1495 {1507 {
1496 // Get modified coordinates:1508 // Get modified coordinates:
1497 tempJd = MoonSet;1509 tempJd.first = MoonSet;
1510 tempJd.second=tempJd.first+core->computeDeltaT(tempJd.first)/86400.0;
1511
1498 1512
1499 if (bodyType < 3)1513 if (bodyType < 3)
1500 getSunMoonCoords(core, tempJd,1514 getSunMoonCoords(core, tempJd,
@@ -1521,7 +1535,7 @@
1521 break;1535 break;
1522 // Update set-time estimate:1536 // Update set-time estimate:
1523 tempEphH = tempH;1537 tempEphH = tempH;
1524 MoonSet = myJD + (tempEphH/24.);1538 MoonSet = myJD.first + (tempEphH/24.);
1525 };1539 };
1526 } 1540 }
1527 else // Comes from if(raises)1541 else // Comes from if(raises)
@@ -1532,12 +1546,14 @@
15321546
1533// Culmination time:1547// Culmination time:
1534 tempEphH = MoonCulm;1548 tempEphH = MoonCulm;
1535 MoonCulm = myJD + (MoonCulm/24.);1549 MoonCulm = myJD.first + (MoonCulm/24.);
15361550
1537 for (i=0; i<NUM_ITER; i++)1551 for (i=0; i<NUM_ITER; i++)
1538 {1552 {
1539 // Get modified coordinates:1553 // Get modified coordinates:
1540 tempJd = MoonCulm;1554 tempJd.first = MoonCulm;
1555 tempJd.second=tempJd.first+core->computeDeltaT(tempJd.first)/86400.0;
1556
15411557
1542 if (bodyType<3)1558 if (bodyType<3)
1543 {1559 {
@@ -1561,16 +1577,16 @@
1561 // Check convergence:1577 // Check convergence:
1562 if (qAbs(tempH-tempEphH)<JDsec) break;1578 if (qAbs(tempH-tempEphH)<JDsec) break;
1563 tempEphH = tempH;1579 tempEphH = tempH;
1564 MoonCulm = myJD + (tempEphH/24.);1580 MoonCulm = myJD.first + (tempEphH/24.);
1565 culmAlt = qAbs(mylat-dec); // 90 - altitude at transit.1581 culmAlt = qAbs(mylat-dec); // 90 - altitude at transit.
1566 };1582 };
15671583
1568// qDebug() << q_("%1").arg(MoonCulm,0,'f',5);1584// qDebug() << q_("%1").arg(MoonCulm,0,'f',5);
15691585
15701586
1571 lastJDMoon = myJD;1587 lastJDMoon = myJD.first;
15721588
1573 }; // Comes from if (qAbs(myJD-lastJDMoon)>JDsec || LastObject!=Kind)1589 }; // Comes from if (qAbs(myJD.first-lastJDMoon)>JDsec || LastObject!=Kind)
15741590
15751591
15761592
@@ -1580,13 +1596,13 @@
1580 {1596 {
15811597
1582 // Only estimate date of Full Moon if we have changed Lunar month:1598 // Only estimate date of Full Moon if we have changed Lunar month:
1583 if (myJD > nextFullMoon || myJD < prevFullMoon)1599 if (myJD.first > nextFullMoon || myJD.first < prevFullMoon)
1584 {1600 {
15851601
15861602
1587 // Estimate the nearest (in time) Full Moon:1603 // Estimate the nearest (in time) Full Moon:
1588 double nT;1604 double nT;
1589 double dT = std::modf((myJD-RefFullMoon)/MoonT,&nT);1605 double dT = std::modf((myJD.first-RefFullMoon)/MoonT,&nT);
1590 if (dT>0.5) {nT += 1.0;};1606 if (dT>0.5) {nT += 1.0;};
1591 if (dT<-0.5) {nT -= 1.0;};1607 if (dT<-0.5) {nT -= 1.0;};
15921608
@@ -1596,7 +1612,8 @@
15961612
1597 dT = 0.1/1440.; // 6 seconds. Our time span for the finite-difference derivative estimate.1613 dT = 0.1/1440.; // 6 seconds. Our time span for the finite-difference derivative estimate.
1598// double Deriv1, Deriv2; // Variables for temporal use.1614// double Deriv1, Deriv2; // Variables for temporal use.
1599 double Sec1, Sec2, Temp1, Temp2; // Variables for temporal use.1615 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.
1616 double Temp1, Temp2; // Variables for temporal use.
1600 double iniEst1, iniEst2; // JD values that MUST include the solution within them.1617 double iniEst1, iniEst2; // JD values that MUST include the solution within them.
1601 double Phase1;1618 double Phase1;
16021619
@@ -1606,26 +1623,31 @@
1606 iniEst1 = TempFullMoon - 0.25*MoonT; 1623 iniEst1 = TempFullMoon - 0.25*MoonT;
1607 iniEst2 = TempFullMoon + 0.25*MoonT; 1624 iniEst2 = TempFullMoon + 0.25*MoonT;
16081625
1609 Sec1 = iniEst1; // TempFullMoon - 0.05*MoonT; // Initial estimates of Full-Moon dates1626
1610 Sec2 = iniEst2; // TempFullMoon + 0.05*MoonT; 1627 Sec1.first = iniEst1; // TempFullMoon - 0.05*MoonT; // Initial estimates of Full-Moon dates
16111628 Sec1.second= core->computeDeltaT(Sec1.first)/86400.0; // enough to compute this once.
1612 getSunMoonCoords(core,Sec1,raSun,decSun,ra,dec,eclLon,false);1629 Sec2.first = iniEst2; // TempFullMoon + 0.05*MoonT;
1630 Sec2.second= core->computeDeltaT(Sec2.first)/86400.0; // enough to compute this once.
1631
1632 // for the computation calls, we need temporary QPairs here!
1633 getSunMoonCoords(core,QPair<double, double>(Sec1.first, Sec1.first+Sec1.second),raSun,decSun,ra,dec,eclLon,false);
1613 Temp1 = eclLon; //Lambda(RA,Dec,RAS,DecS);1634 Temp1 = eclLon; //Lambda(RA,Dec,RAS,DecS);
1614 getSunMoonCoords(core,Sec2,raSun,decSun,ra,dec,eclLon,false);1635 getSunMoonCoords(core,QPair<double, double>(Sec2.first, Sec2.first+Sec2.second),raSun,decSun,ra,dec,eclLon,false);
1615 Temp2 = eclLon; //Lambda(RA,Dec,RAS,DecS);1636 Temp2 = eclLon; //Lambda(RA,Dec,RAS,DecS);
16161637
16171638
1618 for (int i=0; i<100; i++) // A limit of 100 iterations.1639 for (int i=0; i<100; i++) // A limit of 100 iterations.
1619 {1640 {
1620 Phase1 = (Sec2-Sec1)/(Temp1-Temp2)*Temp1+Sec1;1641 Phase1 = (Sec2.first-Sec1.first)/(Temp1-Temp2)*Temp1+Sec1.first;
1621 getSunMoonCoords(core,Phase1,raSun,decSun,ra,dec,eclLon,false);1642 // The ad-hoc pair needs a DeltaT, use the one of Sec1
1643 getSunMoonCoords(core,QPair<double, double>(Phase1, Phase1+Sec1.second),raSun,decSun,ra,dec,eclLon,false);
1622 1644
1623 if (Temp1*eclLon < 0.0) 1645 if (Temp1*eclLon < 0.0)
1624 {1646 {
1625 Sec2 = Phase1;1647 Sec2.first = Phase1;
1626 Temp2 = eclLon;1648 Temp2 = eclLon;
1627 } else {1649 } else {
1628 Sec1 = Phase1;1650 Sec1.first = Phase1;
1629 Temp1 = eclLon;1651 Temp1 = eclLon;
16301652
1631 };1653 };
@@ -1633,9 +1655,9 @@
1633 // qDebug() << QString("%1 %2 %3 %4 ").arg(Sec1).arg(Sec2).arg(Temp1).arg(Temp2); 1655 // qDebug() << QString("%1 %2 %3 %4 ").arg(Sec1).arg(Sec2).arg(Temp1).arg(Temp2);
16341656
16351657
1636 if (qAbs(Sec2-Sec1) < 10.*dT) // 1 minute accuracy; convergence.1658 if (qAbs(Sec2.first-Sec1.first) < 10.*dT) // 1 minute accuracy; convergence.
1637 {1659 {
1638 TempFullMoon = (Sec1+Sec2)/2.;1660 TempFullMoon = (Sec1.first+Sec2.first)/2.;
1639 // qDebug() << QString("%1%2 ").arg(TempFullMoon); 1661 // qDebug() << QString("%1%2 ").arg(TempFullMoon);
1640 break;1662 break;
1641 };1663 };
@@ -1643,7 +1665,7 @@
1643 };1665 };
16441666
16451667
1646 if (TempFullMoon > myJD) 1668 if (TempFullMoon > myJD.first)
1647 {1669 {
1648 nextFullMoon = TempFullMoon;1670 nextFullMoon = TempFullMoon;
1649 TempFullMoon -= MoonT;1671 TempFullMoon -= MoonT;
16501672
=== modified file 'plugins/Observability/src/Observability.hpp'
--- plugins/Observability/src/Observability.hpp 2015-05-30 19:56:47 +0000
+++ plugins/Observability/src/Observability.hpp 2015-08-03 13:17:13 +0000
@@ -21,6 +21,7 @@
21#include "StelModule.hpp"21#include "StelModule.hpp"
22#include <QFont>22#include <QFont>
23#include <QString>23#include <QString>
24#include <QPair>
24#include "VecMath.hpp"25#include "VecMath.hpp"
25#include "SolarSystem.hpp"26#include "SolarSystem.hpp"
26#include "Planet.hpp"27#include "Planet.hpp"
@@ -190,33 +191,33 @@
190191
191//! Computes the Sun or Moon coordinates at a given Julian date.192//! Computes the Sun or Moon coordinates at a given Julian date.
192//! @param core the stellarium core.193//! @param core the stellarium core.
193//! @param JD double for the Julian date.194//! @param JD QPair of double for the Julian date: first=JD_UT and .second=JDE_DT
194//! @param RASun right ascension of the Sun (in hours).195//! @param RASun right ascension of the Sun (in hours).
195//! @param DecSun declination of the Sun (in radians).196//! @param DecSun declination of the Sun (in radians).
196//! @param RAMoon idem for the Moon.197//! @param RAMoon idem for the Moon.
197//! @param DecMoon idem for the Moon.198//! @param DecMoon idem for the Moon.
198//! @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.199//! @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.
199//! @param getBack controls whether Earth and Moon must be returned to their original positions after computation.200//! @param getBack controls whether Earth and Moon must be returned to their original positions after computation.
200 void getSunMoonCoords(StelCore* core, double jd,201 void getSunMoonCoords(StelCore* core, QPair<double, double> JD,
201 double& raSun, double& decSun,202 double& raSun, double& decSun,
202 double& raMoon, double& decMoon,203 double& raMoon, double& decMoon,
203 double& eclLon, bool getBack);204 double& eclLon, bool getBack);
204205
205206
206//! computes the selected-planet coordinates at a given Julian date.207//! computes the selected-planet coordinates at a given Julian date.
207//! @param core the stellarium core.208//! @param core the stellarium core.
208//! @param JD double for the Julian date.209//! @param JD QPair for the Julian date: .first=JD(UT), .second=JDE
209//! @param RA right ascension of the planet (in hours).210//! @param RA right ascension of the planet (in hours).
210//! @param Dec declination of the planet (in radians).211//! @param Dec declination of the planet (in radians).
211//! @param getBack controls whether the planet must be returned to its original positions after computation.212//! @param getBack controls whether the planet must be returned to its original positions after computation.
212 void getPlanetCoords(StelCore* core, double JD, double &RA, double &Dec, bool getBack);213 void getPlanetCoords(StelCore* core, QPair<double, double> JD, double &RA, double &Dec, bool getBack);
213214
214//! Comptues the Earth-Moon distance (in AU) at a given Julian date.215//! Computes the Earth-Moon distance (in AU) at a given Julian date.
215//! The parameters are similar to those of getSunMoonCoords or getPlanetCoords.216//! The parameters are similar to those of getSunMoonCoords() or getPlanetCoords().
216 void getMoonDistance(StelCore* core,217 void getMoonDistance(StelCore* core,
217 double jd,218 QPair<double, double> JD,
218 double& distance,219 double& distance,
219 bool getBack);220 bool getBack);
220221
221//! Returns the angular separation (in radians) between two points.222//! Returns the angular separation (in radians) between two points.
222//! @param RA1 right ascension of point 1 (in hours)223//! @param RA1 right ascension of point 1 (in hours)
@@ -268,15 +269,19 @@
268 void toRADec(Vec3d vec3d, double& ra, double& dec);269 void toRADec(Vec3d vec3d, double& ra, double& dec);
269270
270 //! Table containing the Julian Dates of the days of the current year.271 //! Table containing the Julian Dates of the days of the current year.
271 double yearJD[366];272 QPair<double, double> yearJD[366]; // GZ: This had to become a QPair of JD.first=JD_UT, JD.second=JDE
272273
273//! Check if a source is observable during a given date.274//! Check if a source is observable during a given date.
274//! @param i the day of the year.275//! @param i the day of the year.
275 bool CheckRise(int day);276 bool CheckRise(int day);
276277
277//! Some useful constants and variables(almost self-explanatory).278//! Some useful constants (almost self-explanatory).
278 double Rad2Deg, Rad2Hr, UA, TFrac, JDsec, Jan1stJD, halfpi, MoonT, nextFullMoon, prevFullMoon, RefFullMoon, GMTShift, MoonPerilune;279// GZ: Made true constants out of those, and improved accuracy of some.
279 280 static const double Rad2Deg, Rad2Hr, UA, TFrac, JDsec, halfpi, MoonT, RefFullMoon, MoonPerilune;
281
282//! Some useful variables(almost self-explanatory).
283 double nextFullMoon, prevFullMoon, GMTShift, Jan1stJD;
284
280 //! User-defined angular altitude of astronomical twilight in radians.285 //! User-defined angular altitude of astronomical twilight in radians.
281 //! See setTwilightAltitude() and getTwilightAltitude().286 //! See setTwilightAltitude() and getTwilightAltitude().
282 double twilightAltRad;287 double twilightAltRad;
@@ -292,7 +297,9 @@
292 int horizonAltDeg;297 int horizonAltDeg;
293298
294//! RA, Dec, observer latitude, object's elevation, and Hour Angle at horizon.299//! RA, Dec, observer latitude, object's elevation, and Hour Angle at horizon.
295 double selRA, selDec, mylat, mylon, alti, horizH, culmAlt, myJD;300 double selRA, selDec, mylat, mylon, alti, horizH, culmAlt;
301//! Some place to keep JD and JDE. .first is JD(UT), .second is for the fitting JDE.
302 QPair<double, double> myJD;
296303
297//! Vectors to store Sun's RA, Dec, and Sid. Time at twilight and rise/set.304//! Vectors to store Sun's RA, Dec, and Sid. Time at twilight and rise/set.
298 double sunRA[366];305 double sunRA[366];
@@ -304,7 +311,7 @@
304 double objectRA[366]; 311 double objectRA[366];
305 double objectDec[366];312 double objectDec[366];
306 double objectH0[366];313 double objectH0[366];
307 //! Table of the sidereal time of the object's rising/setting. 314//! Table of the sidereal time of the object's rising/setting.
308 double objectSidT[2][366];315 double objectSidT[2][366];
309316
310//! Rise/Set/Transit times for the Moon at current day:317//! Rise/Set/Transit times for the Moon at current day:
311318
=== modified file 'plugins/PointerCoordinates/src/PointerCoordinates.cpp'
--- plugins/PointerCoordinates/src/PointerCoordinates.cpp 2015-04-24 17:04:28 +0000
+++ plugins/PointerCoordinates/src/PointerCoordinates.cpp 2015-08-03 13:17:13 +0000
@@ -210,7 +210,7 @@
210 {210 {
211 double lambda, beta;211 double lambda, beta;
212 StelUtils::rectToSphe(&cx,&cy,core->j2000ToEquinoxEqu(mousePosition));212 StelUtils::rectToSphe(&cx,&cy,core->j2000ToEquinoxEqu(mousePosition));
213 StelUtils::equToEcl(cx, cy, core->getCurrentPlanet()->getRotObliquity(core->getJDay()), &lambda, &beta); // Calculate ecliptic position and show it...213 StelUtils::equToEcl(cx, cy, core->getCurrentPlanet()->getRotObliquity(core->getJDE()), &lambda, &beta); // Calculate ecliptic position and show it...
214 if (lambda<0) lambda+=2.0*M_PI;214 if (lambda<0) lambda+=2.0*M_PI;
215 coordsSystem = qc_("Ecl. Long/Lat", "abbreviated in the plugin");215 coordsSystem = qc_("Ecl. Long/Lat", "abbreviated in the plugin");
216 if (withDecimalDegree)216 if (withDecimalDegree)
@@ -247,7 +247,7 @@
247 case HourAngle:247 case HourAngle:
248 {248 {
249 Vec3d v = core->j2000ToAltAz(mousePosition, StelCore::RefractionAuto);249 Vec3d v = core->j2000ToAltAz(mousePosition, StelCore::RefractionAuto);
250 StelUtils::rectToSphe(&cx,&cy,Mat4d::zrotation(-core->getLocalSiderealTime()+((core->getDeltaT(core->getJDay())/240.)*M_PI/180.))*core->altAzToEquinoxEqu(v, StelCore::RefractionOff));250 StelUtils::rectToSphe(&cx,&cy,Mat4d::zrotation(-core->getLocalSiderealTime())*core->altAzToEquinoxEqu(v, StelCore::RefractionOff));
251 cx = 2.*M_PI-cx;251 cx = 2.*M_PI-cx;
252 coordsSystem = qc_("HA/Dec", "abbreviated in the plugin");252 coordsSystem = qc_("HA/Dec", "abbreviated in the plugin");
253 if (withDecimalDegree)253 if (withDecimalDegree)
254254
=== modified file 'plugins/Satellites/src/Satellite.cpp'
--- plugins/Satellites/src/Satellite.cpp 2015-06-18 19:50:02 +0000
+++ plugins/Satellites/src/Satellite.cpp 2015-08-03 13:17:13 +0000
@@ -612,8 +612,7 @@
612 if (pSatWrapper && orbitValid)612 if (pSatWrapper && orbitValid)
613 {613 {
614 StelCore* core = StelApp::getInstance().getCore();614 StelCore* core = StelApp::getInstance().getCore();
615 double JD = core->getJDay();615 epochTime = core->getJD(); // We have "true" JD from core, satellites don't need JDE!
616 epochTime = JD - core->getDeltaT(JD)/86400; // Delta T anti-correction for artificial satellites
617616
618 pSatWrapper->setEpoch(epochTime);617 pSatWrapper->setEpoch(epochTime);
619 position = pSatWrapper->getTEMEPos();618 position = pSatWrapper->getTEMEPos();
@@ -730,7 +729,7 @@
730729
731void Satellite::draw(StelCore* core, StelPainter& painter, float)730void Satellite::draw(StelCore* core, StelPainter& painter, float)
732{731{
733 if (core->getJDay()<jdLaunchYearJan1 || !displayed)732 if (core->getJD()<jdLaunchYearJan1 || !displayed)
734 return;733 return;
735734
736 XYZ = getJ2000EquatorialPos(core);735 XYZ = getJ2000EquatorialPos(core);
737736
=== modified file 'plugins/Satellites/src/Satellites.cpp'
--- plugins/Satellites/src/Satellites.cpp 2015-06-17 18:00:57 +0000
+++ plugins/Satellites/src/Satellites.cpp 2015-08-03 13:17:13 +0000
@@ -1694,7 +1694,7 @@
1694bool Satellites::isValidRangeDates() const1694bool Satellites::isValidRangeDates() const
1695{1695{
1696 bool ok;1696 bool ok;
1697 double tJD = StelApp::getInstance().getCore()->getJDay();1697 double tJD = StelApp::getInstance().getCore()->getJD();
1698 double uJD = StelUtils::getJulianDayFromISO8601String(lastUpdate.toString(Qt::ISODate), &ok);1698 double uJD = StelUtils::getJulianDayFromISO8601String(lastUpdate.toString(Qt::ISODate), &ok);
1699 if (lastUpdate.isNull()) // No updates yet?1699 if (lastUpdate.isNull()) // No updates yet?
1700 uJD = tJD;1700 uJD = tJD;
17011701
=== modified file 'plugins/Satellites/src/gSatWrapper.cpp'
--- plugins/Satellites/src/gSatWrapper.cpp 2015-02-01 20:44:54 +0000
+++ plugins/Satellites/src/gSatWrapper.cpp 2015-08-03 13:17:13 +0000
@@ -122,7 +122,7 @@
122122
123void gSatWrapper::updateEpoch()123void gSatWrapper::updateEpoch()
124{124{
125 double jul_utc = StelApp::getInstance().getCore()->getJDay();125 double jul_utc = StelApp::getInstance().getCore()->getJD();
126 epoch = jul_utc;126 epoch = jul_utc;
127127
128 if (pSatellite)128 if (pSatellite)
129129
=== modified file 'plugins/Satellites/src/gsatellite/gVector.cpp'
--- plugins/Satellites/src/gsatellite/gVector.cpp 2015-02-01 20:44:54 +0000
+++ plugins/Satellites/src/gsatellite/gVector.cpp 2015-08-03 13:17:13 +0000
@@ -34,7 +34,7 @@
3434
35}35}
3636
37gVector::gVector(unsigned int ai_uiElementsNumber)37gVector::gVector(size_t ai_uiElementsNumber)
38 : br_stl::gVectorTempl<double>(ai_uiElementsNumber)38 : br_stl::gVectorTempl<double>(ai_uiElementsNumber)
39{39{
4040
4141
=== modified file 'plugins/Satellites/src/gsatellite/gVector.hpp'
--- plugins/Satellites/src/gsatellite/gVector.hpp 2015-05-30 19:56:47 +0000
+++ plugins/Satellites/src/gsatellite/gVector.hpp 2015-08-03 13:17:13 +0000
@@ -43,9 +43,10 @@
4343
44public:44public:
45 gVector();45 gVector();
46 gVector(unsigned int ai_uiElementsNumber);46 //gVector(unsigned int ai_uiElementsNumber);
47 gVector(size_t ai_uiElementsNumber);
4748
48 virtual ~gVector() {};49 virtual ~gVector() {}
4950
50 //## Other Operations (specified)51 //## Other Operations (specified)
51 //## Operation: operator*52 //## Operation: operator*
5253
=== modified file 'plugins/Scenery3d/src/Scenery3d.cpp'
--- plugins/Scenery3d/src/Scenery3d.cpp 2015-05-18 12:01:39 +0000
+++ plugins/Scenery3d/src/Scenery3d.cpp 2015-08-03 13:17:13 +0000
@@ -391,7 +391,7 @@
391 movement[2]);391 movement[2]);
392392
393 //get current time393 //get current time
394 double curTime = core->getJDay();394 double curTime = core->getJD();
395395
396 if(lazyDrawing)396 if(lazyDrawing)
397 {397 {
@@ -1542,7 +1542,7 @@
15421542
1543 if(needsCubemapUpdate)1543 if(needsCubemapUpdate)
1544 {1544 {
1545 lastCubemapUpdate = core->getJDay();1545 lastCubemapUpdate = core->getJD();
1546 lastCubemapUpdateRealTime = QDateTime::currentMSecsSinceEpoch();1546 lastCubemapUpdateRealTime = QDateTime::currentMSecsSinceEpoch();
1547 }1547 }
1548}1548}
@@ -1893,7 +1893,7 @@
1893 str = QString("Last cubemap update: %1ms ago").arg(QDateTime::currentMSecsSinceEpoch() - lastCubemapUpdateRealTime);1893 str = QString("Last cubemap update: %1ms ago").arg(QDateTime::currentMSecsSinceEpoch() - lastCubemapUpdateRealTime);
1894 painter.drawText(screen_x, screen_y, str);1894 painter.drawText(screen_x, screen_y, str);
1895 screen_y -= 15.0f;1895 screen_y -= 15.0f;
1896 str = QString("Last cubemap update JDAY: %1").arg(qAbs(core->getJDay()-lastCubemapUpdate) * StelCore::ONE_OVER_JD_SECOND);1896 str = QString("Last cubemap update JDAY: %1").arg(qAbs(core->getJD()-lastCubemapUpdate) * StelCore::ONE_OVER_JD_SECOND);
1897 painter.drawText(screen_x, screen_y, str);1897 painter.drawText(screen_x, screen_y, str);
1898 }1898 }
18991899
19001900
=== modified file 'plugins/Supernovae/src/Supernova.cpp'
--- plugins/Supernovae/src/Supernova.cpp 2015-02-08 15:35:27 +0000
+++ plugins/Supernovae/src/Supernova.cpp 2015-08-03 13:17:13 +0000
@@ -160,7 +160,7 @@
160float Supernova::getVMagnitude(const StelCore* core) const160float Supernova::getVMagnitude(const StelCore* core) const
161{161{
162 double vmag = 20;162 double vmag = 20;
163 double currentJD = core->getJDay();163 double currentJD = core->getJDE(); // GZ JDfix for 0.14. I hope the JD in the list is JDE? (Usually difference should be negligible)
164 double deltaJD = qAbs(peakJD-currentJD);164 double deltaJD = qAbs(peakJD-currentJD);
165165
166 // Use supernova light curve model from here - http://www.astronet.ru/db/msg/1188703166 // Use supernova light curve model from here - http://www.astronet.ru/db/msg/1188703
167167
=== modified file 'plugins/TelescopeControl/src/clients/TelescopeClient.cpp'
--- plugins/TelescopeControl/src/clients/TelescopeClient.cpp 2015-02-05 15:44:10 +0000
+++ plugins/TelescopeControl/src/clients/TelescopeClient.cpp 2015-08-03 13:17:13 +0000
@@ -146,7 +146,7 @@
146// At the moment this can't be done in a platform-independent way with Qt146// At the moment this can't be done in a platform-independent way with Qt
147// (QDateTime and QTime don't support microsecond precision)147// (QDateTime and QTime don't support microsecond precision)
148 qint64 t;148 qint64 t;
149 StelCore *core = StelApp::getInstance().getCore();149 //StelCore *core = StelApp::getInstance().getCore();
150#ifdef Q_OS_WIN32150#ifdef Q_OS_WIN32
151 FILETIME file_time;151 FILETIME file_time;
152 GetSystemTimeAsFileTime(&file_time);152 GetSystemTimeAsFileTime(&file_time);
@@ -156,7 +156,9 @@
156 gettimeofday(&tv,0);156 gettimeofday(&tv,0);
157 t = tv.tv_sec * 1000000LL + tv.tv_usec;157 t = tv.tv_sec * 1000000LL + tv.tv_usec;
158#endif158#endif
159 return t - core->getDeltaT(StelUtils::getJDFromSystem())*1000000; // Delta T anti-correction159 // GZ JDfix for 0.14 I am 99.9% sure we no longer need the anti-correction
160 //return t - core->getDeltaT(StelUtils::getJDFromSystem())*1000000; // Delta T anti-correction
161 return t;
160}162}
161163
162TelescopeTCP::TelescopeTCP(const QString &name, const QString &params, Equinox eq)164TelescopeTCP::TelescopeTCP(const QString &name, const QString &params, Equinox eq)
163165
=== modified file 'plugins/TelescopeControl/src/servers/Socket.cpp'
--- plugins/TelescopeControl/src/servers/Socket.cpp 2013-05-15 12:54:31 +0000
+++ plugins/TelescopeControl/src/servers/Socket.cpp 2015-08-03 13:17:13 +0000
@@ -36,7 +36,7 @@
36long long int GetNow(void)36long long int GetNow(void)
37{37{
38 long long int t;38 long long int t;
39 StelCore *core = StelApp::getInstance().getCore();39 //StelCore *core = StelApp::getInstance().getCore();
40#ifdef Q_OS_WIN3240#ifdef Q_OS_WIN32
41 union41 union
42 {42 {
@@ -50,7 +50,9 @@
50 gettimeofday(&tv, 0);50 gettimeofday(&tv, 0);
51 t = tv.tv_sec * 1000000LL + tv.tv_usec;51 t = tv.tv_sec * 1000000LL + tv.tv_usec;
52#endif52#endif
53 return t - core->getDeltaT(StelUtils::getJDFromSystem())*1000000; // Delta T anti-correction53 // GZ JDfix for 0.14 I am 99.9% sure we no longer need the anti-correction
54 //return t - core->getDeltaT(StelUtils::getJDFromSystem())*1000000; // Delta T anti-correction
55 return t;
54}56}
5557
56void Socket::hangup(void)58void Socket::hangup(void)
5759
=== modified file 'plugins/TextUserInterface/src/TextUserInterface.cpp'
--- plugins/TextUserInterface/src/TextUserInterface.cpp 2015-06-14 20:40:29 +0000
+++ plugins/TextUserInterface/src/TextUserInterface.cpp 2015-08-03 13:17:13 +0000
@@ -174,8 +174,8 @@
174 m1->setNextNode(m2);174 m1->setNextNode(m2);
175 TuiNode* m2_1 = new TuiNodeDateTime(N_("Current date/time"),175 TuiNode* m2_1 = new TuiNodeDateTime(N_("Current date/time"),
176 core,176 core,
177 SLOT(setJDay(double)), 177 SLOT(setJD(double)),
178 core->getJDay(),178 core->getJD(),
179 m2);179 m2);
180 TuiNode* m2_2 = new TuiNode(N_("Set time zone"), m2, m2_1);180 TuiNode* m2_2 = new TuiNode(N_("Set time zone"), m2, m2_1);
181 TuiNode* m2_3 = new TuiNode(N_("Day keys"), m2, m2_2);181 TuiNode* m2_3 = new TuiNode(N_("Day keys"), m2, m2_2);
@@ -605,7 +605,7 @@
605605
606 if (tuiDateTime) 606 if (tuiDateTime)
607 {607 {
608 double jd = core->getJDay();608 double jd = core->getJD();
609 int text_x = x + xVc*2/3, text_y = y + pixOffset;609 int text_x = x + xVc*2/3, text_y = y + pixOffset;
610610
611 QString newDate = StelApp::getInstance().getLocaleMgr().getPrintableDateLocal(jd) + " "611 QString newDate = StelApp::getInstance().getLocaleMgr().getPrintableDateLocal(jd) + " "
612612
=== modified file 'src/core/StelCore.cpp'
--- src/core/StelCore.cpp 2015-08-02 17:12:29 +0000
+++ src/core/StelCore.cpp 2015-08-03 13:17:13 +0000
@@ -50,11 +50,11 @@
50const 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);50const 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);
51const Mat4d StelCore::matGalacticToJ2000(matJ2000ToGalactic.transpose());51const Mat4d StelCore::matGalacticToJ2000(matJ2000ToGalactic.transpose());
5252
53const double StelCore::JD_SECOND=0.000011574074074074074074;53const double StelCore::JD_SECOND=0.000011574074074074074074; // 1/(24*60*60)=1/86400
54const double StelCore::JD_MINUTE=0.00069444444444444444444;54const double StelCore::JD_MINUTE=0.00069444444444444444444; // 1/(24*60) =1/1440
55const double StelCore::JD_HOUR =0.041666666666666666666;55const double StelCore::JD_HOUR =0.041666666666666666666; // 1/24
56const double StelCore::JD_DAY =1.;56const double StelCore::JD_DAY =1.;
57const double StelCore::ONE_OVER_JD_SECOND = 24 * 60 * 60;57const double StelCore::ONE_OVER_JD_SECOND = 24 * 60 * 60; // 86400
5858
5959
60StelCore::StelCore()60StelCore::StelCore()
@@ -65,10 +65,10 @@
65 , currentDeltaTAlgorithm(EspenakMeeus)65 , currentDeltaTAlgorithm(EspenakMeeus)
66 , position(NULL)66 , position(NULL)
67 , timeSpeed(JD_SECOND)67 , timeSpeed(JD_SECOND)
68 , JDay(0.)68 , JD(0.,0.)
69 , presetSkyTime(0.)69 , presetSkyTime(0.)
70 , secondsOfLastJDayUpdate(0.)70 , secondsOfLastJDUpdate(0.)
71 , JDayOfLastJDayUpdate(0.)71 , jdOfLastJDUpdate(0.)
72 , deltaTCustomNDot(-26.0)72 , deltaTCustomNDot(-26.0)
73 , deltaTCustomYear(1820.0)73 , deltaTCustomYear(1820.0)
74{74{
@@ -173,7 +173,7 @@
173 setInitTodayTime(QTime::fromString(conf->value("navigation/today_time", "22:00").toString()));173 setInitTodayTime(QTime::fromString(conf->value("navigation/today_time", "22:00").toString()));
174 startupTimeMode = conf->value("navigation/startup_time_mode", "actual").toString().toLower();174 startupTimeMode = conf->value("navigation/startup_time_mode", "actual").toString().toLower();
175 if (startupTimeMode=="preset") 175 if (startupTimeMode=="preset")
176 setJDay(presetSkyTime - StelUtils::getGMTShiftFromQT(presetSkyTime) * JD_HOUR);176 setJD(presetSkyTime - StelUtils::getGMTShiftFromQT(presetSkyTime) * JD_HOUR);
177 else if (startupTimeMode=="today")177 else if (startupTimeMode=="today")
178 setTodayTime(getInitTodayTime());178 setTodayTime(getInitTodayTime());
179179
@@ -766,7 +766,7 @@
766// called in update() (for every frame)766// called in update() (for every frame)
767void StelCore::updateTransformMatrices()767void StelCore::updateTransformMatrices()
768{768{
769 matAltAzToEquinoxEqu = position->getRotAltAzToEquatorial(JDay);769 matAltAzToEquinoxEqu = position->getRotAltAzToEquatorial(getJD(), getJDE());
770 matEquinoxEquToAltAz = matAltAzToEquinoxEqu.transpose();770 matEquinoxEquToAltAz = matAltAzToEquinoxEqu.transpose();
771771
772 // multiply static J2000 earth axis tilt (eclipticalJ2000<->equatorialJ2000)772 // multiply static J2000 earth axis tilt (eclipticalJ2000<->equatorialJ2000)
@@ -865,26 +865,40 @@
865 smmgr->zoomTo(smmgr->getInitFov(), 1.);865 smmgr->zoomTo(smmgr->getInitFov(), 1.);
866}866}
867867
868void StelCore::setJDay(double JD)868void StelCore::setJD(double newJD)
869{869{
870 JDay=JD;870 JD.first=newJD;
871 resetSync();871 JD.second=computeDeltaT(newJD);
872}872 resetSync();
873873}
874double StelCore::getJDay() const874
875{875double StelCore::getJD() const
876 return JDay;876{
877}877 return JD.first;
878}
879
880void StelCore::setJDE(double newJDE)
881{
882 // nitpickerish this is not exact, but as good as it gets...
883 JD.second=computeDeltaT(newJDE);
884 JD.first=newJDE-JD.second/86400.0;
885 resetSync();
886}
887
888double StelCore::getJDE() const
889{
890 return JD.first+JD.second/86400.0;
891}
892
878893
879void StelCore::setMJDay(double MJD)894void StelCore::setMJDay(double MJD)
880{895{
881 JDay=MJD+2400000.5;896 setJD(MJD+2400000.5);
882 resetSync();
883}897}
884898
885double StelCore::getMJDay() const899double StelCore::getMJDay() const
886{900{
887 return JDay-2400000.5;901 return JD.first-2400000.5;
888}902}
889903
890double StelCore::getPresetSkyTime() const904double StelCore::getPresetSkyTime() const
@@ -993,9 +1007,7 @@
993//! Set stellarium time to current real world time1007//! Set stellarium time to current real world time
994void StelCore::setTimeNow()1008void StelCore::setTimeNow()
995{1009{
996 double JD = StelUtils::getJDFromSystem();1010 setJD(StelUtils::getJDFromSystem());
997 // add Delta-T correction for actual time
998 setJDay(JD+getDeltaT(JD)/86400);
999}1011}
10001012
1001void StelCore::setTodayTime(const QTime& target)1013void StelCore::setTodayTime(const QTime& target)
@@ -1006,7 +1018,7 @@
1006 dt.setTime(target);1018 dt.setTime(target);
1007 // don't forget to adjust for timezone / daylight savings.1019 // don't forget to adjust for timezone / daylight savings.
1008 double JD = StelUtils::qDateTimeToJd(dt)-(StelUtils::getGMTShiftFromQT(StelUtils::getJDFromSystem()) * JD_HOUR);1020 double JD = StelUtils::qDateTimeToJd(dt)-(StelUtils::getGMTShiftFromQT(StelUtils::getJDFromSystem()) * JD_HOUR);
1009 setJDay(JD + getDeltaT(JD)/86400);1021 setJD(JD);
1010 }1022 }
1011 else1023 else
1012 {1024 {
@@ -1019,12 +1031,12 @@
1019bool StelCore::getIsTimeNow(void) const1031bool StelCore::getIsTimeNow(void) const
1020{1032{
1021 // cache last time to prevent to much slow system call1033 // cache last time to prevent to much slow system call
1022 static double lastJD = getJDay();1034 static double lastJD = getJD();
1023 static bool previousResult = (fabs(getJDay()-(StelUtils::getJDFromSystem()+getDeltaT(lastJD)/86400))<JD_SECOND);1035 static bool previousResult = (fabs(getJD()-(StelUtils::getJDFromSystem()))<JD_SECOND);
1024 if (fabs(lastJD-getJDay())>JD_SECOND/4)1036 if (fabs(lastJD-getJD())>JD_SECOND/4)
1025 {1037 {
1026 lastJD = getJDay();1038 lastJD = getJD();
1027 previousResult = (fabs(getJDay()-(StelUtils::getJDFromSystem()+getDeltaT(lastJD)/86400))<JD_SECOND);1039 previousResult = (fabs(getJD()-(StelUtils::getJDFromSystem()))<JD_SECOND);
1028 }1040 }
1029 return previousResult;1041 return previousResult;
1030}1042}
@@ -1034,14 +1046,14 @@
1034 return initTodayTime;1046 return initTodayTime;
1035}1047}
10361048
1037void StelCore::setInitTodayTime(const QTime& t)1049void StelCore::setInitTodayTime(const QTime& time)
1038{1050{
1039 initTodayTime=t;1051 initTodayTime=time;
1040}1052}
10411053
1042void StelCore::setPresetSkyTime(QDateTime dt)1054void StelCore::setPresetSkyTime(QDateTime dateTime)
1043{1055{
1044 setPresetSkyTime(StelUtils::qDateTimeToJd(dt));1056 setPresetSkyTime(StelUtils::qDateTimeToJd(dateTime));
1045}1057}
10461058
1047void StelCore::addHour()1059void StelCore::addHour()
@@ -1250,7 +1262,7 @@
1250 if (home->getEnglishName() != "Solar System Observer") 1262 if (home->getEnglishName() != "Solar System Observer")
1251 d *= home->getMeanSolarDay();1263 d *= home->getMeanSolarDay();
12521264
1253 setJDay(getJDay() + d);1265 setJD(getJD() + d);
1254}1266}
12551267
1256void StelCore::addSiderealDays(double d)1268void StelCore::addSiderealDays(double d)
@@ -1258,13 +1270,14 @@
1258 const PlanetP& home = position->getHomePlanet();1270 const PlanetP& home = position->getHomePlanet();
1259 if (home->getEnglishName() != "Solar System Observer")1271 if (home->getEnglishName() != "Solar System Observer")
1260 d *= home->getSiderealDay();1272 d *= home->getSiderealDay();
1261 setJDay(getJDay() + d);1273 setJD(getJD() + d);
1262}1274}
12631275
1264// Get the sidereal time shifted by the observer longitude1276// Get the sidereal time shifted by the observer longitude
1265double StelCore::getLocalSiderealTime() const1277double StelCore::getLocalSiderealTime() const
1266{1278{
1267 return (position->getHomePlanet()->getSiderealTime(JDay)+position->getCurrentLocation().longitude)*M_PI/180.;1279 // On Earth, this requires UT deliberately with all its faults, on other planets we use the more regular TT.
1280 return (position->getHomePlanet()->getSiderealTime(getJD(), getJDE())+position->getCurrentLocation().longitude)*M_PI/180.;
1268}1281}
12691282
1270//! Get the duration of a sidereal day for the current observer in day.1283//! Get the duration of a sidereal day for the current observer in day.
@@ -1353,16 +1366,19 @@
1353 if (getRealTimeSpeed())1366 if (getRealTimeSpeed())
1354 {1367 {
1355 // Get rid of the error from the 1 /1368 // Get rid of the error from the 1 /
1356 JDay = JDayOfLastJDayUpdate + (StelApp::getTotalRunTime() - secondsOfLastJDayUpdate) / ONE_OVER_JD_SECOND;1369 // JDay = JDayOfLastJDayUpdate + (StelApp::getTotalRunTime() - secondsOfLastJDayUpdate) / ONE_OVER_JD_SECOND;
1370 // GZ I don't understand the comment. Is the constant wrong?
1371 JD.first = jdOfLastJDUpdate + (StelApp::getTotalRunTime() - secondsOfLastJDUpdate) * JD_SECOND;
1357 }1372 }
1358 else1373 else
1359 {1374 {
1360 JDay = JDayOfLastJDayUpdate + (StelApp::getTotalRunTime() - secondsOfLastJDayUpdate) * timeSpeed;1375 JD.first = jdOfLastJDUpdate + (StelApp::getTotalRunTime() - secondsOfLastJDUpdate) * timeSpeed;
1361 }1376 }
13621377
1363 // Fix time limits to -100000 to +100000 to prevent bugs1378 // Fix time limits to -100000 to +100000 to prevent bugs
1364 if (JDay>38245309.499988) JDay = 38245309.499988;1379 if (JD.first>38245309.499988) JD.first = 38245309.499988;
1365 if (JDay<-34803211.500012) JDay = -34803211.500012;1380 if (JD.first<-34803211.500012) JD.first = -34803211.500012;
1381 JD.second=computeDeltaT(JD.first);
13661382
1367 if (position->isObserverLifeOver())1383 if (position->isObserverLifeOver())
1368 {1384 {
@@ -1380,14 +1396,16 @@
1380 position->update(deltaTime);1396 position->update(deltaTime);
13811397
1382 // Position of sun and all the satellites (ie planets)1398 // Position of sun and all the satellites (ie planets)
1383 SolarSystem* solsystem = (SolarSystem*)StelApp::getInstance().getModuleMgr().getModule("SolarSystem");1399 // GZ maybe setting this static can speedup a bit?
1384 solsystem->computePositions(getJDay(), position->getHomePlanet()->getHeliocentricEclipticPos());1400 static SolarSystem* solsystem = (SolarSystem*)StelApp::getInstance().getModuleMgr().getModule("SolarSystem");
1401 // Likely the most important location where we need JDE:
1402 solsystem->computePositions(getJDE(), position->getHomePlanet()->getHeliocentricEclipticPos());
1385}1403}
13861404
1387void StelCore::resetSync()1405void StelCore::resetSync()
1388{1406{
1389 JDayOfLastJDayUpdate = getJDay();1407 jdOfLastJDUpdate = getJD();
1390 secondsOfLastJDayUpdate = StelApp::getTotalRunTime();1408 secondsOfLastJDUpdate = StelApp::getTotalRunTime();
1391}1409}
13921410
1393void StelCore::setStartupTimeMode(const QString& s)1411void StelCore::setStartupTimeMode(const QString& s)
@@ -1395,7 +1413,15 @@
1395 startupTimeMode = s;1413 startupTimeMode = s;
1396}1414}
13971415
1398double StelCore::getDeltaT(double jDay) const1416// return precomputed DeltaT in seconds. Public.
1417double StelCore::getDeltaT() const
1418{
1419 return JD.second;
1420}
1421
1422
1423// compute and return DeltaT in seconds. Try not to call it directly, current DeltaT, JD, and JDE are available.
1424double StelCore::computeDeltaT(const double JD) const
1399{1425{
1400 double DeltaT = 0.;1426 double DeltaT = 0.;
1401 double ndot = 0.;1427 double ndot = 0.;
@@ -1410,149 +1436,156 @@
1410 case Schoch:1436 case Schoch:
1411 // Schoch (1931) algorithm for DeltaT1437 // Schoch (1931) algorithm for DeltaT
1412 ndot = -29.68; // n.dot = -29.68"/cy/cy1438 ndot = -29.68; // n.dot = -29.68"/cy/cy
1413 DeltaT = StelUtils::getDeltaTBySchoch(jDay);1439 DeltaT = StelUtils::getDeltaTBySchoch(JD);
1414 break;1440 break;
1415 case Clemence:1441 case Clemence:
1416 // Clemence (1948) algorithm for DeltaT1442 // Clemence (1948) algorithm for DeltaT
1417 ndot = -22.44; // n.dot = -22.44 "/cy/cy1443 ndot = -22.44; // n.dot = -22.44 "/cy/cy
1418 DeltaT = StelUtils::getDeltaTByClemence(jDay);1444 DeltaT = StelUtils::getDeltaTByClemence(JD);
1419 break;1445 break;
1420 case IAU:1446 case IAU:
1421 // IAU (1952) algorithm for DeltaT, based on observations by Spencer Jones (1939)1447 // IAU (1952) algorithm for DeltaT, based on observations by Spencer Jones (1939)
1422 ndot = -22.44; // n.dot = -22.44 "/cy/cy1448 ndot = -22.44; // n.dot = -22.44 "/cy/cy
1423 DeltaT = StelUtils::getDeltaTByIAU(jDay);1449 DeltaT = StelUtils::getDeltaTByIAU(JD);
1424 break;1450 break;
1425 case AstronomicalEphemeris:1451 case AstronomicalEphemeris:
1426 // Astronomical Ephemeris (1960) algorithm for DeltaT1452 // Astronomical Ephemeris (1960) algorithm for DeltaT
1427 ndot = -22.44; // n.dot = -22.44 "/cy/cy1453 ndot = -22.44; // n.dot = -22.44 "/cy/cy
1428 DeltaT = StelUtils::getDeltaTByAstronomicalEphemeris(jDay);1454 DeltaT = StelUtils::getDeltaTByAstronomicalEphemeris(JD);
1429 break;1455 break;
1430 case TuckermanGoldstine:1456 case TuckermanGoldstine:
1431 // Tuckerman (1962, 1964) & Goldstine (1973) algorithm for DeltaT1457 // Tuckerman (1962, 1964) & Goldstine (1973) algorithm for DeltaT
1432 //FIXME: n.dot1458 //FIXME: n.dot
1433 ndot = -22.44; // n.dot = -22.44 "/cy/cy ???1459 ndot = -22.44; // n.dot = -22.44 "/cy/cy ???
1434 DeltaT = StelUtils::getDeltaTByTuckermanGoldstine(jDay);1460 DeltaT = StelUtils::getDeltaTByTuckermanGoldstine(JD);
1435 break;1461 break;
1436 case MullerStephenson:1462 case MullerStephenson:
1437 // Muller & Stephenson (1975) algorithm for DeltaT1463 // Muller & Stephenson (1975) algorithm for DeltaT
1438 ndot = -37.5; // n.dot = -37.5 "/cy/cy1464 ndot = -37.5; // n.dot = -37.5 "/cy/cy
1439 DeltaT = StelUtils::getDeltaTByMullerStephenson(jDay);1465 DeltaT = StelUtils::getDeltaTByMullerStephenson(JD);
1440 break;1466 break;
1441 case Stephenson1978:1467 case Stephenson1978:
1442 // Stephenson (1978) algorithm for DeltaT1468 // Stephenson (1978) algorithm for DeltaT
1443 ndot = -30.0; // n.dot = -30.0 "/cy/cy1469 ndot = -30.0; // n.dot = -30.0 "/cy/cy
1444 DeltaT = StelUtils::getDeltaTByStephenson1978(jDay);1470 DeltaT = StelUtils::getDeltaTByStephenson1978(JD);
1445 break;1471 break;
1446 case SchmadelZech1979:1472 case SchmadelZech1979:
1447 // Schmadel & Zech (1979) algorithm for DeltaT1473 // Schmadel & Zech (1979) algorithm for DeltaT
1448 ndot = -23.8946; // n.dot = -23.8946 "/cy/cy1474 ndot = -23.8946; // n.dot = -23.8946 "/cy/cy
1449 DeltaT = StelUtils::getDeltaTBySchmadelZech1979(jDay);1475 DeltaT = StelUtils::getDeltaTBySchmadelZech1979(JD);
1450 break;1476 break;
1451 case MorrisonStephenson1982:1477 case MorrisonStephenson1982:
1452 // Morrison & Stephenson (1982) algorithm for DeltaT (used by RedShift)1478 // Morrison & Stephenson (1982) algorithm for DeltaT (used by RedShift)
1453 ndot = -26.0; // n.dot = -26.0 "/cy/cy1479 ndot = -26.0; // n.dot = -26.0 "/cy/cy
1454 DeltaT = StelUtils::getDeltaTByMorrisonStephenson1982(jDay);1480 DeltaT = StelUtils::getDeltaTByMorrisonStephenson1982(JD);
1455 break;1481 break;
1456 case StephensonMorrison1984:1482 case StephensonMorrison1984:
1457 // Stephenson & Morrison (1984) algorithm for DeltaT1483 // Stephenson & Morrison (1984) algorithm for DeltaT
1458 ndot = -26.0; // n.dot = -26.0 "/cy/cy1484 ndot = -26.0; // n.dot = -26.0 "/cy/cy
1459 DeltaT = StelUtils::getDeltaTByStephensonMorrison1984(jDay);1485 DeltaT = StelUtils::getDeltaTByStephensonMorrison1984(JD);
1460 break;1486 break;
1461 case StephensonHoulden:1487 case StephensonHoulden:
1462 // Stephenson & Houlden (1986) algorithm for DeltaT1488 // Stephenson & Houlden (1986) algorithm for DeltaT
1463 ndot = -26.0; // n.dot = -26.0 "/cy/cy1489 ndot = -26.0; // n.dot = -26.0 "/cy/cy
1464 DeltaT = StelUtils::getDeltaTByStephensonHoulden(jDay);1490 DeltaT = StelUtils::getDeltaTByStephensonHoulden(JD);
1465 break;1491 break;
1466 case Espenak:1492 case Espenak:
1467 // Espenak (1987, 1989) algorithm for DeltaT1493 // Espenak (1987, 1989) algorithm for DeltaT
1468 //FIXME: n.dot1494 //FIXME: n.dot
1469 ndot = -23.8946; // n.dot = -23.8946 "/cy/cy ???1495 ndot = -23.8946; // n.dot = -23.8946 "/cy/cy ???
1470 DeltaT = StelUtils::getDeltaTByEspenak(jDay);1496 DeltaT = StelUtils::getDeltaTByEspenak(JD);
1471 break;1497 break;
1472 case Borkowski:1498 case Borkowski:
1473 // Borkowski (1988) algorithm for DeltaT, relates to ELP2000-85!1499 // Borkowski (1988) algorithm for DeltaT, relates to ELP2000-85!
1474 ndot = -23.895; // GZ: I see -23.895 in the paper, not -23.859; (?) // n.dot = -23.859 "/cy/cy1500 ndot = -23.895; // GZ: I see -23.895 in the paper, not -23.859; (?) // n.dot = -23.859 "/cy/cy
1475 DeltaT = StelUtils::getDeltaTByBorkowski(jDay);1501 DeltaT = StelUtils::getDeltaTByBorkowski(JD);
1476 break;1502 break;
1477 case SchmadelZech1988:1503 case SchmadelZech1988:
1478 // Schmadel & Zech (1988) algorithm for DeltaT1504 // Schmadel & Zech (1988) algorithm for DeltaT
1479 //FIXME: n.dot1505 //FIXME: n.dot
1480 ndot = -26.0; // n.dot = -26.0 "/cy/cy ???1506 ndot = -26.0; // n.dot = -26.0 "/cy/cy ???
1481 DeltaT = StelUtils::getDeltaTBySchmadelZech1988(jDay);1507 DeltaT = StelUtils::getDeltaTBySchmadelZech1988(JD);
1482 break;1508 break;
1483 case ChaprontTouze:1509 case ChaprontTouze:
1484 // Chapront-Touzé & Chapront (1991) algorithm for DeltaT1510 // Chapront-Touzé & Chapront (1991) algorithm for DeltaT
1485 ndot = -23.8946; // n.dot = -23.8946 "/cy/cy1511 ndot = -23.8946; // n.dot = -23.8946 "/cy/cy
1486 DeltaT = StelUtils::getDeltaTByChaprontTouze(jDay);1512 DeltaT = StelUtils::getDeltaTByChaprontTouze(JD);
1487 break;1513 break;
1488 case StephensonMorrison1995:1514 case StephensonMorrison1995:
1489 // Stephenson & Morrison (1995) algorithm for DeltaT1515 // Stephenson & Morrison (1995) algorithm for DeltaT
1490 ndot = -26.0; // n.dot = -26.0 "/cy/cy1516 ndot = -26.0; // n.dot = -26.0 "/cy/cy
1491 DeltaT = StelUtils::getDeltaTByStephensonMorrison1995(jDay);1517 DeltaT = StelUtils::getDeltaTByStephensonMorrison1995(JD);
1492 break;1518 break;
1493 case Stephenson1997:1519 case Stephenson1997:
1494 // Stephenson (1997) algorithm for DeltaT1520 // Stephenson (1997) algorithm for DeltaT
1495 ndot = -26.0; // n.dot = -26.0 "/cy/cy1521 ndot = -26.0; // n.dot = -26.0 "/cy/cy
1496 DeltaT = StelUtils::getDeltaTByStephenson1997(jDay);1522 DeltaT = StelUtils::getDeltaTByStephenson1997(JD);
1497 break;1523 break;
1498 case ChaprontMeeus:1524 case ChaprontMeeus:
1499 // Chapront, Chapront-Touze & Francou (1997) & Meeus (1998) algorithm for DeltaT1525 // Chapront, Chapront-Touze & Francou (1997) & Meeus (1998) algorithm for DeltaT
1500 ndot = -25.7376; // n.dot = -25.7376 "/cy/cy1526 ndot = -25.7376; // n.dot = -25.7376 "/cy/cy
1501 DeltaT = StelUtils::getDeltaTByChaprontMeeus(jDay);1527 DeltaT = StelUtils::getDeltaTByChaprontMeeus(JD);
1502 break;1528 break;
1503 case JPLHorizons:1529 case JPLHorizons:
1504 // JPL Horizons algorithm for DeltaT1530 // JPL Horizons algorithm for DeltaT
1505 ndot = -25.7376; // n.dot = -25.7376 "/cy/cy1531 ndot = -25.7376; // n.dot = -25.7376 "/cy/cy
1506 DeltaT = StelUtils::getDeltaTByJPLHorizons(jDay);1532 DeltaT = StelUtils::getDeltaTByJPLHorizons(JD);
1507 break;1533 break;
1508 case MeeusSimons:1534 case MeeusSimons:
1509 // Meeus & Simons (2000) algorithm for DeltaT1535 // Meeus & Simons (2000) algorithm for DeltaT
1510 ndot = -25.7376; // n.dot = -25.7376 "/cy/cy1536 ndot = -25.7376; // n.dot = -25.7376 "/cy/cy
1511 DeltaT = StelUtils::getDeltaTByMeeusSimons(jDay);1537 DeltaT = StelUtils::getDeltaTByMeeusSimons(JD);
1512 break;1538 break;
1513 case ReingoldDershowitz:1539 case ReingoldDershowitz:
1514 // Reingold & Dershowitz (2002, 2007) algorithm for DeltaT1540 // Reingold & Dershowitz (2002, 2007) algorithm for DeltaT
1515 // FIXME: n.dot1541 // FIXME: n.dot
1516 ndot = -26.0; // n.dot = -26.0 "/cy/cy ???1542 ndot = -26.0; // n.dot = -26.0 "/cy/cy ???
1517 DeltaT = StelUtils::getDeltaTByReingoldDershowitz(jDay);1543 DeltaT = StelUtils::getDeltaTByReingoldDershowitz(JD);
1518 break;1544 break;
1519 case MontenbruckPfleger:1545 case MontenbruckPfleger:
1520 // Montenbruck & Pfleger (2000) algorithm for DeltaT1546 // Montenbruck & Pfleger (2000) algorithm for DeltaT
1521 // NOTE: book not contains n.dot value1547 // NOTE: book not contains n.dot value
1522 // FIXME: n.dot1548 // FIXME: n.dot
1523 ndot = -26.0; // n.dot = -26.0 "/cy/cy ???1549 ndot = -26.0; // n.dot = -26.0 "/cy/cy ???
1524 DeltaT = StelUtils::getDeltaTByMontenbruckPfleger(jDay);1550 DeltaT = StelUtils::getDeltaTByMontenbruckPfleger(JD);
1525 break;1551 break;
1526 case MorrisonStephenson2004:1552 case MorrisonStephenson2004:
1527 // Morrison & Stephenson (2004, 2005) algorithm for DeltaT1553 // Morrison & Stephenson (2004, 2005) algorithm for DeltaT
1528 ndot = -26.0; // n.dot = -26.0 "/cy/cy1554 ndot = -26.0; // n.dot = -26.0 "/cy/cy
1529 DeltaT = StelUtils::getDeltaTByMorrisonStephenson2004(jDay);1555 DeltaT = StelUtils::getDeltaTByMorrisonStephenson2004(JD);
1530 break;1556 break;
1531 case Reijs:1557 case Reijs:
1532 // Reijs (2006) algorithm for DeltaT1558 // Reijs (2006) algorithm for DeltaT
1533 ndot = -26.0; // n.dot = -26.0 "/cy/cy1559 ndot = -26.0; // n.dot = -26.0 "/cy/cy
1534 DeltaT = StelUtils::getDeltaTByReijs(jDay);1560 DeltaT = StelUtils::getDeltaTByReijs(JD);
1535 break;1561 break;
1536 case EspenakMeeus:1562 case EspenakMeeus:
1537 // Espenak & Meeus (2006) algorithm for DeltaT1563 // Espenak & Meeus (2006) algorithm for DeltaT
1538 ndot = -25.858; // n.dot = -25.858 "/cy/cy1564 ndot = -25.858; // n.dot = -25.858 "/cy/cy
1539 DeltaT = StelUtils::getDeltaTByEspenakMeeus(jDay);1565 DeltaT = StelUtils::getDeltaTByEspenakMeeus(JD);
1566 break;
1567 case EspenakMeeusZeroMoonAccel:
1568 // This is a trying area. Something is wrong with DeltaT, maybe ndot is still not applied correctly.
1569 // Espenak & Meeus (2006) algorithm for DeltaT
1570 ndot = -25.858; // n.dot = -25.858 "/cy/cy
1571 dontUseMoon = true;
1572 DeltaT = StelUtils::getDeltaTByEspenakMeeus(JD);
1540 break;1573 break;
1541 case Banjevic:1574 case Banjevic:
1542 // Banjevic (2006) algorithm for DeltaT1575 // Banjevic (2006) algorithm for DeltaT
1543 ndot = -26.0; // n.dot = -26.0 "/cy/cy1576 ndot = -26.0; // n.dot = -26.0 "/cy/cy
1544 DeltaT = StelUtils::getDeltaTByBanjevic(jDay);1577 DeltaT = StelUtils::getDeltaTByBanjevic(JD);
1545 break;1578 break;
1546 case IslamSadiqQureshi:1579 case IslamSadiqQureshi:
1547 // Islam, Sadiq & Qureshi (2008 + revisited 2013) algorithm for DeltaT (6 polynomials)1580 // Islam, Sadiq & Qureshi (2008 + revisited 2013) algorithm for DeltaT (6 polynomials)
1548 ndot = -26.0; // n.dot = -26.0 "/cy/cy1581 ndot = -26.0; // n.dot = -26.0 "/cy/cy
1549 DeltaT = StelUtils::getDeltaTByIslamSadiqQureshi(jDay);1582 DeltaT = StelUtils::getDeltaTByIslamSadiqQureshi(JD);
1550 dontUseMoon = true; // Seems this solutions doesn't use value of secular acceleration of the Moon1583 dontUseMoon = true; // Seems this solutions doesn't use value of secular acceleration of the Moon
1551 break;1584 break;
1552 case KhalidSultanaZaidi:1585 case KhalidSultanaZaidi:
1553 // M. Khalid, Mariam Sultana and Faheem Zaidi polinomial approximation of time period 1620-2013 (2014)1586 // M. Khalid, Mariam Sultana and Faheem Zaidi polinomial approximation of time period 1620-2013 (2014)
1554 ndot = -26.0; // n.dot = -26.0 "/cy/cy1587 ndot = -26.0; // n.dot = -26.0 "/cy/cy
1555 DeltaT = StelUtils::getDeltaTByKhalidSultanaZaidi(jDay);1588 DeltaT = StelUtils::getDeltaTByKhalidSultanaZaidi(JD);
1556 dontUseMoon = true; // Seems this solutions doesn't use value of secular acceleration of the Moon1589 dontUseMoon = true; // Seems this solutions doesn't use value of secular acceleration of the Moon
1557 break;1590 break;
1558 case Custom:1591 case Custom:
@@ -1560,14 +1593,14 @@
1560 ndot = getDeltaTCustomNDot(); // n.dot = custom value "/cy/cy1593 ndot = getDeltaTCustomNDot(); // n.dot = custom value "/cy/cy
1561 int year, month, day;1594 int year, month, day;
1562 Vec3f coeff = getDeltaTCustomEquationCoefficients();1595 Vec3f coeff = getDeltaTCustomEquationCoefficients();
1563 StelUtils::getDateFromJulianDay(jDay, &year, &month, &day); 1596 StelUtils::getDateFromJulianDay(JD, &year, &month, &day);
1564 double u = (StelUtils::getDecYear(year,month,day)-getDeltaTCustomYear())/100;1597 double u = (StelUtils::getDecYear(year,month,day)-getDeltaTCustomYear())/100;
1565 DeltaT = coeff[0] + u*(coeff[1] + u*coeff[2]);1598 DeltaT = coeff[0] + u*(coeff[1] + u*coeff[2]);
1566 break;1599 break;
1567 }1600 }
15681601
1569 if (!dontUseMoon)1602 if (!dontUseMoon)
1570 DeltaT += StelUtils::getMoonSecularAcceleration(jDay, ndot);1603 DeltaT += StelUtils::getMoonSecularAcceleration(JD, ndot);
15711604
1572 return DeltaT;1605 return DeltaT;
1573}1606}
@@ -1604,91 +1637,94 @@
1604 description = q_("Correction is disabled. Use only if you know what you are doing!");1637 description = q_("Correction is disabled. Use only if you know what you are doing!");
1605 break;1638 break;
1606 case Schoch: // historical value.1639 case Schoch: // historical value.
1607 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));1640 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));
1608 break;1641 break;
1609 case Clemence: // historical value.1642 case Clemence: // historical value.
1610 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));1643 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));
1611 break;1644 break;
1612 case IAU: // historical value.1645 case IAU: // historical value.
1613 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));1646 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));
1614 // find year of publication of AFFC1647 // find year of publication of AFFC
1615 break;1648 break;
1616 case AstronomicalEphemeris: // historical value.1649 case AstronomicalEphemeris: // historical value.
1617 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));1650 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));
1618 // TODO: expand the sentence: ... adopted ... from 19xx-19yy?1651 // TODO: expand the sentence: ... adopted ... from 19xx-19yy?
1619 break;1652 break;
1620 case TuckermanGoldstine: // historical value.1653 case TuckermanGoldstine: // historical value.
1621 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));1654 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));
1622 // TODO: These tables are sometimes found cited, but I have no details. Maybe add "based on ... " ?1655 // TODO: These tables are sometimes found cited, but I have no details. Maybe add "based on ... " ?
1623 break;1656 break;
1624 case MullerStephenson:1657 case MullerStephenson:
1625 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));1658 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));
1626 break;1659 break;
1627 case Stephenson1978:1660 case Stephenson1978:
1628 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));1661 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));
1629 break;1662 break;
1630 case SchmadelZech1979: // outdated data fit, historical value?1663 case SchmadelZech1979: // outdated data fit, historical value?
1631 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));1664 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));
1632 break;1665 break;
1633 case MorrisonStephenson1982:1666 case MorrisonStephenson1982:
1634 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));1667 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));
1635 break;1668 break;
1636 case StephensonMorrison1984: // PRIMARY SOURCE1669 case StephensonMorrison1984: // PRIMARY SOURCE
1637 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));1670 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));
1638 break;1671 break;
1639 case StephensonHoulden:1672 case StephensonHoulden:
1640 description = q_("This algorithm is used in the PC planetarium program Guide 7.").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));1673 description = q_("This algorithm is used in the PC planetarium program Guide 7.").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
1641 break;1674 break;
1642 case Espenak: // limited range, but wide availability?1675 case Espenak: // limited range, but wide availability?
1643 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));1676 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));
1644 break;1677 break;
1645 case Borkowski: // Linked to ELP2000-85, so it's important...1678 case Borkowski: // Linked to ELP2000-85, so it's important...
1646 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));1679 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));
1647 break;1680 break;
1648 case SchmadelZech1988: // data fit through Stephenson&Morrison1984, which itself is important. Unclear who uses this version?1681 case SchmadelZech1988: // data fit through Stephenson&Morrison1984, which itself is important. Unclear who uses this version?
1649 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));1682 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));
1650 break;1683 break;
1651 case ChaprontTouze:1684 case ChaprontTouze:
1652 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));1685 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));
1653 break;1686 break;
1654 case StephensonMorrison1995:1687 case StephensonMorrison1995:
1655 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));1688 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));
1656 break;1689 break;
1657 case Stephenson1997:1690 case Stephenson1997:
1658 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));1691 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));
1659 break;1692 break;
1660 case ChaprontMeeus:1693 case ChaprontMeeus:
1661 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));1694 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));
1662 break;1695 break;
1663 case JPLHorizons:1696 case JPLHorizons:
1664 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));1697 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));
1665 break;1698 break;
1666 case MeeusSimons:1699 case MeeusSimons:
1667 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));1700 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));
1668 break;1701 break;
1669 case MontenbruckPfleger: // uninspired1702 case MontenbruckPfleger: // uninspired
1670 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));1703 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));
1671 break;1704 break;
1672 case ReingoldDershowitz: //1705 case ReingoldDershowitz: //
1673 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));1706 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));
1674 break;1707 break;
1675 case MorrisonStephenson2004: // PRIMARY SOURCE1708 case MorrisonStephenson2004: // PRIMARY SOURCE
1676 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));1709 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));
1677 break;1710 break;
1678 case Reijs:1711 case Reijs:
1679 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));1712 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));
1680 break;1713 break;
1681 case EspenakMeeus: // GENERAL SOLUTION1714 case EspenakMeeus: // GENERAL SOLUTION
1682 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>");1715 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>");
1716 break;
1717 case EspenakMeeusZeroMoonAccel: // PATCHED SOLUTION
1718 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>");
1683 break;1719 break;
1684 case Banjevic:1720 case Banjevic:
1685 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));1721 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));
1686 break;1722 break;
1687 case IslamSadiqQureshi:1723 case IslamSadiqQureshi:
1688 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));1724 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));
1689 break;1725 break;
1690 case KhalidSultanaZaidi:1726 case KhalidSultanaZaidi:
1691 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));1727 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));
1692 break;1728 break;
1693 case Custom:1729 case Custom:
1694 description = q_("This is a quadratic formula for calculation of %1T with coefficients defined by the user.").arg(QChar(0x0394));1730 description = q_("This is a quadratic formula for calculation of %1T with coefficients defined by the user.").arg(QChar(0x0394));
@@ -1699,7 +1735,7 @@
1699 return description;1735 return description;
1700}1736}
17011737
1702QString StelCore::getCurrentDeltaTAlgorithmValidRange(double jDay, QString *marker) const1738QString StelCore::getCurrentDeltaTAlgorithmValidRangeDescription(const double JD, QString *marker) const
1703{1739{
1704 QString validRange = "";1740 QString validRange = "";
1705 QString validRangeAppendix = "";1741 QString validRangeAppendix = "";
@@ -1707,7 +1743,7 @@
1707 int year, month, day;1743 int year, month, day;
1708 int start = 0;1744 int start = 0;
1709 int finish = 0;1745 int finish = 0;
1710 StelUtils::getDateFromJulianDay(jDay, &year, &month, &day);1746 StelUtils::getDateFromJulianDay(JD, &year, &month, &day);
1711 switch (getCurrentDeltaTAlgorithm())1747 switch (getCurrentDeltaTAlgorithm())
1712 {1748 {
1713 case WithoutCorrection:1749 case WithoutCorrection:
@@ -1818,6 +1854,7 @@
1818 finish = 1100; // not 1620; // GZ: Not applicable for telescopic era, and better not after 1100 (pers.comm.)1854 finish = 1100; // not 1620; // GZ: Not applicable for telescopic era, and better not after 1100 (pers.comm.)
1819 break;1855 break;
1820 case EspenakMeeus: // the default, range stated in the Canon, p. 14.1856 case EspenakMeeus: // the default, range stated in the Canon, p. 14.
1857 case EspenakMeeusZeroMoonAccel:
1821 start = -1999;1858 start = -1999;
1822 finish = 3000;1859 finish = 3000;
1823 break;1860 break;
@@ -1847,7 +1884,7 @@
1847 validRange = q_("Valid range of usage: between years %1 and %2, %3.").arg(start).arg(finish).arg(validRangeAppendix);1884 validRange = q_("Valid range of usage: between years %1 and %2, %3.").arg(start).arg(finish).arg(validRangeAppendix);
1848 else1885 else
1849 validRange = q_("Valid range of usage: between years %1 and %2.").arg(start).arg(finish);1886 validRange = q_("Valid range of usage: between years %1 and %2.").arg(start).arg(finish);
1850 if (start > year || year > finish)1887 if ((year < start) || (finish < year))
1851 *marker = "*";1888 *marker = "*";
1852 }1889 }
1853 else1890 else
@@ -1857,8 +1894,7 @@
1857}1894}
18581895
1859// return if sky plus atmosphere is bright enough from sunlight so that e.g. screen labels should be rendered dark.1896// return if sky plus atmosphere is bright enough from sunlight so that e.g. screen labels should be rendered dark.
1860// Could be renamed to isBrightDaylight()1897bool StelCore::isBrightDaylight() const
1861bool StelCore::isDay() const
1862{1898{
1863 const Vec3d& sunPos = GETSTELMODULE(SolarSystem)->getSun()->getAltAzPosGeometric(this);1899 const Vec3d& sunPos = GETSTELMODULE(SolarSystem)->getSun()->getAltAzPosGeometric(this);
1864 return sunPos[2] > -0.12; // Nautical twilight (0.12 > sin (6 deg),1900 return sunPos[2] > -0.12; // Nautical twilight (0.12 > sin (6 deg),
@@ -1866,5 +1902,5 @@
18661902
1867double StelCore::getCurrentEpoch() const1903double StelCore::getCurrentEpoch() const
1868{1904{
1869 return 2000.0 + (getJDay() - 2451545.0)/365.25;1905 return 2000.0 + (getJD() - 2451545.0)/365.25;
1870}1906}
18711907
=== modified file 'src/core/StelCore.hpp'
--- src/core/StelCore.hpp 2015-08-02 17:12:29 +0000
+++ src/core/StelCore.hpp 2015-08-03 13:17:13 +0000
@@ -28,6 +28,7 @@
28#include <QString>28#include <QString>
29#include <QStringList>29#include <QStringList>
30#include <QTime>30#include <QTime>
31#include <QPair>
3132
32class StelToneReproducer;33class StelToneReproducer;
33class StelSkyDrawer;34class StelSkyDrawer;
@@ -124,6 +125,7 @@
124 MorrisonStephenson2004, //!< Morrison & Stephenson (2004, 2005) algorithm for DeltaT125 MorrisonStephenson2004, //!< Morrison & Stephenson (2004, 2005) algorithm for DeltaT
125 Reijs, //!< Reijs (2006) algorithm for DeltaT126 Reijs, //!< Reijs (2006) algorithm for DeltaT
126 EspenakMeeus, //!< Espenak & Meeus (2006) algorithm for DeltaT (Recommended, default)127 EspenakMeeus, //!< Espenak & Meeus (2006) algorithm for DeltaT (Recommended, default)
128 EspenakMeeusZeroMoonAccel, // Espenak & Meeus (2006) algorithm for DeltaT (but without additional Lunar acceleration. FOR TESTING ONLY, NONPUBLIC)
127 Banjevic, //!< Banjevic (2006) algorithm for DeltaT129 Banjevic, //!< Banjevic (2006) algorithm for DeltaT
128 IslamSadiqQureshi, //!< Islam, Sadiq & Qureshi (2008 + revisited 2013) algorithm for DeltaT (6 polynomials)130 IslamSadiqQureshi, //!< Islam, Sadiq & Qureshi (2008 + revisited 2013) algorithm for DeltaT (6 polynomials)
129 KhalidSultanaZaidi, //!< M. Khalid, Mariam Sultana and Faheem Zaidi polinomial approximation of time period 1620-2013 (2014)131 KhalidSultanaZaidi, //!< M. Khalid, Mariam Sultana and Faheem Zaidi polinomial approximation of time period 1620-2013 (2014)
@@ -269,7 +271,7 @@
269 //! This is used only if the destination planet is different from the starting one.271 //! This is used only if the destination planet is different from the starting one.
270 void moveObserverTo(const StelLocation& target, double duration=1., double durationIfPlanetChange=1.);272 void moveObserverTo(const StelLocation& target, double duration=1., double durationIfPlanetChange=1.);
271273
272 // Conversion in standar Julian time format274 // Conversion in standard Julian time format
273 static const double JD_SECOND;275 static const double JD_SECOND;
274 static const double JD_MINUTE;276 static const double JD_MINUTE;
275 static const double JD_HOUR;277 static const double JD_HOUR;
@@ -286,26 +288,21 @@
286 //! Get the duration of a sidereal year for the current observer in days.288 //! Get the duration of a sidereal year for the current observer in days.
287 double getLocalSiderealYearLength() const;289 double getLocalSiderealYearLength() const;
288290
289 //! Return the startup mode, can be preset|Preset or anything else291 //! Return the startup mode, can be "actual" (i.e. take current time from system),
292 //! "today" (take some time e.g. on the evening of today) or "preset" (completely preconfigured).
290 QString getStartupTimeMode();293 QString getStartupTimeMode();
291 void setStartupTimeMode(const QString& s);294 void setStartupTimeMode(const QString& s);
292295
293 //! Get Delta-T estimation for a given date.
294 //! @param jDay the date and time expressed as a julian day
295 //! @return Delta-T in seconds
296 //! @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
297 double getDeltaT(double jDay) const;
298
299 //! Get info about valid range for current algorithm for calculation of Delta-T296 //! Get info about valid range for current algorithm for calculation of Delta-T
300 //! @param jDay the JD297 //! @param JD the Julian Day number to test.
301 //! @param marker the marker for valid range298 //! @param marker receives a string: "*" if jDay is outside valid range, or "?" if range unknown, else an empty string.
302 //! @return valid range299 //! @return valid range as explanatory string.
303 QString getCurrentDeltaTAlgorithmValidRange(double jDay, QString* marker) const;300 QString getCurrentDeltaTAlgorithmValidRangeDescription(const double JD, QString* marker) const;
304301
305 //! Checks for altitude of sun - is it night or day?302 //! Checks for altitude of sun - is it night or day?
306 //! @return true if sun higher than about -6 degrees, i.e. "day" includes civil twilight.303 //! @return true if sun higher than about -6 degrees, i.e. "day" includes civil twilight.
307 //! @note Useful mostly for brightness-controlled GUI decisions like font colors.304 //! @note Useful mostly for brightness-controlled GUI decisions like font colors.
308 bool isDay() const;305 bool isBrightDaylight() const;
309306
310 //! Get value of the current Julian epoch (i.e. current year with decimal fraction, e.g. 2012.34567)307 //! Get value of the current Julian epoch (i.e. current year with decimal fraction, e.g. 2012.34567)
311 double getCurrentEpoch() const;308 double getCurrentEpoch() const;
@@ -367,16 +364,43 @@
367 //! Return to the default location and set default landscape with atmosphere and fog effects364 //! Return to the default location and set default landscape with atmosphere and fog effects
368 void returnToHome();365 void returnToHome();
369366
370 //! Set the current date in Julian Day367 //! Set the current date in Julian Day (UT)
371 void setJDay(double JD);368 void setJD(double newJD);
372 //! Get the current date in Julian Day369 //! Set the current date in Julian Day (TT).
373 double getJDay() const;370 //! The name is derived from the classical name "Ephemeris Time", of which TT is the successor.
371 //! It is still frequently used in the literature.
372 void setJDE(double newJDE);
373 //! Get the current date in Julian Day (UT).
374 double getJD() const;
375 //! Get the current date in Julian Day (TT).
376 //! The name is derived from the classical name "Ephemeris Time", of which TT is the successor.
377 //! It is still frequently used in the literature.
378 double getJDE() const;
374379
375 //! Set the current date in Modified Julian Day380 //! Set the current date in Modified Julian Day (UT).
381 //! MJD is simply JD-2400000.5, getting rid of large numbers and starting days at midnight.
382 //! It is mostly used in satellite contexts.
376 void setMJDay(double MJD);383 void setMJDay(double MJD);
377 //! Get the current date in Modified Julian Day384 //! Get the current date in Modified Julian Day (UT)
378 double getMJDay() const;385 double getMJDay() const;
379386
387 //! Compute Delta-T estimation for a given date.
388 //! DeltaT is the accumulated effect of earth's rotation slowly getting slower, mostly caused by tidal braking by the Moon.
389 //! For accurate positioning of objects in the sky, we must compute earth-based clock-dependent things like earth rotation, hour angles etc.
390 //! using plain UT, but all orbital motions or rotation of the other planets must be computed in TT, which is a regular time frame.
391 //! Also satellites are computed in the UT frame because (1) they are short-lived and (2) must follow paths over earth ground.
392 //! (Note that we make no further difference between TT and DT, those are regarded equivalent for our purpose.)
393 //!
394 //! @param JD the date and time expressed as a Julian Day
395 //! @return DeltaT in seconds
396 //! @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
397 //! @note Use this only if needed, prefer calling getDeltaT() for access to the current value.
398 double computeDeltaT(const double JD) const;
399 //! Get current DeltaT.
400 double getDeltaT() const;
401
402
403
380 //! Return the preset sky time in JD404 //! Return the preset sky time in JD
381 double getPresetSkyTime() const;405 double getPresetSkyTime() const;
382 //! Set the preset sky time from a JD406 //! Set the preset sky time from a JD
@@ -415,9 +439,9 @@
415 //! get the initial "today time" from the config file439 //! get the initial "today time" from the config file
416 QTime getInitTodayTime(void);440 QTime getInitTodayTime(void);
417 //! set the initial "today time" from the config file441 //! set the initial "today time" from the config file
418 void setInitTodayTime(const QTime& t);442 void setInitTodayTime(const QTime& time);
419 //! Set the preset sky time from a QDateTime443 //! Set the preset sky time from a QDateTime
420 void setPresetSkyTime(QDateTime dt);444 void setPresetSkyTime(QDateTime dateTime);
421445
422 //! Add one [Earth, solar] hour to the current simulation time.446 //! Add one [Earth, solar] hour to the current simulation time.
423 void addHour();447 void addHour();
@@ -529,7 +553,7 @@
529 //! the selected object is of the correct type - i.e. a planet.553 //! the selected object is of the correct type - i.e. a planet.
530 void moveObserverToSelected();554 void moveObserverToSelected();
531555
532 //! Set year for custom equation for calculation of Delta-T556 //! Set central year for custom equation for calculation of Delta-T
533 //! @param y the year, e.g. 1820557 //! @param y the year, e.g. 1820
534 void setDeltaTCustomYear(float y) { deltaTCustomYear=y; }558 void setDeltaTCustomYear(float y) { deltaTCustomYear=y; }
535 //! Set n-dot for custom equation for calculation of Delta-T559 //! Set n-dot for custom equation for calculation of Delta-T
@@ -539,7 +563,7 @@
539 //! @param y the coefficients, e.g. -20,0,32563 //! @param y the coefficients, e.g. -20,0,32
540 void setDeltaTCustomEquationCoefficients(Vec3f c) { deltaTCustomEquationCoeff=c; }564 void setDeltaTCustomEquationCoefficients(Vec3f c) { deltaTCustomEquationCoeff=c; }
541565
542 //! Get year for custom equation for calculation of Delta-T566 //! Get central year for custom equation for calculation of Delta-T
543 float getDeltaTCustomYear() const { return deltaTCustomYear; }567 float getDeltaTCustomYear() const { return deltaTCustomYear; }
544 //! Get n-dot for custom equation for calculation of Delta-T568 //! Get n-dot for custom equation for calculation of Delta-T
545 float getDeltaTCustomNDot() const { return deltaTCustomNDot; }569 float getDeltaTCustomNDot() const { return deltaTCustomNDot; }
@@ -573,6 +597,8 @@
573 void updateTime(double deltaTime);597 void updateTime(double deltaTime);
574 void resetSync();598 void resetSync();
575599
600
601
576 // Matrices used for every coordinate transfo602 // Matrices used for every coordinate transfo
577 Mat4d matHeliocentricEclipticJ2000ToAltAz; // Transform from heliocentric ecliptic Cartesian (VSOP87A) to topocentric (StelObserver) altazimuthal coordinate603 Mat4d matHeliocentricEclipticJ2000ToAltAz; // Transform from heliocentric ecliptic Cartesian (VSOP87A) to topocentric (StelObserver) altazimuthal coordinate
578 Mat4d matAltAzToHeliocentricEclipticJ2000; // Transform from topocentric (StelObserver) altazimuthal coordinate to heliocentric ecliptic Cartesian (VSOP87A)604 Mat4d matAltAzToHeliocentricEclipticJ2000; // Transform from topocentric (StelObserver) altazimuthal coordinate to heliocentric ecliptic Cartesian (VSOP87A)
@@ -597,12 +623,14 @@
597623
598 // Time variables624 // Time variables
599 double timeSpeed; // Positive : forward, Negative : Backward, 1 = 1sec/sec625 double timeSpeed; // Positive : forward, Negative : Backward, 1 = 1sec/sec
600 double JDay; // Curent time in Julian day626 //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.
627 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()
628 // Use is best with calls getJD()/setJD() and getJDE()/setJDE() to explicitly state which flavour of JD you need.
601 double presetSkyTime;629 double presetSkyTime;
602 QTime initTodayTime;630 QTime initTodayTime;
603 QString startupTimeMode;631 QString startupTimeMode;
604 double secondsOfLastJDayUpdate; // Time in seconds when the time rate or time last changed632 double secondsOfLastJDUpdate; // Time in seconds when the time rate or time last changed
605 double JDayOfLastJDayUpdate; // JDay when the time rate or time last changed633 double jdOfLastJDUpdate; // JD when the time rate or time last changed
606634
607 // Variables for custom equation of Delta-T635 // Variables for custom equation of Delta-T
608 Vec3f deltaTCustomEquationCoeff;636 Vec3f deltaTCustomEquationCoeff;
609637
=== modified file 'src/core/StelMovementMgr.cpp'
--- src/core/StelMovementMgr.cpp 2015-07-24 14:56:52 +0000
+++ src/core/StelMovementMgr.cpp 2015-08-03 13:17:13 +0000
@@ -321,7 +321,7 @@
321{321{
322 DragHistoryEntry e;322 DragHistoryEntry e;
323 e.runTime=StelApp::getInstance().getTotalRunTime();323 e.runTime=StelApp::getInstance().getTotalRunTime();
324 e.jd=core->getJDay();324 e.jd=core->getJD();
325 e.x=x;325 e.x=x;
326 e.y=y;326 e.y=y;
327 timeDragHistory.append(e);327 timeDragHistory.append(e);
@@ -907,7 +907,7 @@
907 viewDirectionMountFrame = j2000ToMountFrame(v);907 viewDirectionMountFrame = j2000ToMountFrame(v);
908}908}
909909
910void StelMovementMgr::panView(double deltaAz, double deltaAlt)910void StelMovementMgr::panView(const double deltaAz, const double deltaAlt)
911{911{
912 double azVision, altVision;912 double azVision, altVision;
913 StelUtils::rectToSphe(&azVision,&altVision,j2000ToMountFrame(viewDirectionJ2000));913 StelUtils::rectToSphe(&azVision,&altVision,j2000ToMountFrame(viewDirectionJ2000));
@@ -947,7 +947,7 @@
947 v2[2]=0; v2.normalize();947 v2[2]=0; v2.normalize();
948 double angle = (v2^v1)[2];948 double angle = (v2^v1)[2];
949 double deltaDay = angle/(2.*M_PI)*core->getLocalSiderealDayLength();949 double deltaDay = angle/(2.*M_PI)*core->getLocalSiderealDayLength();
950 core->setJDay(core->getJDay()+deltaDay);950 core->setJD(core->getJD()+deltaDay);
951 addTimeDragPoint(x2, y2);951 addTimeDragPoint(x2, y2);
952 }952 }
953 else953 else
954954
=== modified file 'src/core/StelMovementMgr.hpp'
--- src/core/StelMovementMgr.hpp 2015-07-24 14:56:52 +0000
+++ src/core/StelMovementMgr.hpp 2015-08-03 13:17:13 +0000
@@ -117,7 +117,7 @@
117 //! Changes to viewing direction are instantaneous.117 //! Changes to viewing direction are instantaneous.
118 //! @param deltaAz change in azimuth angle in radians118 //! @param deltaAz change in azimuth angle in radians
119 //! @param deltaAlt change in altitude angle in radians119 //! @param deltaAlt change in altitude angle in radians
120 void panView(double deltaAz, double deltaAlt);120 void panView(const double deltaAz, const double deltaAlt);
121121
122 //! Set automove duration in seconds122 //! Set automove duration in seconds
123 //! @param f the number of seconds it takes for an auto-move operation to complete.123 //! @param f the number of seconds it takes for an auto-move operation to complete.
124124
=== modified file 'src/core/StelObject.cpp'
--- src/core/StelObject.cpp 2015-07-28 13:22:40 +0000
+++ src/core/StelObject.cpp 2015-08-03 13:17:13 +0000
@@ -42,21 +42,15 @@
42// Get observer local sidereal coordinate42// Get observer local sidereal coordinate
43Vec3d StelObject::getSiderealPosGeometric(const StelCore* core) const43Vec3d StelObject::getSiderealPosGeometric(const StelCore* core) const
44{44{
45 // Hour Angle corrected to Delta-T value45 return Mat4d::zrotation(-core->getLocalSiderealTime())* getEquinoxEquatorialPos(core);
46 // TODO: make code readable by calling siderealTime(JD_UT), this should not contain a deltaT in its algorithm.
47 double dt = (core->getDeltaT(core->getJDay())/240.)*M_PI/180.;
48 return Mat4d::zrotation(-core->getLocalSiderealTime()+dt)* getEquinoxEquatorialPos(core);
49}46}
5047
51// Get observer local sidereal coordinates, deflected by refraction48// Get observer local sidereal coordinates, deflected by refraction
52Vec3d StelObject::getSiderealPosApparent(const StelCore* core) const49Vec3d StelObject::getSiderealPosApparent(const StelCore* core) const
53{50{
54 Vec3d v=getAltAzPosApparent(core);51 Vec3d v=getAltAzPosApparent(core); // These already come with refraction!
55 v = core->altAzToEquinoxEqu(v, StelCore::RefractionOff);52 v = core->altAzToEquinoxEqu(v, StelCore::RefractionOff);
56 // Hour Angle corrected to Delta-T value53 return Mat4d::zrotation(-core->getLocalSiderealTime())*v;
57 // TODO: make code readable by calling siderealTime(JD_UT), this should not contain a deltaT in its algorithm.
58 double dt = (core->getDeltaT(core->getJDay())/240.)*M_PI/180.;
59 return Mat4d::zrotation(-core->getLocalSiderealTime()+dt)*v;
60}54}
6155
62Vec3d StelObject::getAltAzPosGeometric(const StelCore* core) const56Vec3d StelObject::getAltAzPosGeometric(const StelCore* core) const
@@ -204,9 +198,8 @@
204 // and because the ecliptical grid of J2000 is also shown for observers on other planets.198 // and because the ecliptical grid of J2000 is also shown for observers on other planets.
205 // The formulation here has never computed the true position of any observer planet's orbital plane except for Earth,199 // The formulation here has never computed the true position of any observer planet's orbital plane except for Earth,
206 // or ever displayed the coordinates in the observer planet's equivalent to Earth's ecliptical coordinates.200 // or ever displayed the coordinates in the observer planet's equivalent to Earth's ecliptical coordinates.
207 // 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.201 // 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...).
208202
209 //double ecl = core->getCurrentPlanet()->getRotObliquity(2451545.0);
210 double ecl=GETSTELMODULE(SolarSystem)->getEarth()->getRotObliquity(2451545.0);203 double ecl=GETSTELMODULE(SolarSystem)->getEarth()->getRotObliquity(2451545.0);
211 double ra_equ, dec_equ, lambda, beta;204 double ra_equ, dec_equ, lambda, beta;
212 StelUtils::rectToSphe(&ra_equ,&dec_equ,getJ2000EquatorialPos(core));205 StelUtils::rectToSphe(&ra_equ,&dec_equ,getJ2000EquatorialPos(core));
@@ -267,7 +260,7 @@
267 {260 {
268 Vec3f color = getInfoColor();261 Vec3f color = getInfoColor();
269 StelCore* core = StelApp::getInstance().getCore();262 StelCore* core = StelApp::getInstance().getCore();
270 if (core->isDay() && core->getSkyDrawer()->getFlagHasAtmosphere()==true)263 if (core->isBrightDaylight() && core->getSkyDrawer()->getFlagHasAtmosphere()==true)
271 {264 {
272 // make info text more readable when atmosphere enabled at daylight.265 // make info text more readable when atmosphere enabled at daylight.
273 color = StelUtils::strToVec3f(StelApp::getInstance().getSettings()->value("color/daylight_text_color", "0.0,0.0,0.0").toString());266 color = StelUtils::strToVec3f(StelApp::getInstance().getSettings()->value("color/daylight_text_color", "0.0,0.0,0.0").toString());
274267
=== modified file 'src/core/StelObserver.cpp'
--- src/core/StelObserver.cpp 2015-07-27 21:55:05 +0000
+++ src/core/StelObserver.cpp 2015-08-03 13:17:13 +0000
@@ -77,9 +77,9 @@
7777
78 // rotation:78 // rotation:
79 const RotationElements &r(dest->getRotationElements());79 const RotationElements &r(dest->getRotationElements());
80 lastJD = StelApp::getInstance().getCore()->getJDay();80 lastJDE = StelApp::getInstance().getCore()->getJDE();
8181
82 re.offset = r.offset + fmod(re.offset - r.offset + 360.0*( (lastJD-re.epoch)/re.period - (lastJD-r.epoch)/r.period), 360.0);82 re.offset = r.offset + fmod(re.offset - r.offset + 360.0*( (lastJDE-re.epoch)/re.period - (lastJDE-r.epoch)/r.period), 360.0);
8383
84 re.epoch = r.epoch;84 re.epoch = r.epoch;
85 re.period = r.period;85 re.period = r.period;
@@ -218,25 +218,19 @@
218 return rho*a;218 return rho*a;
219}219}
220220
221Mat4d StelObserver::getRotAltAzToEquatorial(double jd) const221// For Earth we require JD, for other planets JDE to describe rotation!
222Mat4d StelObserver::getRotAltAzToEquatorial(double JD, double JDE) const
222{223{
223 double lat = currentLocation.latitude;224 double lat = currentLocation.latitude;
224 // TODO: Figure out how to keep continuity in sky as we reach poles225 // TODO: Figure out how to keep continuity in sky as we reach poles
225 // otherwise sky jumps in rotation when reach poles in equatorial mode226 // otherwise sky jumps in rotation when reach poles in equatorial mode
226 // This is a kludge227 // This is a kludge
227 // GZ: Actually, why would that be? Lat should be clamped elsewhere. Added tests.228 // GZ: Actually, why would that be? Lat should be clamped elsewhere. Added tests to track down problems in other locations.
228 Q_ASSERT(lat <= 90.0);229 Q_ASSERT(lat <= 90.0);
229 Q_ASSERT(lat >= -90.0);230 Q_ASSERT(lat >= -90.0);
230 if( lat > 90.0 ) lat = 90.0;231 if( lat > 90.0 ) lat = 90.0;
231 if( lat < -90.0 ) lat = -90.0;232 if( lat < -90.0 ) lat = -90.0;
232 // Include a DeltaT correction. Sidereal time and longitude here are both in degrees, but DeltaT in seconds of time.233 return Mat4d::zrotation((getHomePlanet()->getSiderealTime(JD, JDE)+currentLocation.longitude)*M_PI/180.)
233 // 360 degrees = 24hrs; 15 degrees = 1hr = 3600s; 1 degree = 240s
234 // Apply DeltaT correction only for Earth
235 // TODO: make code readable by calling siderealTime(JD_UT), this should not contain a deltaT in its algorithm.
236 double deltaT = 0.;
237 if (getHomePlanet()->getEnglishName()=="Earth")
238 deltaT = StelApp::getInstance().getCore()->getDeltaT(jd)/240.;
239 return Mat4d::zrotation((getHomePlanet()->getSiderealTime(jd)+currentLocation.longitude-deltaT)*M_PI/180.)
240 * Mat4d::yrotation((90.-lat)*M_PI/180.);234 * Mat4d::yrotation((90.-lat)*M_PI/180.);
241}235}
242236
243237
=== modified file 'src/core/StelObserver.hpp'
--- src/core/StelObserver.hpp 2014-02-18 06:36:58 +0000
+++ src/core/StelObserver.hpp 2015-08-03 13:17:13 +0000
@@ -50,7 +50,10 @@
50 Vec3d getCenterVsop87Pos(void) const;50 Vec3d getCenterVsop87Pos(void) const;
51 //! Get the distance between observer and home planet center in AU51 //! Get the distance between observer and home planet center in AU
52 double getDistanceFromCenter(void) const;52 double getDistanceFromCenter(void) const;
53 Mat4d getRotAltAzToEquatorial(double jd) const;53
54 //! returns rotation matrix for conversion of alt-azimuthal to equatorial coordinates
55 //! For Earth we need JD(UT), for other planets JDE! To be general, just have both in here!
56 Mat4d getRotAltAzToEquatorial(double JD, double JDE) const;
54 Mat4d getRotEquatorialToVsop87(void) const;57 Mat4d getRotEquatorialToVsop87(void) const;
5558
56 virtual const QSharedPointer<Planet> getHomePlanet(void) const;59 virtual const QSharedPointer<Planet> getHomePlanet(void) const;
5760
=== modified file 'src/core/StelUtils.hpp'
--- src/core/StelUtils.hpp 2015-05-10 08:29:58 +0000
+++ src/core/StelUtils.hpp 2015-08-03 13:17:13 +0000
@@ -326,7 +326,7 @@
326 return Vec3f(max, 0, 0);326 return Vec3f(max, 0, 0);
327 }327 }
328328
329 //! Calculate and getting sidereal period in days from semi-major axis (in AU)329 //! Calculate and return sidereal period in days from semi-major axis (in AU)
330 double calculateSiderealPeriod(const double SemiMajorAxis);330 double calculateSiderealPeriod(const double SemiMajorAxis);
331331
332 //! Convert decimal hours to hours, minutes, seconds332 //! Convert decimal hours to hours, minutes, seconds
333333
=== modified file 'src/core/TrailGroup.cpp'
--- src/core/TrailGroup.cpp 2015-05-12 07:00:45 +0000
+++ src/core/TrailGroup.cpp 2015-08-03 13:17:13 +0000
@@ -36,7 +36,7 @@
36{36{
37 glEnable(GL_BLEND);37 glEnable(GL_BLEND);
38 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);38 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
39 float currentTime = core->getJDay();39 float currentTime = core->getJDE();
40 StelProjector::ModelViewTranformP transfo = core->getJ2000ModelViewTransform();40 StelProjector::ModelViewTranformP transfo = core->getJ2000ModelViewTransform();
41 transfo->combine(j2000ToTrailNativeInverted);41 transfo->combine(j2000ToTrailNativeInverted);
42 sPainter->setProjector(core->getProjection(transfo));42 sPainter->setProjector(core->getProjection(transfo));
@@ -66,12 +66,12 @@
66// Add 1 point to all the curves at current time and suppress too old points66// Add 1 point to all the curves at current time and suppress too old points
67void TrailGroup::update()67void TrailGroup::update()
68{68{
69 times.append(StelApp::getInstance().getCore()->getJDay());69 times.append(StelApp::getInstance().getCore()->getJDE());
70 for (QList<Trail>::Iterator iter=allTrails.begin();iter!=allTrails.end();++iter)70 for (QList<Trail>::Iterator iter=allTrails.begin();iter!=allTrails.end();++iter)
71 {71 {
72 iter->posHistory.append(j2000ToTrailNative*iter->stelObject->getJ2000EquatorialPos(StelApp::getInstance().getCore()));72 iter->posHistory.append(j2000ToTrailNative*iter->stelObject->getJ2000EquatorialPos(StelApp::getInstance().getCore()));
73 }73 }
74 if (StelApp::getInstance().getCore()->getJDay()-times.at(0)>timeExtent)74 if (StelApp::getInstance().getCore()->getJDE()-times.at(0)>timeExtent)
75 {75 {
76 times.pop_front();76 times.pop_front();
77 for (QList<Trail>::Iterator iter=allTrails.begin();iter!=allTrails.end();++iter)77 for (QList<Trail>::Iterator iter=allTrails.begin();iter!=allTrails.end();++iter)
7878
=== modified file 'src/core/modules/Atmosphere.cpp'
--- src/core/modules/Atmosphere.cpp 2015-02-01 20:44:54 +0000
+++ src/core/modules/Atmosphere.cpp 2015-08-03 13:17:13 +0000
@@ -220,7 +220,7 @@
220 }220 }
221 else221 else
222 eclipseFactor = 1.f;222 eclipseFactor = 1.f;
223223 // TODO: compute eclipse factor also for Lunar eclipses! (lp:#1471546)
224224
225 // No need to calculate if not visible225 // No need to calculate if not visible
226 if (!fader.getInterstate())226 if (!fader.getInterstate())
227227
=== modified file 'src/core/modules/Comet.cpp'
--- src/core/modules/Comet.cpp 2015-03-15 15:47:35 +0000
+++ src/core/modules/Comet.cpp 2015-08-03 13:17:13 +0000
@@ -89,10 +89,10 @@
89 dustTailBrightnessFactor(dustTailBrightnessFact)89 dustTailBrightnessFactor(dustTailBrightnessFact)
90{90{
91 texMapName = atexMapName;91 texMapName = atexMapName;
92 lastOrbitJD =0;92 lastOrbitJDE =0;
93 deltaJD = StelCore::JD_SECOND;93 deltaJDE = StelCore::JD_SECOND;
94 deltaJDtail=15.0*StelCore::JD_MINUTE; // update tail geometry every 15 minutes only94 deltaJDEtail=15.0*StelCore::JD_MINUTE; // update tail geometry every 15 minutes only
95 lastJDtail=0.0;95 lastJDEtail=0.0;
96 orbitCached = 0;96 orbitCached = 0;
97 closeOrbit = acloseOrbit;97 closeOrbit = acloseOrbit;
9898
@@ -314,27 +314,27 @@
314{314{
315 Planet::update(deltaTime);315 Planet::update(deltaTime);
316316
317 // The rest used to be in computePosition(), but is better in update(). Unfortunately we need date (JD).317 // The rest deals with updating tail geometries and brightness
318 StelCore* core=StelApp::getInstance().getCore();318 StelCore* core=StelApp::getInstance().getCore();
319 double date=core->getJDay();319 double dateJDE=core->getJDE();
320320
321 // The CometOrbit is in fact available in userDataPtr!321 // The CometOrbit is in fact available in userDataPtr!
322 CometOrbit* orbit=(CometOrbit*)userDataPtr;322 CometOrbit* orbit=(CometOrbit*)userDataPtr;
323 Q_ASSERT(orbit);323 Q_ASSERT(orbit);
324 if (!orbit->objectDateValid(core->getJDay())) return; // don't do anything if out of useful date range. This allows having hundreds of comet elements.324 if (!orbit->objectDateValid(dateJDE)) return; // don't do anything if out of useful date range. This allows having hundreds of comet elements.
325325
326326
327 //GZ: I think we can make deltaJDtail adaptive, depending on distance to sun! For some reason though, this leads to a crash!327 //GZ: I think we can make deltaJDtail adaptive, depending on distance to sun! For some reason though, this leads to a crash!
328 //deltaJDtail=StelCore::JD_SECOND * qMax(1.0, qMin(eclipticPos.length(), 20.0));328 //deltaJDtail=StelCore::JD_SECOND * qMax(1.0, qMin(eclipticPos.length(), 20.0));
329329
330 if (fabs(lastJDtail-date)>deltaJDtail)330 if (fabs(lastJDEtail-dateJDE)>deltaJDEtail)
331 {331 {
332 lastJDtail=date;332 lastJDEtail=dateJDE;
333333
334 // The CometOrbit is in fact available in userDataPtr!334 // The CometOrbit is in fact available in userDataPtr!
335 CometOrbit* orbit=(CometOrbit*)userDataPtr;335 CometOrbit* orbit=(CometOrbit*)userDataPtr;
336 Q_ASSERT(orbit);336 Q_ASSERT(orbit);
337 if (!orbit->objectDateValid(date)) return; // out of useful date range. This should allow having hundreds of comet elements.337 if (!orbit->objectDateValid(dateJDE)) return; // out of useful date range. This should allow having hundreds of comet elements.
338338
339 if (orbit->getUpdateTails()){339 if (orbit->getUpdateTails()){
340 // Compute lengths and orientations from orbit object, but only if required.340 // Compute lengths and orientations from orbit object, but only if required.
@@ -457,7 +457,7 @@
457 gastailColorArr.fill(gasColor, gastailVertexArr.length());457 gastailColorArr.fill(gasColor, gastailVertexArr.length());
458 dusttailColorArr.fill(dustColor, dusttailVertexArr.length());458 dusttailColorArr.fill(dustColor, dusttailVertexArr.length());
459 }459 }
460 //qDebug() << "Comet " << getEnglishName() << "JD: " << date << "gasR" << gasColor[0] << " dustR" << dustColor[0];460 //qDebug() << "Comet " << getEnglishName() << "JDE: " << date << "gasR" << gasColor[0] << " dustR" << dustColor[0];
461}461}
462462
463463
@@ -483,7 +483,7 @@
483 // The CometOrbit is in fact available in userDataPtr!483 // The CometOrbit is in fact available in userDataPtr!
484 CometOrbit* orbit=(CometOrbit*)userDataPtr;484 CometOrbit* orbit=(CometOrbit*)userDataPtr;
485 Q_ASSERT(orbit);485 Q_ASSERT(orbit);
486 if (!orbit->objectDateValid(core->getJDay())) return; // don't draw at all if out of useful date range. This allows having hundreds of comet elements.486 if (!orbit->objectDateValid(core->getJDE())) return; // don't draw at all if out of useful date range. This allows having hundreds of comet elements.
487487
488 Mat4d mat = Mat4d::translation(eclipticPos) * rotLocalToParent;488 Mat4d mat = Mat4d::translation(eclipticPos) * rotLocalToParent;
489 // This removed totally the Planet shaking bug!!!489 // This removed totally the Planet shaking bug!!!
490490
=== modified file 'src/core/modules/Comet.hpp'
--- src/core/modules/Comet.hpp 2014-11-25 13:02:40 +0000
+++ src/core/modules/Comet.hpp 2015-08-03 13:17:13 +0000
@@ -96,14 +96,10 @@
96 //! get sidereal period for comet, days, or returns 0 if not possible (paraboloid, hyperboloid orbit)96 //! get sidereal period for comet, days, or returns 0 if not possible (paraboloid, hyperboloid orbit)
97 virtual double getSiderealPeriod() const;97 virtual double getSiderealPeriod() const;
9898
99 //! GZ: override from Planet: extend with tail details.
100 //virtual void computePosition(const double date);
101
102 //! re-implementation of Planet's draw()99 //! re-implementation of Planet's draw()
103 virtual void draw(StelCore* core, float maxMagLabels, const QFont& planetNameFont);100 virtual void draw(StelCore* core, float maxMagLabels, const QFont& planetNameFont);
104101
105 // re-implementation of Planet's update() to prepare tails (extinction etc). @param deltaTime: ms (since last call)102 // re-implementation of Planet's update() to prepare tails (extinction etc). @param deltaTime: ms (since last call)
106 // TODO: computePosition can be removed and things added here!
107 virtual void update(int deltaTime);103 virtual void update(int deltaTime);
108104
109private:105private:
@@ -139,8 +135,8 @@
139 Vec2f tailFactors; // result of latest call to getComaDiameterAndTailLengthAU(); Results cached here for infostring. [0]=Coma diameter, [1] gas tail length.135 Vec2f tailFactors; // result of latest call to getComaDiameterAndTailLengthAU(); Results cached here for infostring. [0]=Coma diameter, [1] gas tail length.
140 bool tailActive; //! true if there is a tail long enough to be worth drawing. Drawing tails is quite costly.136 bool tailActive; //! true if there is a tail long enough to be worth drawing. Drawing tails is quite costly.
141 bool tailBright; //! true if tail is bright enough to draw.137 bool tailBright; //! true if tail is bright enough to draw.
142 double deltaJDtail; //! like deltaJD, but time difference between tail geometry updates.138 double deltaJDEtail; //! like deltaJDE, but time difference between tail geometry updates.
143 double lastJDtail; //! like lastJD, but time of last tail geometry update.139 double lastJDEtail; //! like lastJDE, but time of last tail geometry update.
144 Mat4d gasTailRot; //! rotation matrix for gas tail parabola140 Mat4d gasTailRot; //! rotation matrix for gas tail parabola
145 Mat4d dustTailRot; //! rotation matrix for the skewed dust tail parabola141 Mat4d dustTailRot; //! rotation matrix for the skewed dust tail parabola
146 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.5142 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
147143
=== modified file 'src/core/modules/Constellation.cpp'
--- src/core/modules/Constellation.cpp 2015-07-27 14:57:16 +0000
+++ src/core/modules/Constellation.cpp 2015-08-03 13:17:13 +0000
@@ -260,7 +260,7 @@
260 bool visible = false;260 bool visible = false;
261 int year, month, day;261 int year, month, day;
262 // Get the current month262 // Get the current month
263 StelUtils::getDateFromJulianDay(StelApp::getInstance().getCore()->getJDay(), &year, &month, &day);263 StelUtils::getDateFromJulianDay(StelApp::getInstance().getCore()->getJD(), &year, &month, &day);
264 if (endSeason >= beginSeason)264 if (endSeason >= beginSeason)
265 {265 {
266 // OK, it's a "normal" season rule...266 // OK, it's a "normal" season rule...
267267
=== modified file 'src/core/modules/LandscapeMgr.cpp'
--- src/core/modules/LandscapeMgr.cpp 2015-07-13 13:42:56 +0000
+++ src/core/modules/LandscapeMgr.cpp 2015-08-03 13:17:13 +0000
@@ -233,7 +233,8 @@
233 Vec3d sunPos = ssystem->getSun()->getAltAzPosApparent(core);233 Vec3d sunPos = ssystem->getSun()->getAltAzPosApparent(core);
234 // Compute the moon position in local coordinate234 // Compute the moon position in local coordinate
235 Vec3d moonPos = ssystem->getMoon()->getAltAzPosApparent(core);235 Vec3d moonPos = ssystem->getMoon()->getAltAzPosApparent(core);
236 atmosphere->computeColor(core->getJDay(), sunPos, moonPos,236 // 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.
237 atmosphere->computeColor(core->getJDE(), sunPos, moonPos,
237 ssystem->getMoon()->getPhaseAngle(ssystem->getEarth()->getHeliocentricEclipticPos()),238 ssystem->getMoon()->getPhaseAngle(ssystem->getEarth()->getHeliocentricEclipticPos()),
238 core, core->getCurrentLocation().latitude, core->getCurrentLocation().altitude,239 core, core->getCurrentLocation().latitude, core->getCurrentLocation().altitude,
239 15.f, 40.f); // Temperature = 15c, relative humidity = 40%240 15.f, 40.f); // Temperature = 15c, relative humidity = 40%
240241
=== modified file 'src/core/modules/MinorPlanet.cpp'
--- src/core/modules/MinorPlanet.cpp 2015-01-30 17:31:11 +0000
+++ src/core/modules/MinorPlanet.cpp 2015-08-03 13:17:13 +0000
@@ -64,8 +64,8 @@
64 pTypeStr)64 pTypeStr)
65{65{
66 texMapName = atexMapName;66 texMapName = atexMapName;
67 lastOrbitJD =0;67 lastOrbitJDE =0;
68 deltaJD = StelCore::JD_SECOND;68 deltaJDE = StelCore::JD_SECOND;
69 orbitCached = 0;69 orbitCached = 0;
70 closeOrbit = acloseOrbit;70 closeOrbit = acloseOrbit;
71 semiMajorAxis = 0.;71 semiMajorAxis = 0.;
@@ -143,7 +143,7 @@
143{143{
144 semiMajorAxis = value;144 semiMajorAxis = value;
145 // GZ: in case we have very many asteroids, this helps improving speed usually without sacrificing accuracy:145 // GZ: in case we have very many asteroids, this helps improving speed usually without sacrificing accuracy:
146 deltaJD = 2.0*semiMajorAxis*StelCore::JD_SECOND;146 deltaJDE = 2.0*semiMajorAxis*StelCore::JD_SECOND;
147}147}
148148
149void MinorPlanet::setMinorPlanetNumber(int number)149void MinorPlanet::setMinorPlanetNumber(int number)
150150
=== modified file 'src/core/modules/Orbit.cpp'
--- src/core/modules/Orbit.cpp 2015-02-23 09:56:53 +0000
+++ src/core/modules/Orbit.cpp 2015-08-03 13:17:13 +0000
@@ -222,15 +222,6 @@
222 const double cj = cos(parentRotJ2000Longitude);222 const double cj = cos(parentRotJ2000Longitude);
223 const double sj = sin(parentRotJ2000Longitude);223 const double sj = sin(parentRotJ2000Longitude);
224224
225// rotateToVsop87[0] = c_nod;
226// rotateToVsop87[1] = -s_nod * c_obl;
227// rotateToVsop87[2] = s_nod * s_obl;
228// rotateToVsop87[3] = s_nod;
229// rotateToVsop87[4] = c_nod * c_obl;
230// rotateToVsop87[5] = -c_nod * s_obl;
231// rotateToVsop87[6] = 0.0;
232// rotateToVsop87[7] = s_obl;
233// rotateToVsop87[8] = c_obl;
234 rotateToVsop87[0] = c_nod*cj-s_nod*c_obl*sj;225 rotateToVsop87[0] = c_nod*cj-s_nod*c_obl*sj;
235 rotateToVsop87[1] = -c_nod*sj-s_nod*c_obl*cj;226 rotateToVsop87[1] = -c_nod*sj-s_nod*c_obl*cj;
236 rotateToVsop87[2] = s_nod*s_obl;227 rotateToVsop87[2] = s_nod*s_obl;
@@ -243,20 +234,20 @@
243 // qDebug() << "CometOrbit::()...done";234 // qDebug() << "CometOrbit::()...done";
244}235}
245236
246void CometOrbit::positionAtTimevInVSOP87Coordinates(double JD, double *v, bool updateVelocityVector)237void CometOrbit::positionAtTimevInVSOP87Coordinates(double JDE, double *v, bool updateVelocityVector)
247{238{
248 JD -= t0;239 JDE -= t0;
249 double rCosNu,rSinNu;240 double rCosNu,rSinNu;
250// temporary solve freezes for near-parabolic comets - using (e < 0.9999) for elliptical orbits241// temporary solve freezes for near-parabolic comets - using (e < 0.9999) for elliptical orbits
251// TODO: improve calculations orbits for near-parabolic comets --AW242// TODO: improve calculations orbits for near-parabolic comets --AW
252// if (e < 0.9999) InitEll(q,n,e,JD,a1,a2);243// if (e < 0.9999) InitEll(q,n,e,JD,a1,a2);
253 if (e < 1.0) InitEll(q,n,e,JD,rCosNu,rSinNu); // GZ: After solving with Laguerre-Conway, I dare to go for 1.0.244 if (e < 1.0) InitEll(q,n,e,JDE,rCosNu,rSinNu); // GZ: After solving with Laguerre-Conway, I dare to go for 1.0.
254 else if (e > 1.0)245 else if (e > 1.0)
255 {246 {
256 // qDebug() << "Hyperbolic orbit for ecc=" << e << ", i=" << i << ", w=" << w << ", Mean Motion n=" << n;247 // qDebug() << "Hyperbolic orbit for ecc=" << e << ", i=" << i << ", w=" << w << ", Mean Motion n=" << n;
257 InitHyp(q,n,e,JD,rCosNu,rSinNu);248 InitHyp(q,n,e,JDE,rCosNu,rSinNu);
258 }249 }
259 else InitPar(q,n,JD,rCosNu,rSinNu);250 else InitPar(q,n,JDE,rCosNu,rSinNu);
260 double p0,p1,p2, s0, s1, s2;251 double p0,p1,p2, s0, s1, s2;
261 Init3D(i,Om,w,rCosNu,rSinNu,p0,p1,p2, s0, s1, s2, updateVelocityVector, e, q);252 Init3D(i,Om,w,rCosNu,rSinNu,p0,p1,p2, s0, s1, s2, updateVelocityVector, e, q);
262 v[0] = rotateToVsop87[0]*p0 + rotateToVsop87[1]*p1 + rotateToVsop87[2]*p2;253 v[0] = rotateToVsop87[0]*p0 + rotateToVsop87[1]*p1 + rotateToVsop87[2]*p2;
@@ -475,34 +466,34 @@
475}466}
476467
477// Return the offset from the center.468// Return the offset from the center.
478Vec3d EllipticalOrbit::positionAtTime(const double JD) const469Vec3d EllipticalOrbit::positionAtTime(const double JDE) const
479{470{
480 double meanMotion = 2.0 * M_PI / period;471 double meanMotion = 2.0 * M_PI / period;
481 double meanAnomaly = meanAnomalyAtEpoch + (JD-epoch) * meanMotion;472 double meanAnomaly = meanAnomalyAtEpoch + (JDE-epoch) * meanMotion;
482 double E = eccentricAnomaly(meanAnomaly);473 double E = eccentricAnomaly(meanAnomaly);
483474
484 return positionAtE(E);475 return positionAtE(E);
485}476}
486477
487//void EllipticalOrbit::positionAtTime(double JD, double * X, double * Y, double * Z) const478//void EllipticalOrbit::positionAtTime(double JDE, double * X, double * Y, double * Z) const
488//{479//{
489// Vec3d pos = positionAtTime(JD);480// Vec3d pos = positionAtTime(JDE);
490// *X=pos[2];481// *X=pos[2];
491// *Y=pos[0];482// *Y=pos[0];
492// *Z=pos[1];483// *Z=pos[1];
493//}484//}
494485
495//void EllipticalOrbit::positionAtTimev(double JD, double* v)486//void EllipticalOrbit::positionAtTimev(double JDE, double* v)
496//{487//{
497// Vec3d pos = positionAtTime(JD);488// Vec3d pos = positionAtTime(JDE);
498// v[0]=pos[2];489// v[0]=pos[2];
499// v[1]=pos[0];490// v[1]=pos[0];
500// v[2]=pos[1];491// v[2]=pos[1];
501//}492//}
502493
503void EllipticalOrbit::positionAtTimevInVSOP87Coordinates(const double JD, double* v) const494void EllipticalOrbit::positionAtTimevInVSOP87Coordinates(const double JDE, double* v) const
504{495{
505 Vec3d pos = positionAtTime(JD);496 Vec3d pos = positionAtTime(JDE);
506 v[0] = rotateToVsop87[0]*pos[0] + rotateToVsop87[1]*pos[1] + rotateToVsop87[2]*pos[2];497 v[0] = rotateToVsop87[0]*pos[0] + rotateToVsop87[1]*pos[1] + rotateToVsop87[2]*pos[2];
507 v[1] = rotateToVsop87[3]*pos[0] + rotateToVsop87[4]*pos[1] + rotateToVsop87[5]*pos[2];498 v[1] = rotateToVsop87[3]*pos[0] + rotateToVsop87[4]*pos[1] + rotateToVsop87[5]*pos[2];
508 v[2] = rotateToVsop87[6]*pos[0] + rotateToVsop87[7]*pos[1] + rotateToVsop87[8]*pos[2];499 v[2] = rotateToVsop87[6]*pos[0] + rotateToVsop87[7]*pos[1] + rotateToVsop87[8]*pos[2];
@@ -529,12 +520,12 @@
529}520}
530521
531522
532Vec3d CachingOrbit::positionAtTime(double jd) const523Vec3d CachingOrbit::positionAtTime(double JDE) const
533{524{
534 if (jd != lastTime)525 if (JDE != lastTime)
535 {526 {
536 lastTime = jd;527 lastTime = JDE;
537 lastPosition = computePosition(jd);528 lastPosition = computePosition(JDE);
538 }529 }
539 return lastPosition;530 return lastPosition;
540}531}
541532
=== modified file 'src/core/modules/Orbit.hpp'
--- src/core/modules/Orbit.hpp 2015-02-23 09:56:53 +0000
+++ src/core/modules/Orbit.hpp 2015-08-03 13:17:13 +0000
@@ -51,10 +51,10 @@
51 // which is the reference frame for VSOP8751 // which is the reference frame for VSOP87
52 // In order to rotate to VSOP8752 // In order to rotate to VSOP87
53 // parentRotObliquity and parentRotAscendingnode must be supplied.53 // parentRotObliquity and parentRotAscendingnode must be supplied.
54 void positionAtTimevInVSOP87Coordinates(const double JD, double* v) const;54 void positionAtTimevInVSOP87Coordinates(const double JDE, double* v) const;
5555
56 // Original one56 // Original one
57 Vec3d positionAtTime(const double JD) const;57 Vec3d positionAtTime(const double JDE) const;
58 double getPeriod() const;58 double getPeriod() const;
59 double getBoundingRadius() const;59 double getBoundingRadius() const;
60 virtual void sample(double, double, int, OrbitSampleProc&) const;60 virtual void sample(double, double, int, OrbitSampleProc&) const;
@@ -92,13 +92,13 @@
92 );92 );
93 // Compute the orbit for a specified Julian day and return a "stellarium compliant" function93 // Compute the orbit for a specified Julian day and return a "stellarium compliant" function
94 // GZ: new optional variable: updateVelocityVector, true required for dust tail orientation!94 // GZ: new optional variable: updateVelocityVector, true required for dust tail orientation!
95 void positionAtTimevInVSOP87Coordinates(double JD, double* v, bool updateVelocityVector=true);95 void positionAtTimevInVSOP87Coordinates(double JDE, double* v, bool updateVelocityVector=true);
96 // updating the tails is a bit expensive. try not to overdo it.96 // updating the tails is a bit expensive. try not to overdo it.
97 bool getUpdateTails() const { return updateTails; }97 bool getUpdateTails() const { return updateTails; }
98 void setUpdateTails(const bool update){ updateTails=update; }98 void setUpdateTails(const bool update){ updateTails=update; }
99 //! return speed value [AU/d] last computed by positionAtTimevInVSOP87Coordinates(JD, v, true)99 //! return speed value [AU/d] last computed by positionAtTimevInVSOP87Coordinates(JDE, v, true)
100 Vec3d getVelocity() const { return rdot; }100 Vec3d getVelocity() const { return rdot; }
101 bool objectDateValid(const double JD) const { return (fabs(t0-JD)<orbitGood); }101 bool objectDateValid(const double JDE) const { return (fabs(t0-JDE)<orbitGood); }
102private:102private:
103 const double q; //! perihel distance103 const double q; //! perihel distance
104 const double e; //! eccentricity104 const double e; //! eccentricity
@@ -134,11 +134,11 @@
134public:134public:
135 CachingOrbit() : lastTime(1.0e-30) {} //;135 CachingOrbit() : lastTime(1.0e-30) {} //;
136136
137 virtual Vec3d computePosition(double jd) const = 0;137 virtual Vec3d computePosition(double JDE) const = 0;
138 virtual double getPeriod() const = 0;138 virtual double getPeriod() const = 0;
139 virtual double getBoundingRadius() const = 0;139 virtual double getBoundingRadius() const = 0;
140140
141 Vec3d positionAtTime(double jd) const;141 Vec3d positionAtTime(double JDE) const;
142142
143 virtual void sample(double, double, int, OrbitSampleProc& proc) const;143 virtual void sample(double, double, int, OrbitSampleProc& proc) const;
144144
145145
=== modified file 'src/core/modules/Planet.cpp'
--- src/core/modules/Planet.cpp 2015-07-28 13:20:32 +0000
+++ src/core/modules/Planet.cpp 2015-08-03 13:17:13 +0000
@@ -86,7 +86,7 @@
86 axisRotation(0.),86 axisRotation(0.),
87 rings(NULL),87 rings(NULL),
88 sphereScale(1.f),88 sphereScale(1.f),
89 lastJD(J2000),89 lastJDE(J2000),
90 coordFunc(coordFunc),90 coordFunc(coordFunc),
91 userDataPtr(auserDataPtr),91 userDataPtr(auserDataPtr),
92 osculatingFunc(osculatingFunc),92 osculatingFunc(osculatingFunc),
@@ -97,11 +97,11 @@
97{97{
98 texMapName = atexMapName;98 texMapName = atexMapName;
99 normalMapName = anormalMapName;99 normalMapName = anormalMapName;
100 lastOrbitJD =0;100 lastOrbitJDE =0;
101 deltaJD = StelCore::JD_SECOND;101 deltaJDE = StelCore::JD_SECOND;
102 orbitCached = 0;102 orbitCached = 0;
103 closeOrbit = acloseOrbit;103 closeOrbit = acloseOrbit;
104 deltaOrbitJD = 0;104 deltaOrbitJDE = 0;
105 distance = 0;105 distance = 0;
106106
107 // Initialize pType with the key found in pTypeMap, or mark planet type as undefined.107 // Initialize pType with the key found in pTypeMap, or mark planet type as undefined.
@@ -118,7 +118,7 @@
118 nativeName = "";118 nativeName = "";
119 if (englishName!="Pluto")119 if (englishName!="Pluto")
120 {120 {
121 deltaJD = 0.001*StelCore::JD_SECOND;121 deltaJDE = 0.001*StelCore::JD_SECOND;
122 }122 }
123 flagLabels = true;123 flagLabels = true;
124 flagNativeName = true;124 flagNativeName = true;
@@ -383,7 +383,7 @@
383 re.precessionRate = _precessionRate;383 re.precessionRate = _precessionRate;
384 re.siderealPeriod = _siderealPeriod; // used for drawing orbit lines384 re.siderealPeriod = _siderealPeriod; // used for drawing orbit lines
385385
386 deltaOrbitJD = re.siderealPeriod/ORBIT_SEGMENTS;386 deltaOrbitJDE = re.siderealPeriod/ORBIT_SEGMENTS;
387}387}
388388
389Vec3d Planet::getJ2000EquatorialPos(const StelCore *core) const389Vec3d Planet::getJ2000EquatorialPos(const StelCore *core) const
@@ -393,12 +393,12 @@
393393
394// Compute the position in the parent Planet coordinate system394// Compute the position in the parent Planet coordinate system
395// Actually call the provided function to compute the ecliptical position395// Actually call the provided function to compute the ecliptical position
396void Planet::computePositionWithoutOrbits(const double dateJD)396void Planet::computePositionWithoutOrbits(const double dateJDE)
397{397{
398 if (fabs(lastJD-dateJD)>deltaJD)398 if (fabs(lastJDE-dateJDE)>deltaJDE)
399 {399 {
400 coordFunc(dateJD, eclipticPos, userDataPtr);400 coordFunc(dateJDE, eclipticPos, userDataPtr);
401 lastJD = dateJD;401 lastJDE = dateJDE;
402 }402 }
403}403}
404404
@@ -406,11 +406,11 @@
406// TODO: For earth, decide whether this should be Capitaine's omega_A (angle eclipticPoleJ2000//axis) or epsilon_A (angle axis//current ecliptic pole)406// TODO: For earth, decide whether this should be Capitaine's omega_A (angle eclipticPoleJ2000//axis) or epsilon_A (angle axis//current ecliptic pole)
407// For now, it is epsilon_A, the angle between earth's rotational axis and mean ecliptic of date.407// For now, it is epsilon_A, the angle between earth's rotational axis and mean ecliptic of date.
408// Details: e.g. Hilton etal, Report on Precession and the Ecliptic, Cel.Mech.Dyn.Astr.94:351-67 (2006), Fig1.408// Details: e.g. Hilton etal, Report on Precession and the Ecliptic, Cel.Mech.Dyn.Astr.94:351-67 (2006), Fig1.
409double Planet::getRotObliquity(double JDay) const409double Planet::getRotObliquity(double JDE) const
410{410{
411 // JDay=2451545.0 for J2000.0411 // JDay=2451545.0 for J2000.0
412 if (englishName=="Earth")412 if (englishName=="Earth")
413 return get_mean_ecliptical_obliquity(JDay) *M_PI/180.0;413 return get_mean_ecliptical_obliquity(JDE) *M_PI/180.0;
414 else414 else
415 return re.obliquity;415 return re.obliquity;
416}416}
@@ -459,28 +459,30 @@
459 return res;459 return res;
460}460}
461461
462void Planet::computePosition(const double dateJD)462void Planet::computePosition(const double dateJDE)
463{463{
464 // Make sure the parent position is computed for the dateJD, otherwise464 // Make sure the parent position is computed for the dateJD, otherwise
465 // getHeliocentricPos() would return incorect values.465 // getHeliocentricPos() would return incorect values.
466 if (parent)466 if (parent)
467 parent->computePositionWithoutOrbits(dateJD);467 parent->computePositionWithoutOrbits(dateJDE);
468468
469 if (orbitFader.getInterstate()>0.000001 && deltaOrbitJD > 0 && (fabs(lastOrbitJD-dateJD)>deltaOrbitJD || !orbitCached))469 if (orbitFader.getInterstate()>0.000001 && deltaOrbitJDE > 0 && (fabs(lastOrbitJDE-dateJDE)>deltaOrbitJDE || !orbitCached))
470 {470 {
471 StelCore *core=StelApp::getInstance().getCore();
472
471 double calc_date;473 double calc_date;
472 // int delta_points = (int)(0.5 + (date - lastOrbitJD)/date_increment);474 // int delta_points = (int)(0.5 + (date - lastOrbitJD)/date_increment);
473 int delta_points;475 int delta_points;
474476
475 if( dateJD > lastOrbitJD )477 if( dateJDE > lastOrbitJDE )
476 {478 {
477 delta_points = (int)(0.5 + (dateJD - lastOrbitJD)/deltaOrbitJD);479 delta_points = (int)(0.5 + (dateJDE - lastOrbitJDE)/deltaOrbitJDE);
478 }480 }
479 else481 else
480 {482 {
481 delta_points = (int)(-0.5 + (dateJD - lastOrbitJD)/deltaOrbitJD);483 delta_points = (int)(-0.5 + (dateJDE - lastOrbitJDE)/deltaOrbitJDE);
482 }484 }
483 double new_date = lastOrbitJD + delta_points*deltaOrbitJD;485 double new_date = lastOrbitJDE + delta_points*deltaOrbitJDE;
484486
485 // qDebug( "Updating orbit coordinates for %s (delta %f) (%d points)\n", getEnglishName().toUtf8().data(), deltaOrbitJD, delta_points);487 // qDebug( "Updating orbit coordinates for %s (delta %f) (%d points)\n", getEnglishName().toUtf8().data(), deltaOrbitJD, delta_points);
486488
@@ -492,13 +494,13 @@
492 if(d + delta_points >= ORBIT_SEGMENTS )494 if(d + delta_points >= ORBIT_SEGMENTS )
493 {495 {
494 // calculate new points496 // calculate new points
495 calc_date = new_date + (d-ORBIT_SEGMENTS/2)*deltaOrbitJD;497 calc_date = new_date + (d-ORBIT_SEGMENTS/2)*deltaOrbitJDE;
496498
497 // date increments between points will not be completely constant though499 // date increments between points will not be completely constant though
498 computeTransMatrix(calc_date);500 computeTransMatrix(calc_date-core->computeDeltaT(calc_date)/86400.0, calc_date);
499 if (osculatingFunc)501 if (osculatingFunc)
500 {502 {
501 (*osculatingFunc)(dateJD,calc_date,eclipticPos);503 (*osculatingFunc)(dateJDE,calc_date,eclipticPos);
502 }504 }
503 else505 else
504 {506 {
@@ -514,7 +516,7 @@
514 }516 }
515 }517 }
516518
517 lastOrbitJD = new_date;519 lastOrbitJDE = new_date;
518 }520 }
519 else if( delta_points < 0 && abs(delta_points) < ORBIT_SEGMENTS && orbitCached)521 else if( delta_points < 0 && abs(delta_points) < ORBIT_SEGMENTS && orbitCached)
520 {522 {
@@ -524,11 +526,11 @@
524 if(d + delta_points < 0 )526 if(d + delta_points < 0 )
525 {527 {
526 // calculate new points528 // calculate new points
527 calc_date = new_date + (d-ORBIT_SEGMENTS/2)*deltaOrbitJD;529 calc_date = new_date + (d-ORBIT_SEGMENTS/2)*deltaOrbitJDE;
528530
529 computeTransMatrix(calc_date);531 computeTransMatrix(calc_date-core->computeDeltaT(calc_date)/86400.0, calc_date);
530 if (osculatingFunc) {532 if (osculatingFunc) {
531 (*osculatingFunc)(dateJD,calc_date,eclipticPos);533 (*osculatingFunc)(dateJDE,calc_date,eclipticPos);
532 }534 }
533 else535 else
534 {536 {
@@ -544,7 +546,7 @@
544 }546 }
545 }547 }
546548
547 lastOrbitJD = new_date;549 lastOrbitJDE = new_date;
548550
549 }551 }
550 else if( delta_points || !orbitCached)552 else if( delta_points || !orbitCached)
@@ -553,11 +555,11 @@
553 // update all points (less efficient)555 // update all points (less efficient)
554 for( int d=0; d<ORBIT_SEGMENTS; d++ )556 for( int d=0; d<ORBIT_SEGMENTS; d++ )
555 {557 {
556 calc_date = dateJD + (d-ORBIT_SEGMENTS/2)*deltaOrbitJD;558 calc_date = dateJDE + (d-ORBIT_SEGMENTS/2)*deltaOrbitJDE;
557 computeTransMatrix(calc_date);559 computeTransMatrix(calc_date-core->computeDeltaT(calc_date)/86400.0, calc_date);
558 if (osculatingFunc)560 if (osculatingFunc)
559 {561 {
560 (*osculatingFunc)(dateJD,calc_date,eclipticPos);562 (*osculatingFunc)(dateJDE,calc_date,eclipticPos);
561 }563 }
562 else564 else
563 {565 {
@@ -567,36 +569,36 @@
567 orbit[d] = getHeliocentricEclipticPos();569 orbit[d] = getHeliocentricEclipticPos();
568 }570 }
569571
570 lastOrbitJD = dateJD;572 lastOrbitJDE = dateJDE;
571 if (!osculatingFunc) orbitCached = 1;573 if (!osculatingFunc) orbitCached = 1;
572 }574 }
573575
574576
575 // calculate actual Planet position577 // calculate actual Planet position
576 coordFunc(dateJD, eclipticPos, userDataPtr);578 coordFunc(dateJDE, eclipticPos, userDataPtr);
577579
578 lastJD = dateJD;580 lastJDE = dateJDE;
579581
580 }582 }
581 else if (fabs(lastJD-dateJD)>deltaJD)583 else if (fabs(lastJDE-dateJDE)>deltaJDE)
582 {584 {
583 // calculate actual Planet position585 // calculate actual Planet position
584 coordFunc(dateJD, eclipticPos, userDataPtr);586 coordFunc(dateJDE, eclipticPos, userDataPtr);
585 // XXX: do we need to do that even when the orbit is not visible?587 // XXX: do we need to do that even when the orbit is not visible?
586 for( int d=0; d<ORBIT_SEGMENTS; d++ )588 for( int d=0; d<ORBIT_SEGMENTS; d++ )
587 orbit[d]=getHeliocentricPos(orbitP[d]);589 orbit[d]=getHeliocentricPos(orbitP[d]);
588 lastJD = dateJD;590 lastJDE = dateJDE;
589 }591 }
590592
591}593}
592594
593// Compute the transformation matrix from the local Planet coordinate system to the parent Planet coordinate system.595// Compute the transformation matrix from the local Planet coordinate system to the parent Planet coordinate system.
594// In case of the planets, this makes the axis point to the respective celestial pole.596// In case of the planets, this makes the axis point to their respective celestial poles.
595// TODO: Verify for the other planets if their axes are relative to J2000 ecliptic (VSOP87A XY plane) or relative to (precessed) ecliptic of date?597// TODO: Verify for the other planets if their axes are relative to J2000 ecliptic (VSOP87A XY plane) or relative to (precessed) ecliptic of date?
596void Planet::computeTransMatrix(double jd)598void Planet::computeTransMatrix(double JD, double JDE)
597{599{
598 // TODO: correct this for earth with the new model.600 // We have to call with both to correct this for earth with the new model.
599 axisRotation = getSiderealTime(jd);601 axisRotation = getSiderealTime(JD, JDE);
600602
601 // Special case - heliocentric coordinates are relative to eclipticJ2000 (VSOP87A XY plane),603 // Special case - heliocentric coordinates are relative to eclipticJ2000 (VSOP87A XY plane),
602 // not solar equator...604 // not solar equator...
@@ -611,7 +613,7 @@
611 // ADS: 2011A&A...534A..22V = A&A 534, A22 (2011): Vondrak, Capitane, Wallace: New Precession Expressions, valid for long time intervals:613 // ADS: 2011A&A...534A..22V = A&A 534, A22 (2011): Vondrak, Capitane, Wallace: New Precession Expressions, valid for long time intervals:
612 // See also Hilton et al, Report on Precession and the Ecliptic. Cel.Mech.Dyn.Astr. 94:351-367 (2006).614 // See also Hilton et al, Report on Precession and the Ecliptic. Cel.Mech.Dyn.Astr. 94:351-367 (2006).
613 double eps_A, chi_A, omega_A, psi_A;615 double eps_A, chi_A, omega_A, psi_A;
614 getPrecessionAnglesVondrak(jd, &eps_A, &chi_A, &omega_A, &psi_A);616 getPrecessionAnglesVondrak(JDE, &eps_A, &chi_A, &omega_A, &psi_A);
615 // GZ This is the right combination for precession of the equator: Nodal rotation psi_A,617 // GZ This is the right combination for precession of the equator: Nodal rotation psi_A,
616 // then rotation by omega_A, the angle between EclPoleJ2000 and EarthPoleOfDate.618 // then rotation by omega_A, the angle between EclPoleJ2000 and EarthPoleOfDate.
617 // The final rotation by chi_A rotates the equinox (zero degree).619 // The final rotation by chi_A rotates the equinox (zero degree).
@@ -619,7 +621,7 @@
619 rotLocalToParent= Mat4d::zrotation(-psi_A) * Mat4d::xrotation(-omega_A) * Mat4d::zrotation(chi_A);621 rotLocalToParent= Mat4d::zrotation(-psi_A) * Mat4d::xrotation(-omega_A) * Mat4d::zrotation(chi_A);
620 }622 }
621 else623 else
622 rotLocalToParent = Mat4d::zrotation(re.ascendingNode - re.precessionRate*(jd-re.epoch)) * Mat4d::xrotation(re.obliquity);624 rotLocalToParent = Mat4d::zrotation(re.ascendingNode - re.precessionRate*(JDE-re.epoch)) * Mat4d::xrotation(re.obliquity);
623 }625 }
624}626}
625627
@@ -646,15 +648,16 @@
646}648}
647649
648650
649// Compute the z rotation to use from equatorial to geographic coordinates651// Compute the z rotation to use from equatorial to geographic coordinates.
650double Planet::getSiderealTime(double jd) const652// We need both JD and JDE here: For Earth we use JD(UT), for other planets JDE(TT).
653double Planet::getSiderealTime(double JD, double JDE) const
651{654{
652 if (englishName=="Earth")655 if (englishName=="Earth")
653 { // GZ I wanted to be sure that nutation is just those ignorable few arcseconds.656 { // GZ I wanted to be sure that nutation is just those ignorable few arcseconds.
654 //qDebug() << "Difference apparent-mean sidereal times (s): " << (get_apparent_sidereal_time(jd)- get_mean_sidereal_time(jd))* 240.0; // 1degree=4min=240s.657 //qDebug() << "Difference apparent-mean sidereal times (s): " << (get_apparent_sidereal_time(jd)- get_mean_sidereal_time(jd))* 240.0; // 1degree=4min=240s.
655 // TODO: Reactivate Nutation (but following IAU-2000A) after fixing JD_UT/JD_ET issues, then change this call back to apparent_sidereal_time.658 // TODO: Reactivate Nutation (but following IAU-2000A) after fixing JD_UT/JD_ET issues, then change this call back to apparent_sidereal_time.
656 //return get_apparent_sidereal_time(jd);659 //return get_apparent_sidereal_time(jd);
657 return get_mean_sidereal_time(jd);660 return get_mean_sidereal_time(JD);
658661
659 // In the newer precession/nutation literature (starting around 2006) there are two sets of algorithms:662 // In the newer precession/nutation literature (starting around 2006) there are two sets of algorithms:
660 // "Classical" sidereal time (Greenwich hour angle GHA) and a solution based on Earth Rotational Angle ERA.663 // "Classical" sidereal time (Greenwich hour angle GHA) and a solution based on Earth Rotational Angle ERA.
@@ -663,7 +666,7 @@
663666
664 }667 }
665668
666 double t = jd - re.epoch;669 double t = JDE - re.epoch;
667 // oops... avoid division by zero (typical case for moons with chaotic period of rotation)670 // oops... avoid division by zero (typical case for moons with chaotic period of rotation)
668 double rotations = 1.f; // NOTE: Maybe 1e-3 will be better?671 double rotations = 1.f; // NOTE: Maybe 1e-3 will be better?
669 if (re.period!=0.) // OK, it's not a moon with chaotic period of rotation :)672 if (re.period!=0.) // OK, it's not a moon with chaotic period of rotation :)
@@ -679,24 +682,24 @@
679 {682 {
680 // use semi-empirical coefficient for GRS drift683 // use semi-empirical coefficient for GRS drift
681 // qDebug() << "Jupiter: offset = " << re.offset << " --> rotation = " << (remainder * 360. + re.offset - 0.2483 * qAbs(jd - 2456172));684 // qDebug() << "Jupiter: offset = " << re.offset << " --> rotation = " << (remainder * 360. + re.offset - 0.2483 * qAbs(jd - 2456172));
682 return remainder * 360. + re.offset - 0.2483 * qAbs(jd - 2456172);685 return remainder * 360. + re.offset - 0.2483 * qAbs(JDE - 2456172);
683 }686 }
684 else687 else
685 {688 {
686 // http://www.projectpluto.com/grs_form.htm689 // http://www.projectpluto.com/grs_form.htm
687 // CM( System II) = 181.62 + 870.1869147 * jd + correction [870d rotation every day]690 // CM( System II) = 181.62 + 870.1869147 * jd + correction [870d rotation every day]
688 const double rad = M_PI/180.;691 const double rad = M_PI/180.;
689 double jup_mean = (jd - 2455636.938) * 360. / 4332.89709;692 double jup_mean = (JDE - 2455636.938) * 360. / 4332.89709;
690 double eqn_center = 5.55 * sin( rad*jup_mean);693 double eqn_center = 5.55 * sin( rad*jup_mean);
691 double angle = (jd - 2451870.628) * 360. / 398.884 - eqn_center;694 double angle = (JDE - 2451870.628) * 360. / 398.884 - eqn_center;
692 //double correction = 11 * sin( rad*angle) + 5 * cos( rad*angle)- 1.25 * cos( rad*jup_mean) - eqn_center; // original correction695 //double correction = 11 * sin( rad*angle) + 5 * cos( rad*angle)- 1.25 * cos( rad*jup_mean) - eqn_center; // original correction
693 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 that696 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
694 double cm2=181.62 + 870.1869147 * jd + correction;697 double cm2=181.62 + 870.1869147 * JDE + correction; // Central Meridian II
695 cm2=cm2 - 360.0*(int)(cm2/360.);698 cm2=cm2 - 360.0*(int)(cm2/360.);
696 // http://www.skyandtelescope.com/observing/transit-times-of-jupiters-great-red-spot/ writes:699 // http://www.skyandtelescope.com/observing/transit-times-of-jupiters-great-red-spot/ writes:
697 // 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.700 // 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.
698 // GRS longitude was at 2014-09-08 216d with a drift of 1.25d every month701 // GRS longitude was at 2014-09-08 216d with a drift of 1.25d every month
699 double longitudeGRS=216+1.25*( jd - 2456908)/30;702 double longitudeGRS=216+1.25*( JDE - 2456908)/30;
700 // qDebug() << "Jupiter: CM2 = " << cm2 << " longitudeGRS = " << longitudeGRS << " --> rotation = " << (cm2 - longitudeGRS);703 // qDebug() << "Jupiter: CM2 = " << cm2 << " longitudeGRS = " << longitudeGRS << " --> rotation = " << (cm2 - longitudeGRS);
701 return cm2 - longitudeGRS + 25.; // + 25 = Jupiter Texture not 0d704 return cm2 - longitudeGRS + 25.; // + 25 = Jupiter Texture not 0d
702 // To verify:705 // To verify:
@@ -799,7 +802,7 @@
799 distance = (obsHelioPos-getHeliocentricEclipticPos()).length();802 distance = (obsHelioPos-getHeliocentricEclipticPos()).length();
800 // improve fps by juggling updates for asteroids. They must be fast if close to observer, but can be slow if further away.803 // improve fps by juggling updates for asteroids. They must be fast if close to observer, but can be slow if further away.
801 if (pType == Planet::isAsteroid)804 if (pType == Planet::isAsteroid)
802 deltaJD=distance*StelCore::JD_SECOND;805 deltaJDE=distance*StelCore::JD_SECOND;
803 return distance;806 return distance;
804}807}
805808
@@ -929,8 +932,8 @@
929 {932 {
930 // add rings computation933 // add rings computation
931 // implemented from Meeus, Astr.Alg.1992934 // implemented from Meeus, Astr.Alg.1992
932 const double jd=core->getJDay();935 const double jde=core->getJDE();
933 const double T=(jd-2451545.0)/36525.0;936 const double T=(jde-2451545.0)/36525.0;
934 const double i=((0.000004*T-0.012998)*T+28.075216)*M_PI/180.0;937 const double i=((0.000004*T-0.012998)*T+28.075216)*M_PI/180.0;
935 const double Omega=((0.000412*T+1.394681)*T+169.508470)*M_PI/180.0;938 const double Omega=((0.000412*T+1.394681)*T+169.508470)*M_PI/180.0;
936 static SolarSystem *ssystem=GETSTELMODULE(SolarSystem);939 static SolarSystem *ssystem=GETSTELMODULE(SolarSystem);
@@ -968,8 +971,8 @@
968 {971 {
969 // add rings computation972 // add rings computation
970 // implemented from Meeus, Astr.Alg.1992973 // implemented from Meeus, Astr.Alg.1992
971 const double jd=core->getJDay();974 const double jde=core->getJDE();
972 const double T=(jd-2451545.0)/36525.0;975 const double T=(jde-2451545.0)/36525.0;
973 const double i=((0.000004*T-0.012998)*T+28.075216)*M_PI/180.0;976 const double i=((0.000004*T-0.012998)*T+28.075216)*M_PI/180.0;
974 const double Omega=((0.000412*T+1.394681)*T+169.508470)*M_PI/180.0;977 const double Omega=((0.000412*T+1.394681)*T+169.508470)*M_PI/180.0;
975 SolarSystem *ssystem=GETSTELMODULE(SolarSystem);978 SolarSystem *ssystem=GETSTELMODULE(SolarSystem);
@@ -1006,8 +1009,8 @@
1006 {1009 {
1007 // add rings computation1010 // add rings computation
1008 // implemented from Meeus, Astr.Alg.19921011 // implemented from Meeus, Astr.Alg.1992
1009 const double jd=core->getJDay();1012 const double jde=core->getJDE();
1010 const double T=(jd-2451545.0)/36525.0;1013 const double T=(jde-2451545.0)/36525.0;
1011 const double i=((0.000004*T-0.012998)*T+28.075216)*M_PI/180.0;1014 const double i=((0.000004*T-0.012998)*T+28.075216)*M_PI/180.0;
1012 const double Omega=((0.000412*T+1.394681)*T+169.508470)*M_PI/180.0;1015 const double Omega=((0.000412*T+1.394681)*T+169.508470)*M_PI/180.0;
1013 static SolarSystem *ssystem=GETSTELMODULE(SolarSystem);1016 static SolarSystem *ssystem=GETSTELMODULE(SolarSystem);
10141017
=== modified file 'src/core/modules/Planet.hpp'
--- src/core/modules/Planet.hpp 2015-07-27 13:25:39 +0000
+++ src/core/modules/Planet.hpp 2015-08-03 13:17:13 +0000
@@ -33,7 +33,7 @@
33// The last variable is the userData pointer.33// The last variable is the userData pointer.
34typedef void (*posFuncType)(double, double*, void*);34typedef void (*posFuncType)(double, double*, void*);
3535
36typedef void (OsculatingFunctType)(double jd0,double jd,double xyz[3]);36typedef void (OsculatingFunctType)(double jde0,double jde,double xyz[3]);
3737
38// epoch J2000: 12 UT on 1 Jan 200038// epoch J2000: 12 UT on 1 Jan 2000
39#define J2000 2451545.039#define J2000 2451545.0
@@ -51,7 +51,7 @@
51 RotationElements(void) : period(1.), offset(0.), epoch(J2000), obliquity(0.), ascendingNode(0.), precessionRate(0.), siderealPeriod(0.) {}51 RotationElements(void) : period(1.), offset(0.), epoch(J2000), obliquity(0.), ascendingNode(0.), precessionRate(0.), siderealPeriod(0.) {}
52 float period; // (sidereal) rotation period [earth days]52 float period; // (sidereal) rotation period [earth days]
53 float offset; // rotation at epoch [degrees]53 float offset; // rotation at epoch [degrees]
54 double epoch; // JD (TD) of epoch for these elements54 double epoch; // JDE (JD TT) of epoch for these elements
55 float obliquity; // tilt of rotation axis w.r.t. ecliptic [radians]55 float obliquity; // tilt of rotation axis w.r.t. ecliptic [radians]
56 float ascendingNode; // long. of ascending node of equator on the ecliptic [radians]56 float ascendingNode; // long. of ascending node of equator on the ecliptic [radians]
57 float precessionRate; // rate of precession of rotation axis in [rads/JulianCentury(36525d)]57 float precessionRate; // rate of precession of rotation axis in [rads/JulianCentury(36525d)]
@@ -192,20 +192,22 @@
192 const QString getApparentMagnitudeAlgorithmString() const { return vMagAlgorithmMap.value(vMagAlgorithm); }192 const QString getApparentMagnitudeAlgorithmString() const { return vMagAlgorithmMap.value(vMagAlgorithm); }
193 void setApparentMagnitudeAlgorithm(QString algorithm);193 void setApparentMagnitudeAlgorithm(QString algorithm);
194194
195 // Compute the z rotation to use from equatorial to geographic coordinates195 //! Compute the z rotation to use from equatorial to geographic coordinates. For general applicability we need both time flavours:
196 double getSiderealTime(double jd) const;196 //! @param JD is JD(UT) for Earth
197 //! @param JDE is used for other locations
198 double getSiderealTime(double JD, double JDE) const;
197 Mat4d getRotEquatorialToVsop87(void) const;199 Mat4d getRotEquatorialToVsop87(void) const;
198 void setRotEquatorialToVsop87(const Mat4d &m);200 void setRotEquatorialToVsop87(const Mat4d &m);
199201
200 const RotationElements &getRotationElements(void) const {return re;}202 const RotationElements &getRotationElements(void) const {return re;}
201203
202 // Compute the position in the parent Planet coordinate system204 // Compute the position in the parent Planet coordinate system
203 void computePositionWithoutOrbits(const double dateJD);205 void computePositionWithoutOrbits(const double dateJDE);
204 //virtual void computePosition(const double dateJD);// GZ: gets overridden in Comet!206 void computePosition(const double dateJDE);
205 void computePosition(const double dateJD);// GZ: gets overridden in Comet!
206207
207 // Compute the transformation matrix from the local Planet coordinate to the parent Planet coordinate208 // Compute the transformation matrix from the local Planet coordinate to the parent Planet coordinate.
208 void computeTransMatrix(double date);209 // This requires both flavours of JD in cases involving Earth.
210 void computeTransMatrix(double JD, double JDE);
209211
210 // Get the phase angle (rad) for an observer at pos obsPos in heliocentric coordinates (in AU)212 // Get the phase angle (rad) for an observer at pos obsPos in heliocentric coordinates (in AU)
211 double getPhaseAngle(const Vec3d& obsPos) const;213 double getPhaseAngle(const Vec3d& obsPos) const;
@@ -223,7 +225,7 @@
223 double getRotAscendingnode(void) const {return re.ascendingNode;}225 double getRotAscendingnode(void) const {return re.ascendingNode;}
224 // return angle between axis and normal of ecliptic plane (or, for a moon, equatorial/reference plane defined by parent).226 // return angle between axis and normal of ecliptic plane (or, for a moon, equatorial/reference plane defined by parent).
225 // TODO: decide if this is always angle between axis and J2000 ecliptic, or should be axis//current ecliptic!227 // TODO: decide if this is always angle between axis and J2000 ecliptic, or should be axis//current ecliptic!
226 double getRotObliquity(double JDay) const;228 double getRotObliquity(double JDE) const;
227229
228 //! Get the Planet position in the parent Planet ecliptic coordinate in AU230 //! Get the Planet position in the parent Planet ecliptic coordinate in AU
229 Vec3d getEclipticPos() const;231 Vec3d getEclipticPos() const;
@@ -277,9 +279,9 @@
277 void drawOrbit(const StelCore*);279 void drawOrbit(const StelCore*);
278 Vec3d orbit[ORBIT_SEGMENTS+1]; // store heliocentric coordinates for drawing the orbit280 Vec3d orbit[ORBIT_SEGMENTS+1]; // store heliocentric coordinates for drawing the orbit
279 Vec3d orbitP[ORBIT_SEGMENTS+1]; // store local coordinate for orbit281 Vec3d orbitP[ORBIT_SEGMENTS+1]; // store local coordinate for orbit
280 double lastOrbitJD;282 double lastOrbitJDE;
281 double deltaJD; // time difference between positional updates.283 double deltaJDE; // time difference between positional updates.
282 double deltaOrbitJD;284 double deltaOrbitJDE;
283 bool orbitCached; // whether orbit calculations are cached for drawing orbit yet285 bool orbitCached; // whether orbit calculations are cached for drawing orbit yet
284 bool closeOrbit; // whether to connect the beginning of the orbit line to286 bool closeOrbit; // whether to connect the beginning of the orbit line to
285 // the end: good for elliptical orbits, bad for parabolic287 // the end: good for elliptical orbits, bad for parabolic
@@ -336,8 +338,8 @@
336 double distance; // Temporary variable used to store the distance to a given point338 double distance; // Temporary variable used to store the distance to a given point
337 // it is used for sorting while drawing339 // it is used for sorting while drawing
338 float sphereScale; // Artificial scaling for better viewing340 float sphereScale; // Artificial scaling for better viewing
339 double lastJD; // caches JD of last positional computation341 double lastJDE; // caches JDE of last positional computation
340 // The callback for the calculation of the equatorial rect heliocentric position at time JD.342 // The callback for the calculation of the equatorial rect heliocentric position at time JDE.
341 posFuncType coordFunc;343 posFuncType coordFunc;
342 void* userDataPtr; // this is always used with an Orbit object.344 void* userDataPtr; // this is always used with an Orbit object.
343345
344346
=== modified file 'src/core/modules/SolarSystem.cpp'
--- src/core/modules/SolarSystem.cpp 2015-07-27 14:57:16 +0000
+++ src/core/modules/SolarSystem.cpp 2015-08-03 13:17:13 +0000
@@ -1024,47 +1024,49 @@
10241024
1025// Compute the position for every elements of the solar system.1025// Compute the position for every elements of the solar system.
1026// The order is not important since the position is computed relatively to the mother body1026// The order is not important since the position is computed relatively to the mother body
1027void SolarSystem::computePositions(double date, const Vec3d& observerPos)1027void SolarSystem::computePositions(double dateJDE, const Vec3d& observerPos)
1028{1028{
1029 if (flagLightTravelTime)1029 if (flagLightTravelTime)
1030 {1030 {
1031 foreach (PlanetP p, systemPlanets)1031 foreach (PlanetP p, systemPlanets)
1032 {1032 {
1033 p->computePositionWithoutOrbits(date);1033 p->computePositionWithoutOrbits(dateJDE);
1034 }1034 }
1035 foreach (PlanetP p, systemPlanets)1035 foreach (PlanetP p, systemPlanets)
1036 {1036 {
1037 const double light_speed_correction = (p->getHeliocentricEclipticPos()-observerPos).length() * (AU / (SPEED_OF_LIGHT * 86400));1037 const double light_speed_correction = (p->getHeliocentricEclipticPos()-observerPos).length() * (AU / (SPEED_OF_LIGHT * 86400));
1038 p->computePosition(date-light_speed_correction);1038 p->computePosition(dateJDE-light_speed_correction);
1039 }1039 }
1040 }1040 }
1041 else1041 else
1042 {1042 {
1043 foreach (PlanetP p, systemPlanets)1043 foreach (PlanetP p, systemPlanets)
1044 {1044 {
1045 p->computePosition(date);1045 p->computePosition(dateJDE);
1046 }1046 }
1047 }1047 }
1048 computeTransMatrices(date, observerPos);1048 computeTransMatrices(dateJDE, observerPos);
1049}1049}
10501050
1051// Compute the transformation matrix for every elements of the solar system.1051// Compute the transformation matrix for every elements of the solar system.
1052// The elements have to be ordered hierarchically, eg. it's important to compute earth before moon.1052// The elements have to be ordered hierarchically, eg. it's important to compute earth before moon.
1053void SolarSystem::computeTransMatrices(double date, const Vec3d& observerPos)1053void SolarSystem::computeTransMatrices(double dateJDE, const Vec3d& observerPos)
1054{1054{
1055 double dateJD=dateJDE - (StelApp::getInstance().getCore()->computeDeltaT(dateJDE))/86400.0;
1056
1055 if (flagLightTravelTime)1057 if (flagLightTravelTime)
1056 {1058 {
1057 foreach (PlanetP p, systemPlanets)1059 foreach (PlanetP p, systemPlanets)
1058 {1060 {
1059 const double light_speed_correction = (p->getHeliocentricEclipticPos()-observerPos).length() * (AU / (SPEED_OF_LIGHT * 86400));1061 const double light_speed_correction = (p->getHeliocentricEclipticPos()-observerPos).length() * (AU / (SPEED_OF_LIGHT * 86400));
1060 p->computeTransMatrix(date-light_speed_correction);1062 p->computeTransMatrix(dateJD-light_speed_correction, dateJDE-light_speed_correction);
1061 }1063 }
1062 }1064 }
1063 else1065 else
1064 {1066 {
1065 foreach (PlanetP p, systemPlanets)1067 foreach (PlanetP p, systemPlanets)
1066 {1068 {
1067 p->computeTransMatrix(date);1069 p->computeTransMatrix(dateJD, dateJDE);
1068 }1070 }
1069 }1071 }
1070}1072}
10711073
=== modified file 'src/core/modules/SolarSystem.hpp'
--- src/core/modules/SolarSystem.hpp 2015-07-05 19:48:33 +0000
+++ src/core/modules/SolarSystem.hpp 2015-08-03 13:17:13 +0000
@@ -342,9 +342,9 @@
342342
343 //! Compute the position and transform matrix for every element of the solar system.343 //! Compute the position and transform matrix for every element of the solar system.
344 //! @param observerPos Position of the observer in heliocentric ecliptic frame (Required for light travel time computation).344 //! @param observerPos Position of the observer in heliocentric ecliptic frame (Required for light travel time computation).
345 //! @param date the date in JDay345 //! @param dateJDE the Julian Day in JDE (Ephemeris Time or equivalent)
346 //! \deprecated ??? In the "deprecated" section, but used in SolarSystem::init()346 //! \deprecated ??? In the "deprecated" section, but used in SolarSystem::init()
347 void computePositions(double date, const Vec3d& observerPos = Vec3d(0.));347 void computePositions(double dateJDE, const Vec3d& observerPos = Vec3d(0.));
348348
349 //! Get the list of all the bodies of the solar system.349 //! Get the list of all the bodies of the solar system.
350 //! \deprecated Used in LandscapeMgr::update(), but commented out.350 //! \deprecated Used in LandscapeMgr::update(), but commented out.
@@ -372,7 +372,7 @@
372372
373 //! Compute the transformation matrix for every elements of the solar system.373 //! Compute the transformation matrix for every elements of the solar system.
374 //! observerPos is needed for light travel time computation.374 //! observerPos is needed for light travel time computation.
375 void computeTransMatrices(double date, const Vec3d& observerPos = Vec3d(0.));375 void computeTransMatrices(double dateJDE, const Vec3d& observerPos = Vec3d(0.));
376376
377 //! Draw a nice animated pointer around the object.377 //! Draw a nice animated pointer around the object.
378 void drawPointer(const StelCore* core);378 void drawPointer(const StelCore* core);
379379
=== modified file 'src/core/modules/StarWrapper.cpp'
--- src/core/modules/StarWrapper.cpp 2015-06-12 18:45:39 +0000
+++ src/core/modules/StarWrapper.cpp 2015-08-03 13:17:13 +0000
@@ -247,7 +247,7 @@
247 {247 {
248 // Calculate next minimum or maximum light248 // Calculate next minimum or maximum light
249 double vsEpoch = 2400000+vEpoch;249 double vsEpoch = 2400000+vEpoch;
250 double npDate = vsEpoch + vPeriod * ::floor(1.0 + (core->getJDay() - vsEpoch)/vPeriod);250 double npDate = vsEpoch + vPeriod * ::floor(1.0 + (core->getJDE() - vsEpoch)/vPeriod);
251 QString nextDate = StelUtils::julianDayToISO8601String(npDate).replace("T", " ");251 QString nextDate = StelUtils::julianDayToISO8601String(npDate).replace("T", " ");
252 if (ebsFlag)252 if (ebsFlag)
253 oss << q_("Next minimum light: %1 UTC").arg(nextDate) << "<br />";253 oss << q_("Next minimum light: %1 UTC").arg(nextDate) << "<br />";
254254
=== modified file 'src/core/modules/StarWrapper.hpp'
--- src/core/modules/StarWrapper.hpp 2015-01-02 16:18:33 +0000
+++ src/core/modules/StarWrapper.hpp 2015-08-03 13:17:13 +0000
@@ -77,7 +77,7 @@
77 {77 {
78 static const double d2000 = 2451545.0;78 static const double d2000 = 2451545.0;
79 Vec3f v;79 Vec3f v;
80 s->getJ2000Pos(z, (M_PI/180.)*(0.0001/3600.) * ((core->getJDay()-d2000)/365.25) / a->star_position_scale, v);80 s->getJ2000Pos(z, (M_PI/180.)*(0.0001/3600.) * ((core->getJDE()-d2000)/365.25) / a->star_position_scale, v);
81 return Vec3d(v[0], v[1], v[2]);81 return Vec3d(v[0], v[1], v[2]);
82 }82 }
83 Vec3f getInfoColor(void) const83 Vec3f getInfoColor(void) const
8484
=== modified file 'src/core/modules/ZodiacalLight.cpp'
--- src/core/modules/ZodiacalLight.cpp 2015-06-30 18:34:14 +0000
+++ src/core/modules/ZodiacalLight.cpp 2015-08-03 13:17:13 +0000
@@ -93,7 +93,7 @@
93 // Test if we are not on Earth. Texture would not fit, so don't draw then.93 // Test if we are not on Earth. Texture would not fit, so don't draw then.
94 if (core->getCurrentLocation().planetName != "Earth") return;94 if (core->getCurrentLocation().planetName != "Earth") return;
9595
96 double currentJD=core->getJDay();96 double currentJD=core->getJD();
97 if (qAbs(currentJD - lastJD) > 0.25f) // should be enough to update position every 6 hours.97 if (qAbs(currentJD - lastJD) > 0.25f) // should be enough to update position every 6 hours.
98 {98 {
99 // update vertices99 // update vertices
100100
=== modified file 'src/core/modules/ZoneArray.cpp'
--- src/core/modules/ZoneArray.cpp 2015-02-08 15:35:27 +0000
+++ src/core/modules/ZoneArray.cpp 2015-08-03 13:17:13 +0000
@@ -467,7 +467,7 @@
467 StelSkyDrawer* drawer = core->getSkyDrawer();467 StelSkyDrawer* drawer = core->getSkyDrawer();
468 Vec3f vf;468 Vec3f vf;
469 static const double d2000 = 2451545.0;469 static const double d2000 = 2451545.0;
470 const float movementFactor = (M_PI/180)*(0.0001/3600) * ((core->getJDay()-d2000)/365.25) / star_position_scale;470 const float movementFactor = (M_PI/180)*(0.0001/3600) * ((core->getJDE()-d2000)/365.25) / star_position_scale;
471471
472 // GZ, added for extinction472 // GZ, added for extinction
473 const Extinction& extinction=core->getSkyDrawer()->getExtinction();473 const Extinction& extinction=core->getSkyDrawer()->getExtinction();
@@ -549,7 +549,7 @@
549 QList<StelObjectP > &result)549 QList<StelObjectP > &result)
550{550{
551 static const double d2000 = 2451545.0;551 static const double d2000 = 2451545.0;
552 const double movementFactor = (M_PI/180.)*(0.0001/3600.) * ((core->getJDay()-d2000)/365.25)/ star_position_scale;552 const double movementFactor = (M_PI/180.)*(0.0001/3600.) * ((core->getJDE()-d2000)/365.25)/ star_position_scale;
553 const SpecialZoneData<Star> *const z = getZones()+index;553 const SpecialZoneData<Star> *const z = getZones()+index;
554 Vec3f tmp;554 Vec3f tmp;
555 Vec3f vf(v[0], v[1], v[2]);555 Vec3f vf(v[0], v[1], v[2]);
556556
=== modified file 'src/core/planetsephems/sidereal_time.c'
--- src/core/planetsephems/sidereal_time.c 2015-07-27 11:16:32 +0000
+++ src/core/planetsephems/sidereal_time.c 2015-08-03 13:17:13 +0000
@@ -209,18 +209,18 @@
209 {-3.0, 0.0, 0.0, 0.0}};209 {-3.0, 0.0, 0.0, 0.0}};
210210
211/* cache values */211/* cache values */
212static double c_JD = 0.0, c_longitude = 0.0, c_obliquity = 0.0, c_ecliptic = 0.0; 212static double c_JDE = 0.0, c_longitude = 0.0, c_obliquity = 0.0, c_ecliptic = 0.0;
213213
214214
215/* Calculate nutation of longitude and obliquity in degrees from Julian Ephemeris Day215/* Calculate nutation of longitude and obliquity in degrees from Julian Ephemeris Day
216* params : JD Julian Day, nutation Pointer to store nutation.216* params : JDE Julian Day (ET/TT), nutation Pointer to store nutation.
217* Meeus, Astr. Alg. (1st ed., 1994), Chapter 21 pg 131-134 Using Table 21A */217* Meeus, Astr. Alg. (1st ed., 1994), Chapter 21 pg 131-134 Using Table 21A */
218/* GZ: Changed: ecliptic obliquity used to be constant J2000.0. 218/* GZ: Changed: ecliptic obliquity used to be constant J2000.0.
219 * If you don't compute this, you may as well forget about nutation!219 * If you don't compute this, you may as well forget about nutation!
220 * 2015: Laskar's 1986 formula replaced by Vondrak 2011. c_ecliptic is now epsilon_A, Vondrak's obliquity of date.220 * 2015: Laskar's 1986 formula replaced by Vondrak 2011. c_ecliptic is now epsilon_A, Vondrak's obliquity of date.
221 * TODO: replace this whole function with Nutation IAU2000A or compatible version.221 * TODO: replace this whole function with Nutation IAU2000A or compatible version.
222 */222 */
223void get_nutation (double JD, struct ln_nutation * nutation)223void get_nutation (double JDE, struct ln_nutation * nutation)
224{224{
225225
226 double D,M,MM,F,O,T;226 double D,M,MM,F,O,T;
@@ -228,16 +228,16 @@
228 int i;228 int i;
229229
230 /* should we bother recalculating nutation */230 /* should we bother recalculating nutation */
231 if (fabs(JD - c_JD) > LN_NUTATION_EPOCH_THRESHOLD)231 if (fabs(JDE - c_JDE) > LN_NUTATION_EPOCH_THRESHOLD)
232 {232 {
233 /* set the new epoch */233 /* set the new epoch */
234 c_JD = JD;234 c_JDE = JDE;
235235
236 /* set ecliptic. GZ: This is constant only, J2000.0. WRONG! */236 /* set ecliptic. GZ: This is constant only, J2000.0. WRONG! */
237 /* c_ecliptic = 23.0 + 26.0 / 60.0 + 27.407 / 3600.0; */237 /* c_ecliptic = 23.0 + 26.0 / 60.0 + 27.407 / 3600.0; */
238238
239 /* calc T */239 /* calc T */
240 T = (JD - 2451545.0)/36525;240 T = (JDE - 2451545.0)/36525;
241 /* GZotti: we don't need those. * /241 /* GZotti: we don't need those. * /
242 T2 = T * T;242 T2 = T * T;
243 T3 = T2 * T;243 T3 = T2 * T;
@@ -361,7 +361,7 @@
361/* Calculate the apparent sidereal time at the meridian of Greenwich of a given date.361/* Calculate the apparent sidereal time at the meridian of Greenwich of a given date.
362 * returns apparent sidereal time (degrees).362 * returns apparent sidereal time (degrees).
363 * Formula 11.1, 11.4 pg 83 */363 * Formula 11.1, 11.4 pg 83 */
364double get_apparent_sidereal_time (double JD)364double get_apparent_sidereal_time (double JD, double JDE)
365{365{
366 double correction, sidereal;366 double correction, sidereal;
367 struct ln_nutation nutation;367 struct ln_nutation nutation;
@@ -371,9 +371,9 @@
371 /* get the mean sidereal time */371 /* get the mean sidereal time */
372 sidereal = get_mean_sidereal_time (JD);372 sidereal = get_mean_sidereal_time (JD);
373 373
374 /* add corrections for nutation in longitude and for the true obliquity of374 /* add corrections for nutation in longitude and for the true obliquity of the ecliptic
375 the ecliptic */375 */
376 get_nutation (JD, &nutation);376 get_nutation (JDE, &nutation);
377 377
378 /* GZ: This was the only place where this was used. I added the summation here. */378 /* GZ: This was the only place where this was used. I added the summation here. */
379 correction = (nutation.deltaPsi * cos ((nutation.ecliptic+nutation.deltaEps)*M_PI/180.));379 correction = (nutation.deltaPsi * cos ((nutation.ecliptic+nutation.deltaEps)*M_PI/180.));
380380
=== modified file 'src/core/planetsephems/sidereal_time.h'
--- src/core/planetsephems/sidereal_time.h 2014-02-05 17:01:25 +0000
+++ src/core/planetsephems/sidereal_time.h 2015-08-03 13:17:13 +0000
@@ -28,8 +28,8 @@
28/* Calculate mean sidereal time from date. */28/* Calculate mean sidereal time from date. */
29double get_mean_sidereal_time (double JD);29double get_mean_sidereal_time (double JD);
3030
31/* Calculate apparent sidereal time from date.*/31/* Calculate apparent sidereal time from date. We need JD(UT) and JDE(TT) here to accurately compute nutation. */
32double get_apparent_sidereal_time (double JD);32double get_apparent_sidereal_time (double JD, double JDE);
33/* Calculate mean ecliptical obliquity in degrees. */33/* Calculate mean ecliptical obliquity in degrees. */
34double get_mean_ecliptical_obliquity(double JDE);34double get_mean_ecliptical_obliquity(double JDE);
35/* Calculate nutation in longitude in degrees. */35/* Calculate nutation in longitude in degrees. */
3636
=== modified file 'src/gui/ConfigurationDialog.cpp'
--- src/gui/ConfigurationDialog.cpp 2015-07-27 14:57:16 +0000
+++ src/gui/ConfigurationDialog.cpp 2015-08-03 13:17:13 +0000
@@ -931,8 +931,8 @@
931void ConfigurationDialog::setFixedDateTimeToCurrent(void)931void ConfigurationDialog::setFixedDateTimeToCurrent(void)
932{932{
933 StelCore* core = StelApp::getInstance().getCore();933 StelCore* core = StelApp::getInstance().getCore();
934 double JD = core->getJDay();934 double JD = core->getJD();
935 ui->fixedDateTimeEdit->setDateTime(StelUtils::jdToQDateTime(JD+StelUtils::getGMTShiftFromQT(JD)/24-core->getDeltaT(JD)/86400));935 ui->fixedDateTimeEdit->setDateTime(StelUtils::jdToQDateTime(JD+StelUtils::getGMTShiftFromQT(JD)/24));
936 ui->fixedTimeRadio->setChecked(true);936 ui->fixedTimeRadio->setChecked(true);
937 setStartupTimeMode();937 setStartupTimeMode();
938}938}
@@ -1252,6 +1252,8 @@
1252 algorithms->addItem(q_("Morrison & Stephenson (2004, 2005)"), "MorrisonStephenson2004");1252 algorithms->addItem(q_("Morrison & Stephenson (2004, 2005)"), "MorrisonStephenson2004");
1253 // Espenak & Meeus (2006) used by default1253 // Espenak & Meeus (2006) used by default
1254 algorithms->addItem(q_("Espenak & Meeus (2006)").append(" *"), "EspenakMeeus");1254 algorithms->addItem(q_("Espenak & Meeus (2006)").append(" *"), "EspenakMeeus");
1255 // GZ: I want to try out some things. Something is still wrong with eclipses, see lp:1275092.
1256 //algorithms->addItem(q_("Espenak & Meeus (2006) no extra moon acceleration"), "EspenakMeeusZeroMoonAccel");
1255 algorithms->addItem(q_("Reijs (2006)"), "Reijs");1257 algorithms->addItem(q_("Reijs (2006)"), "Reijs");
1256 algorithms->addItem(q_("Banjevic (2006)"), "Banjevic");1258 algorithms->addItem(q_("Banjevic (2006)"), "Banjevic");
1257 algorithms->addItem(q_("Islam, Sadiq & Qureshi (2008, 2013)"), "IslamSadiqQureshi");1259 algorithms->addItem(q_("Islam, Sadiq & Qureshi (2008, 2013)"), "IslamSadiqQureshi");
12581260
=== modified file 'src/gui/DateTimeDialog.cpp'
--- src/gui/DateTimeDialog.cpp 2015-02-05 15:36:01 +0000
+++ src/gui/DateTimeDialog.cpp 2015-08-03 13:17:13 +0000
@@ -54,13 +54,9 @@
54void DateTimeDialog::createDialogContent()54void DateTimeDialog::createDialogContent()
55{55{
56 ui->setupUi(dialog);56 ui->setupUi(dialog);
57 double cjd = StelApp::getInstance().getCore()->getJDay();57 double jd = StelApp::getInstance().getCore()->getJD();
58 // UTC -> local tz58 // UTC -> local tz
59 // Add in a DeltaT correction. Divide DeltaT by 86400 to convert from seconds to days.59 setDateTime(jd + (StelApp::getInstance().getLocaleMgr().getGMTShift(jd)/24.0));
60 double deltaT = 0.;
61 if (StelApp::getInstance().getCore()->getCurrentLocation().planetName=="Earth")
62 deltaT = StelApp::getInstance().getCore()->getDeltaT(cjd)/86400.;
63 setDateTime(cjd + (StelApp::getInstance().getLocaleMgr().getGMTShift(cjd)/24.0)-deltaT);
6460
65 connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));61 connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
66 connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));62 connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));
@@ -115,15 +111,15 @@
115 minute = dmin;111 minute = dmin;
116 second = ds;112 second = ds;
117 pushToWidgets();113 pushToWidgets();
118 StelApp::getInstance().getCore()->setJDay(newJd());114 StelApp::getInstance().getCore()->setJD(newJd());
119 return true;115 return true;
120}116}
121117
122bool DateTimeDialog::validJd(double jday)118bool DateTimeDialog::validJd(double jday)
123{119{
124 pushToWidgets();120 pushToWidgets();
125 StelCore *core = StelApp::getInstance().getCore();121 StelApp::getInstance().getCore()->setJD(jday);
126 core->setJDay(jday+core->getDeltaT(jday)/86400.);122
127 return true;123 return true;
128}124}
129125
@@ -211,11 +207,8 @@
211{207{
212 double cjd;208 double cjd;
213 StelUtils::getJDFromDate(&cjd, year, month, day, hour, minute, second);209 StelUtils::getJDFromDate(&cjd, year, month, day, hour, minute, second);
214 // Add in a DeltaT correction. Divide DeltaT by 86400 to convert from seconds to days.210 cjd -= (StelApp::getInstance().getLocaleMgr().getGMTShift(cjd)/24.0); // local tz -> UTC
215 double deltaT = 0.;211
216 if (StelApp::getInstance().getCore()->getCurrentLocation().planetName=="Earth")
217 deltaT = StelApp::getInstance().getCore()->getDeltaT(cjd)/86400.;
218 cjd -= (StelApp::getInstance().getLocaleMgr().getGMTShift(cjd)/24.0-deltaT); // local tz -> UTC
219 return cjd;212 return cjd;
220}213}
221214
@@ -236,25 +229,25 @@
236 }229 }
237 ui->spinner_jd->setValue(jd);230 ui->spinner_jd->setValue(jd);
238 ui->spinner_mjd->setValue(mjd);231 ui->spinner_mjd->setValue(mjd);
232 if (jd<2299161) // 1582-10-15
233 ui->dateTimeTab->setToolTip(q_("Date and Time in Julian calendar"));
234 else
235 ui->dateTimeTab->setToolTip(q_("Date and Time in Gregorian calendar"));
239 connectSpinnerEvents();236 connectSpinnerEvents();
240}237}
241238
242/************************************************************************239/************************************************************************
243Send newJd to spinner_*240Prepare date elements from newJd and send to spinner_*
244 ************************************************************************/241 ************************************************************************/
245void DateTimeDialog::setDateTime(double newJd)242void DateTimeDialog::setDateTime(double newJd)
246{243{
247 if (this->visible()) {244 if (this->visible()) {
248 // Add in a DeltaT correction. Divide DeltaT by 86400 to convert from seconds to days.245 newJd += (StelApp::getInstance().getLocaleMgr().getGMTShift(newJd)/24.0); // UTC -> local tz
249 double deltaT = 0.;
250 if (StelApp::getInstance().getCore()->getCurrentLocation().planetName=="Earth")
251 deltaT = StelApp::getInstance().getCore()->getDeltaT(newJd)/86400.;
252 double newJdC = newJd - deltaT;
253 newJd += (StelApp::getInstance().getLocaleMgr().getGMTShift(newJd)/24.0-deltaT); // UTC -> local tz
254 StelUtils::getDateFromJulianDay(newJd, &year, &month, &day);246 StelUtils::getDateFromJulianDay(newJd, &year, &month, &day);
255 StelUtils::getTimeFromJulianDay(newJd, &hour, &minute, &second);247 StelUtils::getTimeFromJulianDay(newJd, &hour, &minute, &second);
256 jd = newJdC;248 jd = newJd;
257 mjd = newJdC-2400000.5;249 mjd = newJd-2400000.5;
250
258 pushToWidgets();251 pushToWidgets();
259 }252 }
260}253}
261254
=== modified file 'src/gui/SearchDialog.cpp'
--- src/gui/SearchDialog.cpp 2015-05-09 10:26:41 +0000
+++ src/gui/SearchDialog.cpp 2015-08-03 13:17:13 +0000
@@ -478,7 +478,7 @@
478 case ecliptic:478 case ecliptic:
479 {479 {
480 double ra, dec;480 double ra, dec;
481 StelUtils::eclToEqu(ui->AxisXSpinBox->valueRadians(), ui->AxisYSpinBox->valueRadians(), core->getCurrentPlanet()->getRotObliquity(core->getJDay()), &ra, &dec);481 StelUtils::eclToEqu(ui->AxisXSpinBox->valueRadians(), ui->AxisYSpinBox->valueRadians(), core->getCurrentPlanet()->getRotObliquity(core->getJDE()), &ra, &dec);
482 StelUtils::spheToRect(ra, dec, pos);482 StelUtils::spheToRect(ra, dec, pos);
483 pos = core->equinoxEquToJ2000(pos);483 pos = core->equinoxEquToJ2000(pos);
484 break;484 break;
485485
=== modified file 'src/gui/StelGui.cpp'
--- src/gui/StelGui.cpp 2015-03-09 12:26:02 +0000
+++ src/gui/StelGui.cpp 2015-08-03 13:17:13 +0000
@@ -523,7 +523,7 @@
523 forceRefreshGui();523 forceRefreshGui();
524 }524 }
525525
526 dateTimeDialog->setDateTime(core->getJDay());526 dateTimeDialog->setDateTime(core->getJD());
527}527}
528528
529#ifndef DISABLE_SCRIPTING529#ifndef DISABLE_SCRIPTING
530530
=== modified file 'src/gui/StelGuiItems.cpp'
--- src/gui/StelGuiItems.cpp 2015-08-02 17:12:29 +0000
+++ src/gui/StelGuiItems.cpp 2015-08-03 13:17:13 +0000
@@ -537,56 +537,49 @@
537 updateText(true);537 updateText(true);
538}538}
539539
540// create text elements and tooltips in bottom toolbar.
540// Make sure to avoid any change if not necessary to avoid triggering useless redraw541// Make sure to avoid any change if not necessary to avoid triggering useless redraw
541void BottomStelBar::updateText(bool updatePos)542void BottomStelBar::updateText(bool updatePos)
542{543{
543 StelCore* core = StelApp::getInstance().getCore();544 StelCore* core = StelApp::getInstance().getCore();
544 double jd = core->getJDay();545 double jd = core->getJD();
545 double deltaT = 0.;546 double deltaT = core->getDeltaT();
546 double sigma = -1.;547 double sigma = StelUtils::getDeltaTStandardError(jd);
547 QString sigmaInfo = ""; 548 QString sigmaInfo = "";
548 QString validRangeInfo = "";549 QString validRangeMarker = "";
549 bool displayDeltaT = false;550 core->getCurrentDeltaTAlgorithmValidRangeDescription(jd, &validRangeMarker);
550 if (core->getCurrentLocation().planetName.contains("Earth"))
551 {
552 deltaT = core->getDeltaT(jd);
553 displayDeltaT = true;
554 sigma = StelUtils::getDeltaTStandardError(jd);
555 core->getCurrentDeltaTAlgorithmValidRange(jd, &validRangeInfo);
556 }
557551
558 const StelLocaleMgr& locmgr = StelApp::getInstance().getLocaleMgr();552 const StelLocaleMgr& locmgr = StelApp::getInstance().getLocaleMgr();
559 double dt = deltaT/86400.; // A DeltaT correction. Divide DeltaT by 86400 to convert from seconds to days.553 QString tz = locmgr.getPrintableTimeZoneLocal(jd);
560 QString tz = locmgr.getPrintableTimeZoneLocal(jd-dt);
561 QString newDateInfo = " ";554 QString newDateInfo = " ";
562 if (getFlagShowTime())555 if (getFlagShowTime())
563 {556 {
564 if (getFlagShowTz())557 if (getFlagShowTz())
565 newDateInfo = QString("%1 %2 %3").arg(locmgr.getPrintableDateLocal(jd-dt)).arg(locmgr.getPrintableTimeLocal(jd-dt)).arg(tz);558 newDateInfo = QString("%1 %2 %3").arg(locmgr.getPrintableDateLocal(jd)).arg(locmgr.getPrintableTimeLocal(jd)).arg(tz);
566 else559 else
567 newDateInfo = QString("%1 %2").arg(locmgr.getPrintableDateLocal(jd-dt)).arg(locmgr.getPrintableTimeLocal(jd-dt));560 newDateInfo = QString("%1 %2").arg(locmgr.getPrintableDateLocal(jd)).arg(locmgr.getPrintableTimeLocal(jd));
568 }561 }
569 QString newDateAppx = QString("JD %1").arg(jd-dt, 0, 'f', 5);562 QString newDateAppx = QString("JD %1").arg(jd, 0, 'f', 5);
570 if (getFlagTimeJd())563 if (getFlagTimeJd())
571 {564 {
572 newDateAppx = newDateInfo;565 newDateAppx = newDateInfo;
573 newDateInfo = QString("JD %1").arg(jd-dt, 0, 'f', 5);566 newDateInfo = QString("JD %1").arg(jd, 0, 'f', 5);
574 }567 }
575568
576 if (datetime->text()!=newDateInfo)569 if (datetime->text()!=newDateInfo)
577 {570 {
578 updatePos = true; 571 updatePos = true;
579 datetime->setText(newDateInfo);572 datetime->setText(newDateInfo);
580 if (displayDeltaT && core->getCurrentDeltaTAlgorithm()!=StelCore::WithoutCorrection)573 if (core->getCurrentDeltaTAlgorithm()!=StelCore::WithoutCorrection)
581 {574 {
582 if (sigma>0)575 if (sigma>0)
583 sigmaInfo = QString("; %1(%2T) = %3s").arg(QChar(0x03c3)).arg(QChar(0x0394)).arg(sigma, 3, 'f', 1);576 sigmaInfo = QString("; %1(%2T) = %3s").arg(QChar(0x03c3)).arg(QChar(0x0394)).arg(sigma, 3, 'f', 1);
584577
585 QString deltaTInfo = "";578 QString deltaTInfo = "";
586 if (qAbs(deltaT)>60.)579 if (qAbs(deltaT)>60.)
587 deltaTInfo = QString("%1 (%2s)%3").arg(StelUtils::hoursToHmsStr(deltaT/3600.)).arg(deltaT, 5, 'f', 2).arg(validRangeInfo);580 deltaTInfo = QString("%1 (%2s)%3").arg(StelUtils::hoursToHmsStr(deltaT/3600.)).arg(deltaT, 5, 'f', 2).arg(validRangeMarker);
588 else581 else
589 deltaTInfo = QString("%1s%2").arg(deltaT, 3, 'f', 3).arg(validRangeInfo);582 deltaTInfo = QString("%1s%2").arg(deltaT, 3, 'f', 3).arg(validRangeMarker);
590583
591 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));584 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));
592 }585 }
@@ -594,6 +587,7 @@
594 datetime->setToolTip(QString("%1").arg(newDateAppx));587 datetime->setToolTip(QString("%1").arg(newDateAppx));
595 }588 }
596589
590 // build location tooltip
597 QString newLocation = "";591 QString newLocation = "";
598 const StelLocation* loc = &core->getCurrentLocation();592 const StelLocation* loc = &core->getCurrentLocation();
599 const StelTranslator& trans = locmgr.getSkyTranslator();593 const StelTranslator& trans = locmgr.getSkyTranslator();
@@ -633,6 +627,8 @@
633 }627 }
634628
635 QString str;629 QString str;
630
631 // build fov tooltip
636 QTextStream wos(&str);632 QTextStream wos(&str);
637 if (getFlagFovDms())633 if (getFlagFovDms())
638 {634 {
@@ -659,6 +655,8 @@
659 }655 }
660656
661 str="";657 str="";
658
659 // build fps tooltip
662 QTextStream wos2(&str);660 QTextStream wos2(&str);
663 wos2 << qSetRealNumberPrecision(3) << StelApp::getInstance().getFps() << " FPS";661 wos2 << qSetRealNumberPrecision(3) << StelApp::getInstance().getFps() << " FPS";
664 if (fps->text()!=str)662 if (fps->text()!=str)
665663
=== modified file 'src/gui/dateTimeDialogGui.ui'
--- src/gui/dateTimeDialogGui.ui 2015-02-05 15:36:01 +0000
+++ src/gui/dateTimeDialogGui.ui 2015-08-03 13:17:13 +0000
@@ -557,7 +557,7 @@
557 </widget>557 </widget>
558 <widget class="QWidget" name="julianDateTab">558 <widget class="QWidget" name="julianDateTab">
559 <attribute name="title">559 <attribute name="title">
560 <string>Julian Date</string>560 <string>Julian Day</string>
561 </attribute>561 </attribute>
562 <layout class="QGridLayout" name="gridLayout_3">562 <layout class="QGridLayout" name="gridLayout_3">
563 <property name="leftMargin">563 <property name="leftMargin">
@@ -599,7 +599,7 @@
599 <item>599 <item>
600 <widget class="QLabel" name="label_5">600 <widget class="QLabel" name="label_5">
601 <property name="toolTip">601 <property name="toolTip">
602 <string>Julian Date</string>602 <string>Julian Day</string>
603 </property>603 </property>
604 <property name="text">604 <property name="text">
605 <string notr="true">JD:</string>605 <string notr="true">JD:</string>
@@ -664,7 +664,7 @@
664 <item>664 <item>
665 <widget class="QLabel" name="label_6">665 <widget class="QLabel" name="label_6">
666 <property name="toolTip">666 <property name="toolTip">
667 <string>Modified Julian Date</string>667 <string>Modified Julian Day</string>
668 </property>668 </property>
669 <property name="text">669 <property name="text">
670 <string notr="true">MJD:</string>670 <string notr="true">MJD:</string>
671671
=== modified file 'src/scripting/StelMainScriptAPI.cpp'
--- src/scripting/StelMainScriptAPI.cpp 2015-07-21 20:42:50 +0000
+++ src/scripting/StelMainScriptAPI.cpp 2015-08-03 13:17:13 +0000
@@ -104,17 +104,17 @@
104}104}
105105
106//! Set the current date in Julian Day106//! Set the current date in Julian Day
107//! @param JD the Julian Date107//! @param JD the Julian Date (UT)
108void StelMainScriptAPI::setJDay(double JD)108void StelMainScriptAPI::setJDay(double JD)
109{109{
110 StelApp::getInstance().getCore()->setJDay(JD);110 StelApp::getInstance().getCore()->setJD(JD);
111}111}
112112
113//! Get the current date in Julian Day113//! Get the current date in Julian Day
114//! @return the Julian Date114//! @return the Julian Date (UT)
115double StelMainScriptAPI::getJDay() const115double StelMainScriptAPI::getJDay() const
116{116{
117 return StelApp::getInstance().getCore()->getJDay();117 return StelApp::getInstance().getCore()->getJD();
118}118}
119119
120//! Set the current date in Modified Julian Day120//! Set the current date in Modified Julian Day
@@ -131,31 +131,42 @@
131 return StelApp::getInstance().getCore()->getMJDay();131 return StelApp::getInstance().getCore()->getMJDay();
132}132}
133133
134void StelMainScriptAPI::setDate(const QString& dt, const QString& spec, const bool &enableDeltaT)134void StelMainScriptAPI::setDate(const QString& dateStr, const QString& spec, const bool &dateIsDT)
135{135{
136 bool relativeTime = false;
137 if (dt.startsWith("+") || dt.startsWith("-") || (dt.startsWith("now") && (dt.startsWith("+") || dt.startsWith("-"))))
138 relativeTime = true;
139 double JD = jdFromDateString(dt, spec);
140 StelCore* core = StelApp::getInstance().getCore();136 StelCore* core = StelApp::getInstance().getCore();
141 if (relativeTime)137 double JD = jdFromDateString(dateStr, spec);
138 if (dateIsDT)
142 {139 {
143 core->setJDay(JD);140 qWarning() << "StelMainScriptAPI::setDate() called with final Boolean set to indicate Dynamical Time. This is new in 0.14, make sure you did this intentionally.";
141 qWarning() << "This warning will go away in Stellarium 0.16, please update the script by then to be sure.";
142 core->setJDE(JD);
144 }143 }
145 else144 else
146 {145 core->setJD(JD);
147 if (enableDeltaT)146
148 {147// bool relativeTime = false;
149 // add Delta-T correction for date148// if (dateStr.startsWith("+") || dateStr.startsWith("-") || (dateStr.startsWith("now") && (dateStr.startsWith("+") || dateStr.startsWith("-"))))
150 core->setJDay(JD + core->getDeltaT(JD)/86400);149// relativeTime = true;
151 }150// double JD = jdFromDateString(dateStr, spec);
152 else151// StelCore* core = StelApp::getInstance().getCore();
153 {152// if (relativeTime)
154 // set date without Delta-T correction153// {
155 // compatible with 0.11154// core->setJDay(JD);
156 core->setJDay(JD);155// }
157 }156// else
158 }157// {
158// if (dateIsDT)
159// {
160// // add Delta-T correction for date
161// core->setJDay(JD + core->getDeltaT(JD)/86400);
162// }
163// else
164// {
165// // set date without Delta-T correction
166// // compatible with 0.11
167// core->setJDay(JD);
168// }
169// }
159}170}
160171
161QString StelMainScriptAPI::getDate(const QString& spec)172QString StelMainScriptAPI::getDate(const QString& spec)
@@ -168,7 +179,7 @@
168179
169QString StelMainScriptAPI::getDeltaT() const180QString StelMainScriptAPI::getDeltaT() const
170{181{
171 return StelUtils::hoursToHmsStr(StelApp::getInstance().getCore()->getDeltaT(getJDay())/3600.);182 return StelUtils::hoursToHmsStr(StelApp::getInstance().getCore()->getDeltaT()/3600.);
172}183}
173184
174QString StelMainScriptAPI::getDeltaTAlgorithm() const185QString StelMainScriptAPI::getDeltaTAlgorithm() const
@@ -691,7 +702,7 @@
691 if (nowRe.capturedTexts().at(1)=="now")702 if (nowRe.capturedTexts().at(1)=="now")
692 jd = StelUtils::getJDFromSystem();703 jd = StelUtils::getJDFromSystem();
693 else704 else
694 jd = core->getJDay();705 jd = core->getJD();
695706
696 if (nowRe.capturedTexts().at(8) == "sidereal")707 if (nowRe.capturedTexts().at(8) == "sidereal")
697 {708 {
698709
=== modified file 'src/scripting/StelMainScriptAPI.hpp'
--- src/scripting/StelMainScriptAPI.hpp 2015-07-21 20:42:50 +0000
+++ src/scripting/StelMainScriptAPI.hpp 2015-08-03 13:17:13 +0000
@@ -44,22 +44,22 @@
4444
45// These functions will be available in scripts45// These functions will be available in scripts
46public slots:46public slots:
47 //! Set the current date in Julian Day47 //! Set the current date as Julian Day number
48 //! @param JD the Julian Date48 //! @param JD the Julian Day number
49 void setJDay(double JD);49 void setJDay(double JD);
50 //! Get the current date in Julian Day50 //! Get the current date as Julian Day number
51 //! @return the Julian Date51 //! @return the Julian Day number
52 double getJDay() const;52 double getJDay() const;
5353
54 //! Set the current date in Modified Julian Day54 //! Set the current date as Modified Julian Day
55 //! @param MJD the Modified Julian Date55 //! @param MJD the Modified Julian Day
56 void setMJDay(double MJD);56 void setMJDay(double MJD);
57 //! Get the current date in Modified Julian Day57 //! Get the current date as Modified Julian Day
58 //! @return the Modified Julian Date58 //! @return the Modified Julian Day
59 double getMJDay() const;59 double getMJDay() const;
6060
61 //! set the date in ISO format, e.g. "2008-03-24T13:21:01"61 //! set the date in ISO format, e.g. "2008-03-24T13:21:01"
62 //! @param dt the date string to use. Formats:62 //! @param dateStr the date string to use. Formats:
63 //! - ISO, e.g. "2008-03-24T13:21:01"63 //! - ISO, e.g. "2008-03-24T13:21:01"
64 //! - "now" (set sim time to real time)64 //! - "now" (set sim time to real time)
65 //! - relative, e.g. "+ 4 days", "-2 weeks". can use these65 //! - relative, e.g. "+ 4 days", "-2 weeks". can use these
@@ -71,8 +71,9 @@
71 //! of the unit is 1. i.e. use "+ 1 days" not "+1 day".71 //! of the unit is 1. i.e. use "+ 1 days" not "+1 day".
72 //! @note when sidereal time is used, the length of time for72 //! @note when sidereal time is used, the length of time for
73 //! each unit is dependent on the current planet. By contrast73 //! each unit is dependent on the current planet. By contrast
74 //! when sidereal timeis not specified (i.e. solar time is used)74 //! when sidereal time is not specified (i.e. solar time is used)
75 //! the value is conventional - i.e. 1 day means 1 Earth Solar day.75 //! the value is conventional - i.e. 1 day means 1 Earth Solar day.
76 // TODO: This calls for implementing "sol" days (planets's solar days)!
76 //! @param spec "local" or "utc" - only has an effect when77 //! @param spec "local" or "utc" - only has an effect when
77 //! the ISO date type is used. Defaults to "utc".78 //! the ISO date type is used. Defaults to "utc".
78 //! @param enableDeltaT is \a true or \a false - enable Delta-T correction or not.79 //! @param enableDeltaT is \a true or \a false - enable Delta-T correction or not.
@@ -81,7 +82,11 @@
81 //! or earlier, you should call \b core.setDeltaTAlgorithm("WithoutCorrection");82 //! or earlier, you should call \b core.setDeltaTAlgorithm("WithoutCorrection");
82 //! before running \b core.setDate(); for disabling DeltaT correction.83 //! before running \b core.setDate(); for disabling DeltaT correction.
83 //! @note starting with version 0.13.2 all relative dates are set without DeltaT correction.84 //! @note starting with version 0.13.2 all relative dates are set without DeltaT correction.
84 void setDate(const QString& dt, const QString& spec="utc", const bool& enableDeltaT=true);85 //! @note starting with version 0.14.0 the final optional Boolean argument has a different meaning and default!
86 //! @param dateIsTT \a true if the given date is formulated in Dynamical Time, i.e. with DeltaT added.
87 // 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.
88 //void setDate(const QString& dt, const QString& spec="utc", const bool& enableDeltaT=true);
89 void setDate(const QString& dateStr, const QString& spec="utc", const bool& dateIsDT=false);
8590
86 //! get the simulation date and time as a string in ISO format,91 //! get the simulation date and time as a string in ISO format,
87 //! e.g. "2008-03-24T13:21:01"92 //! e.g. "2008-03-24T13:21:01"