diff --git a/guide/ch_astronomical_concepts.tex b/guide/ch_astronomical_concepts.tex index 13f2961c6aced..d0a141a8e8038 100644 --- a/guide/ch_astronomical_concepts.tex +++ b/guide/ch_astronomical_concepts.tex @@ -1123,15 +1123,15 @@ \subsection{Stellar Parallax} Even the nearest stars exhibit very small movement due to parallax. The closest star to the Earth other than the Sun is Proxima Centauri. It has an annual parallax of $0.77199''$, corresponding to a -distance of $1.295\pc$ (4.22 light years). - -Even with the most sensitive instruments for measuring the positions of -the stars it is only possible to use parallax to determine the distance -of stars up to about 1,600 light years from the Earth, after which the -annual parallax is so small it cannot be measured accurately enough. +distance of $1.295\pc$ (4.22 light years). Currently, Gaia satellite is the most +accurate instrument for measuring stellar parallax. It can measure parallax +at the precision level of sub milli-arcseconds for bright stars ($G<15$), measuring distance +with $\approx 10\%$ to stars up to 10,000 parsecs. In Stellarium, the annual parallax can be listed in the object information for stars -when available. It is not accounted for in the positional calculations. +when available and is accounted for by default in the positional calculations on any +Solar System objects including the Earth. You can also exaggerate the parallax effect up to $10,000\times$ +to make it more apparent. \section{Aberration of Light} \label{sec:Concepts:Aberration} @@ -1165,7 +1165,7 @@ \section{Aberration of Light} In Stellarium, you can observe a slight annual wobble in all objects' positions against the fixed celestial grids. Just enable the equatorial grid, zoom in and run through the months. You can also -exaggerate the aberration effect upto $5\times$ to make it more +exaggerate the aberration effect up to $5\times$ to make it more apparent. \footnote{Exaggerating even more causes graphics defects and has been disabled for now.} @@ -1174,7 +1174,7 @@ \section{Proper Motion} \indexterm[proper motion]{Proper motion} is the change in the position of a star over time as a result of its motion through space relative to the Sun. It does not -include the apparent shift in position of star due to annular parallax. +include the apparent shift in position of star due to annual parallax. The star exhibiting the greatest proper motion is \indexterm{Barnard's Star} which moves more than ten seconds of arc per year. @@ -1186,14 +1186,14 @@ \section{Proper Motion} Note however some limitations: \begin{enumerate} -\item Stellarium will stop at $\pm 100.000$ years. This limit may be +\item Stellarium will stop at $\pm 100,000$ years. This limit may be still suitable for most stellar locations. The planetary locations are not trustworthy outside of a much narrower temporal window (see section~\ref{ch:Accuracy}). You cannot simulate the sky over the dinosaurs or such things. -\item Proper motion is only modeled by linear components. True 3D - motion in space requires more computation, which would slow down the - program. +\item For most bright stars ($V<10.5$), their full 6D astrometry (2D sky positions, + 2D proper motion, parallax, radial velocity) computed by assuming straight-line motion at constant speed. + Otherwise proper motion are only modelled by linear components. \item Double stars are listed in catalogs as two individual stars with their current proper motion which consists of a common spatial motion and the orbital motion around their common center of gravity. However, their orbital diff --git a/plugins/Exoplanets/src/Exoplanet.cpp b/plugins/Exoplanets/src/Exoplanet.cpp index 6469fb90ac5c8..33ebf61350df7 100644 --- a/plugins/Exoplanets/src/Exoplanet.cpp +++ b/plugins/Exoplanets/src/Exoplanet.cpp @@ -670,8 +670,7 @@ Vec3d Exoplanet::getJ2000EquatorialPos(const StelCore* core) const { if ((core) && (core->getUseAberration()) && (core->getCurrentPlanet())) { - Vec3d vel=core->getCurrentPlanet()->getHeliocentricEclipticVelocity(); - vel=StelCore::matVsop87ToJ2000*vel*core->getAberrationFactor()*(AU/(86400.0*SPEED_OF_LIGHT)); + const Vec3d vel = core->getAberrationVec(core->getJDE()); Vec3d pos=XYZ+vel; pos.normalize(); return pos; diff --git a/plugins/Novae/src/Nova.cpp b/plugins/Novae/src/Nova.cpp index 64fa7c450cf58..a8d99d7948928 100644 --- a/plugins/Novae/src/Nova.cpp +++ b/plugins/Novae/src/Nova.cpp @@ -343,8 +343,7 @@ Vec3d Nova::getJ2000EquatorialPos(const StelCore* core) const { if ((core) && (core->getUseAberration()) && (core->getCurrentPlanet())) { - Vec3d vel=core->getCurrentPlanet()->getHeliocentricEclipticVelocity(); - vel=StelCore::matVsop87ToJ2000*vel*core->getAberrationFactor()*(AU/(86400.0*SPEED_OF_LIGHT)); + const Vec3d vel = core->getAberrationVec(core->getJDE()); Vec3d pos=XYZ+vel; pos.normalize(); return pos; diff --git a/plugins/Pulsars/src/Pulsar.cpp b/plugins/Pulsars/src/Pulsar.cpp index 7db14fb4acfeb..77029f22fe6f6 100644 --- a/plugins/Pulsars/src/Pulsar.cpp +++ b/plugins/Pulsars/src/Pulsar.cpp @@ -465,8 +465,7 @@ Vec3d Pulsar::getJ2000EquatorialPos(const StelCore* core) const if ((core) && (core->getUseAberration()) && (core->getCurrentPlanet())) { - Vec3d vel=core->getCurrentPlanet()->getHeliocentricEclipticVelocity(); - vel=StelCore::matVsop87ToJ2000*vel*core->getAberrationFactor()*(AU/(86400.0*SPEED_OF_LIGHT)); + const Vec3d vel = core->getAberrationVec(core->getJDE()); Vec3d pos=v+vel; pos.normalize(); return pos; diff --git a/plugins/Quasars/src/Quasar.cpp b/plugins/Quasars/src/Quasar.cpp index a2dc473f4f2dd..faaccdb6d4b8f 100644 --- a/plugins/Quasars/src/Quasar.cpp +++ b/plugins/Quasars/src/Quasar.cpp @@ -252,8 +252,7 @@ Vec3d Quasar::getJ2000EquatorialPos(const StelCore* core) const { if ((core) && (core->getUseAberration()) && (core->getCurrentPlanet())) { - Vec3d vel=core->getCurrentPlanet()->getHeliocentricEclipticVelocity(); - vel=StelCore::matVsop87ToJ2000*vel*core->getAberrationFactor()*(AU/(86400.0*SPEED_OF_LIGHT)); + const Vec3d vel = core->getAberrationVec(core->getJDE()); Vec3d pos=XYZ+vel; pos.normalize(); return pos; diff --git a/plugins/Supernovae/src/Supernova.cpp b/plugins/Supernovae/src/Supernova.cpp index d81c05a166ba9..775c34040b459 100644 --- a/plugins/Supernovae/src/Supernova.cpp +++ b/plugins/Supernovae/src/Supernova.cpp @@ -272,8 +272,7 @@ Vec3d Supernova::getJ2000EquatorialPos(const StelCore* core) const { if ((core) && (core->getUseAberration()) && (core->getCurrentPlanet())) { - Vec3d vel=core->getCurrentPlanet()->getHeliocentricEclipticVelocity(); - vel=StelCore::matVsop87ToJ2000*vel*core->getAberrationFactor()*(AU/(86400.0*SPEED_OF_LIGHT)); + const Vec3d vel = core->getAberrationVec(core->getJDE()); Vec3d pos=XYZ+vel; pos.normalize(); return pos; diff --git a/src/core/StelCore.cpp b/src/core/StelCore.cpp index a7ba6c080fb44..300cf3cfd3fc5 100644 --- a/src/core/StelCore.cpp +++ b/src/core/StelCore.cpp @@ -41,6 +41,7 @@ #include "EphemWrapper.hpp" #include "NomenclatureItem.hpp" #include "precession.h" +#include "Star.hpp" #include #include @@ -71,6 +72,13 @@ const double StelCore::JD_DAY = 1.; const double StelCore::ONE_OVER_JD_SECOND = 86400; // 86400 const double StelCore::TZ_ERA_BEGINNING = 2395996.5; // December 1, 1847 +Vec3d StelCore::cachedParallaxDiff = Vec3d(0.,0.,0.); +double StelCore::cachedParallaxJD = 0.0; +PlanetP StelCore::cachedParallaxPlanet; +Vec3d StelCore::cachedAberrationVec = Vec3d(0.,0.,0.); +double StelCore::cachedAberrationJD = 0.0; +PlanetP StelCore::cachedAberrationPlanet = Q_NULLPTR; + StelCore::StelCore() : skyDrawer(Q_NULLPTR) , movementMgr(Q_NULLPTR) @@ -82,6 +90,8 @@ StelCore::StelCore() , flagUseNutation(true) , flagUseAberration(true) , aberrationFactor(1.0) + , flagUseParallax(true) + , parallaxFactor(1.0) , flagUseTopocentricCoordinates(true) , timeSpeed(JD_SECOND) , JD(0.,0.) @@ -141,6 +151,8 @@ StelCore::StelCore() flagUseNutation=conf->value("astro/flag_nutation", true).toBool(); flagUseAberration=conf->value("astro/flag_aberration", true).toBool(); aberrationFactor=conf->value("astro/aberration_factor", 1.0).toDouble(); + flagUseParallax=conf->value("astro/flag_parallax", true).toBool(); + parallaxFactor=conf->value("astro/parallax_factor", 1.0).toDouble(); flagUseTopocentricCoordinates=conf->value("astro/flag_topocentric_coordinates", true).toBool(); flagUseDST=conf->value("localization/flag_dst", true).toBool(); @@ -159,6 +171,8 @@ StelCore::~StelCore() delete geodesicGrid; geodesicGrid=Q_NULLPTR; delete skyDrawer; skyDrawer=Q_NULLPTR; delete position; position=Q_NULLPTR; + cachedParallaxPlanet=Q_NULLPTR; + cachedAberrationPlanet=Q_NULLPTR; } const QMapStelCore::ditheringMap={ @@ -3091,17 +3105,58 @@ Vec3d StelCore::getMouseJ2000Pos() const return mousePosition; } +Vec3d StelCore::calculateParallaxDiff(double JD) const { + // ICRS coordinates are barycentric (Gaia gives barycentric RA/DEC coordinates) + // diff between solar system bayrcentric location at STAR_CATALOG_JDEPOCH and current solar system bayrcentric location + Vec3d PosNow = getCurrentPlanet()->getBarycentricEclipticPos(JD); + // Transform from heliocentric ecliptic to equatorial coordinates + PosNow = matVsop87ToJ2000.upper3x3() * -1. * PosNow; // need to times -1 because technically it is doing (0,0,0) - PosNow + return PosNow; +} + +Vec3d StelCore::getParallaxDiff(double JD) const { + // if isArtificial meaning transitioning between planets, use cache and don't recalculate because it will crash + if ((fuzzyEquals(JD, cachedParallaxJD, JD_SECOND) && (getCurrentPlanet() == cachedParallaxPlanet)) || (getCurrentPlanet()->getPlanetType() == Planet::isArtificial)) + { + return cachedParallaxDiff; + } + cachedParallaxDiff = calculateParallaxDiff(JD); // set the cache to the new value + cachedParallaxJD = JD; // set the cache to the new value + cachedParallaxPlanet = getCurrentPlanet(); + return cachedParallaxDiff; +} + +Vec3d StelCore::calculateAberrationVec(double JD) const { + // Solar system barycentric velocity + Q_UNUSED(JD); + Vec3d vel = getCurrentPlanet()->getBarycentricEclipticVelocity(); + vel = StelCore::matVsop87ToJ2000 * vel * (AU/(86400.0*SPEED_OF_LIGHT)); + return vel; +} + +Vec3d StelCore::getAberrationVec(double JD) const { + // need to recompute the aberration vector if the JD has changed or the planet has changed + if (fuzzyEquals(JD, cachedAberrationJD, JD_SECOND) && (getCurrentPlanet() == cachedAberrationPlanet)) + { + return getAberrationFactor() * cachedAberrationVec; + } + cachedAberrationVec = StelCore::calculateAberrationVec(JD); // set the cache to the new value + cachedAberrationJD = JD; // set the cache to the new value + cachedAberrationPlanet = getCurrentPlanet(); + return getAberrationFactor() * cachedAberrationVec; +} + QByteArray StelCore::getAberrationShader() const { return 1+R"( -uniform vec3 STELCORE_currentPlanetHeliocentricEclipticVelocity; +uniform vec3 STELCORE_currentPlanetBarycentricEclipticVelocity; // objectDir points to the object as viewed from its comoving frame. // Return value represents the apparent direction to this object from a frame // that moves with respect to the object at slightly relativistic speeds (v<0.1c). // Relative error in aberration angle is about 0.5v/c. vec3 applyAberrationToObject(vec3 objectDir) { - vec3 velocity = STELCORE_currentPlanetHeliocentricEclipticVelocity; + vec3 velocity = STELCORE_currentPlanetBarycentricEclipticVelocity; return normalize(objectDir + velocity); } // viewDir is the direction where the object appears to be when viewed from a @@ -3110,7 +3165,7 @@ vec3 applyAberrationToObject(vec3 objectDir) // Relative error in aberration angle is about 0.5v/c. vec3 applyAberrationToViewDir(vec3 viewDir) { - vec3 velocity = STELCORE_currentPlanetHeliocentricEclipticVelocity; + vec3 velocity = STELCORE_currentPlanetBarycentricEclipticVelocity; return normalize(viewDir - velocity); } )"; @@ -3121,14 +3176,11 @@ void StelCore::setAberrationUniforms(QOpenGLShaderProgram& program) const Vec3d velocity; if(getUseAberration()) { - const auto p = getCurrentPlanet(); - const auto hev = p->getHeliocentricEclipticVelocity(); - velocity = StelCore::matVsop87ToJ2000 * hev; - velocity *= getAberrationFactor() * (AU/(86400.0*SPEED_OF_LIGHT)); + velocity = cachedAberrationVec; } else { velocity = Vec3d(0,0,0); } - program.setUniformValue("STELCORE_currentPlanetHeliocentricEclipticVelocity", velocity.toQVector()); + program.setUniformValue("STELCORE_currentPlanetBarycentricEclipticVelocity", velocity.toQVector()); } diff --git a/src/core/StelCore.hpp b/src/core/StelCore.hpp index 2ed0f69c69150..bdde348957210 100644 --- a/src/core/StelCore.hpp +++ b/src/core/StelCore.hpp @@ -26,6 +26,7 @@ #include "StelLocation.hpp" #include "StelSkyDrawer.hpp" #include "StelPropertyMgr.hpp" +#include "SolarSystem.hpp" #include "Dithering.hpp" #include #include @@ -55,6 +56,8 @@ class StelCore : public QObject Q_PROPERTY(bool flagUseNutation READ getUseNutation WRITE setUseNutation NOTIFY flagUseNutationChanged) Q_PROPERTY(bool flagUseAberration READ getUseAberration WRITE setUseAberration NOTIFY flagUseAberrationChanged) Q_PROPERTY(double aberrationFactor READ getAberrationFactor WRITE setAberrationFactor NOTIFY aberrationFactorChanged) + Q_PROPERTY(bool flagUseParallax READ getUseParallax WRITE setUseParallax NOTIFY flagUseParallaxChanged) + Q_PROPERTY(double parallaxFactor READ getParallaxFactor WRITE setParallaxFactor NOTIFY parallaxFactorChanged) Q_PROPERTY(bool flagUseTopocentricCoordinates READ getUseTopocentricCoordinates WRITE setUseTopocentricCoordinates NOTIFY flagUseTopocentricCoordinatesChanged) Q_PROPERTY(ProjectionType currentProjectionType READ getCurrentProjectionType WRITE setCurrentProjectionType NOTIFY currentProjectionTypeChanged) //! This is just another way to access the projection type, by string instead of enum @@ -374,6 +377,11 @@ class StelCore : public QObject Vec3d getMouseJ2000Pos(void) const; + //! get vector used to compute parallax effect + Vec3d getParallaxDiff(double JD) const; + //! get vector used to compute aberration effect + Vec3d getAberrationVec(double JD) const; + public slots: //! Smoothly move the observer to the given location //! @param target the target location @@ -551,6 +559,16 @@ public slots: QByteArray getAberrationShader() const; void setAberrationUniforms(QOpenGLShaderProgram& program) const; + //! @return whether parallax effect is currently used. + bool getUseParallax() const {return flagUseParallax;} + //! Set whether you want computation and simulation of parallax effect. + void setUseParallax(bool use) { if (flagUseParallax != use) { flagUseParallax=use; StelApp::immediateSave("astro/flag_parallax", use); emit flagUseParallaxChanged(use); }} + + //! @return parallax factor. 1 is realistic simulation, but higher values may be useful for didactic purposes. + double getParallaxFactor() const {return parallaxFactor;} + //! Set aberration factor. Values are clamped to 0...5. (Values above 5 cause graphical problems.) + void setParallaxFactor(double factor) { if (!fuzzyEquals(parallaxFactor, factor)) { parallaxFactor=qBound(0.,factor, 10000.); StelApp::immediateSave("astro/parallax_factor", parallaxFactor); emit parallaxFactorChanged(factor); }} + //! @return whether topocentric coordinates are currently used. bool getUseTopocentricCoordinates() const {return flagUseTopocentricCoordinates;} //! Set whether you want topocentric or planetocentric data @@ -862,6 +880,10 @@ public slots: void flagUseAberrationChanged(bool b); //! This signal indicates a change in aberration exaggeration factor void aberrationFactorChanged(double val); + //! This signal indicates a switch in use of parallax + void flagUseParallaxChanged(bool b); + //! This signal indicates a change in parallax exaggeration factor + void parallaxFactorChanged(double val); //! This signal indicates a switch in use of topocentric coordinates void flagUseTopocentricCoordinatesChanged(bool b); //! Emitted whenever the projection type changes @@ -943,6 +965,10 @@ private slots: bool flagUseAberration; // value to allow exaggerating aberration effects. 1 is natural value, stretching to e.g. 1000 may be useful for explanations. double aberrationFactor; + // flag to indicate we want to include parallax effect + bool flagUseParallax; + // value to allow exaggerating parallax effects. 1 is natural value, stretching to e.g. 1000 may be useful for explanations. + double parallaxFactor; // flag to indicate that we show topocentrically corrected coordinates. (Switching to false for planetocentric coordinates is new for 0.14) bool flagUseTopocentricCoordinates; @@ -984,6 +1010,17 @@ private slots: bool de440Active; // available and user-activated. bool de441Active; // available and user-activated. QPair minMaxEphemRange; + + // Variables for caching the observer position relative to the star catalog reference frame + static Vec3d cachedParallaxDiff; + static double cachedParallaxJD; // Cached Julian Date + static PlanetP cachedParallaxPlanet; + Vec3d calculateParallaxDiff(double JD) const; // Actual calculation + + // Variables for caching the aberration effect + static Vec3d cachedAberrationVec; + static double cachedAberrationJD; + static PlanetP cachedAberrationPlanet; + Vec3d calculateAberrationVec(double JD) const; // Actual calculation }; - #endif // STELCORE_HPP diff --git a/src/core/StelSkyImageTile.cpp b/src/core/StelSkyImageTile.cpp index 776e5403e02d6..e54e4cba79a98 100644 --- a/src/core/StelSkyImageTile.cpp +++ b/src/core/StelSkyImageTile.cpp @@ -90,8 +90,7 @@ void StelSkyImageTile::draw(StelCore* core, StelPainter& sPainter, float opacity Vec3d vel(0.0); if ((core) && (core->getUseAberration()) && (core->getCurrentPlanet()) && (withAberration)) { - vel=core->getCurrentPlanet()->getHeliocentricEclipticVelocity(); - vel=StelCore::matVsop87ToJ2000*vel*core->getAberrationFactor()*(AU/(86400.0*SPEED_OF_LIGHT)); + vel = core->getAberrationVec(core->getJDE()); } const float limitLuminance = core->getSkyDrawer()->getLimitLuminance(); diff --git a/src/core/StelToast.cpp b/src/core/StelToast.cpp index d697f25dd6e1b..8932e1e3ba49a 100644 --- a/src/core/StelToast.cpp +++ b/src/core/StelToast.cpp @@ -144,9 +144,7 @@ void ToastTile::prepareDraw(Vec3f color) if (core->getUseAberration()) { - Vec3d vel=core->getCurrentPlanet()->getHeliocentricEclipticVelocity(); - vel=StelCore::matVsop87ToJ2000*vel; - vel*=core->getAberrationFactor() * (AU/(86400.0*SPEED_OF_LIGHT)); + const Vec3d vel = core->getAberrationVec(core->getJDE()); vertexArray=QVector(originalVertexArray); for (int i=0; igetCurrentPlanet()->getHeliocentricEclipticVelocity(); - vel=StelCore::matVsop87ToJ2000*vel; - vel*=core->getAberrationFactor() * (AU/(86400.0*SPEED_OF_LIGHT)); sPainter.setBlending(true); for (auto* asterism : asterisms) @@ -369,6 +366,7 @@ void AsterismMgr::drawNames(StelPainter& sPainter) const Vec3d XYZname=asterism->XYZname; if (core->getUseAberration()) { + const Vec3d vel = core->getAberrationVec(core->getJDE()); XYZname.normalize(); XYZname+=vel; XYZname.normalize(); diff --git a/src/core/modules/ConstellationMgr.cpp b/src/core/modules/ConstellationMgr.cpp index 2f9eae85c37dd..33f7e77e308e3 100644 --- a/src/core/modules/ConstellationMgr.cpp +++ b/src/core/modules/ConstellationMgr.cpp @@ -684,9 +684,7 @@ void ConstellationMgr::draw(StelCore* core) Vec3d vel(0.); if (core->getUseAberration()) { - vel=core->getCurrentPlanet()->getHeliocentricEclipticVelocity(); - vel=StelCore::matVsop87ToJ2000*vel; - vel*=core->getAberrationFactor() * (AU/(86400.0*SPEED_OF_LIGHT)); + vel = core->getAberrationVec(core->getJDE()); } drawNames(sPainter, vel); drawArt(sPainter, vel); diff --git a/src/core/modules/CustomObject.cpp b/src/core/modules/CustomObject.cpp index d8bae94505655..d9c7a637b9061 100644 --- a/src/core/modules/CustomObject.cpp +++ b/src/core/modules/CustomObject.cpp @@ -99,8 +99,7 @@ Vec3d CustomObject::getJ2000EquatorialPos(const StelCore* core) const if (!isMarker && (core && core->getUseAberration() && core->getCurrentPlanet())) { - Vec3d vel=core->getCurrentPlanet()->getHeliocentricEclipticVelocity(); - vel=StelCore::matVsop87ToJ2000*vel*core->getAberrationFactor()*(AU/(86400.0*SPEED_OF_LIGHT)); + const Vec3d vel = core->getAberrationVec(core->getJDE()); Vec3d pos=XYZ+vel; pos.normalize(); return pos; diff --git a/src/core/modules/MarkerMgr.cpp b/src/core/modules/MarkerMgr.cpp index 76e6b49bdeb2f..29203679d1071 100644 --- a/src/core/modules/MarkerMgr.cpp +++ b/src/core/modules/MarkerMgr.cpp @@ -224,9 +224,7 @@ bool SkyMarker::draw(StelCore* core, StelPainter& sPainter) // prepare for aberration: Explan. Suppl. 2013, (7.38) if (withAberration && (core->getUseAberration())) { - Vec3d vel=core->getCurrentPlanet()->getHeliocentricEclipticVelocity(); - vel=StelCore::matVsop87ToJ2000*vel; - vel*=core->getAberrationFactor() * (AU/(86400.0*SPEED_OF_LIGHT)); + const Vec3d vel = core->getAberrationVec(core->getJDE()); point+=vel; point.normalize(); } diff --git a/src/core/modules/Nebula.cpp b/src/core/modules/Nebula.cpp index bb65827af1d43..2736e252f8b82 100644 --- a/src/core/modules/Nebula.cpp +++ b/src/core/modules/Nebula.cpp @@ -715,9 +715,7 @@ void Nebula::drawOutlines(StelPainter &sPainter, float maxMagHints) const sPainter.setLineWidth(1.f * sPainter.getProjector()->getScreenScale()); StelCore *core=StelApp::getInstance().getCore(); - Vec3d vel=core->getCurrentPlanet()->getHeliocentricEclipticVelocity(); - vel=StelCore::matVsop87ToJ2000*vel; - vel*=core->getAberrationFactor() * (AU/(86400.0*SPEED_OF_LIGHT)); + const Vec3d vel = core->getAberrationVec(core->getJDE()); // Show outlines if (segments>0 && flagUseOutlines && oLim<=maxMagHints) @@ -1657,8 +1655,7 @@ Vec3d Nebula::getJ2000EquatorialPos(const StelCore* core) const Vec3d pos=XYZ; Q_ASSERT_X(fabs(pos.normSquared()-1.0)<0.0001, "Nebula aberration", "vertex length not unity"); //pos.normalize(); // Yay - not required! - Vec3d vel=core->getCurrentPlanet()->getHeliocentricEclipticVelocity(); - vel=StelCore::matVsop87ToJ2000*vel*core->getAberrationFactor()*(AU/(86400.0*SPEED_OF_LIGHT)); + Vec3d vel=core->getAberrationVec(core->getJDE()); pos+=vel; pos.normalize(); return pos; diff --git a/src/core/modules/NomenclatureMgr.cpp b/src/core/modules/NomenclatureMgr.cpp index 5832479da7f18..978dde2f8063e 100644 --- a/src/core/modules/NomenclatureMgr.cpp +++ b/src/core/modules/NomenclatureMgr.cpp @@ -355,9 +355,7 @@ QList NomenclatureMgr::searchAround(const Vec3d& av, double limitFo v.normalize(); if (withAberration) { - Vec3d vel=core->getCurrentPlanet()->getHeliocentricEclipticVelocity(); - StelCore::matVsop87ToJ2000.transfo(vel); - vel*=core->getAberrationFactor()*(AU/(86400.0*SPEED_OF_LIGHT)); + const Vec3d vel = core->getAberrationVec(core->getJDE()); v+=vel; v.normalize(); } diff --git a/src/core/modules/Planet.cpp b/src/core/modules/Planet.cpp index 287ab56bcff90..fc470d9fcd18b 100644 --- a/src/core/modules/Planet.cpp +++ b/src/core/modules/Planet.cpp @@ -2048,6 +2048,10 @@ Vec3d Planet::getEclipticPos(double dateJDE) const // Return heliocentric ecliptical Cartesian J2000 coordinates of p [AU] Vec3d Planet::getHeliocentricPos(Vec3d p) const { + if (parent == Q_NULLPTR) // the Sun + { + return p; + } // Note: using shared copies is too slow here. So we use direct access instead. Vec3d pos = p; const Planet* pp = parent.data(); @@ -2064,6 +2068,10 @@ Vec3d Planet::getHeliocentricPos(Vec3d p) const Vec3d Planet::getHeliocentricEclipticPos(double dateJDE) const { + if (parent == Q_NULLPTR) // the Sun + { + return Vec3d(0., 0., 0.); + } Vec3d pos = getEclipticPos(dateJDE); const Planet* pp = parent.data(); if (pp) @@ -2077,6 +2085,26 @@ Vec3d Planet::getHeliocentricEclipticPos(double dateJDE) const return pos; } +Vec3d Planet::getBarycentricEclipticPos(double dateJDE) const +{ + Vec3d pos = getEclipticPos(dateJDE); + const Planet* pp = parent.data(); + if (pp) + { + while (true) + { + pos += pp->getEclipticPos(dateJDE); + pp = pp->parent.data(); + // slightly different from getHeliocentricEclipticPos to finally add Sun barycentric position + if (pp == Q_NULLPTR) + { + break; + } + } + } + return pos; +} + void Planet::setHeliocentricEclipticPos(const Vec3d &pos) { eclipticPos = pos; @@ -2090,9 +2118,14 @@ void Planet::setHeliocentricEclipticPos(const Vec3d &pos) } } } + // Return heliocentric velocity of planet. Vec3d Planet::getHeliocentricEclipticVelocity() const { + if (parent == Q_NULLPTR) // the Sun + { + return Vec3d(0., 0., 0.); + } // Note: using shared copies is too slow here. So we use direct access instead. Vec3d vel = eclipticVelocity; const Planet* pp = parent.data(); @@ -2107,6 +2140,28 @@ Vec3d Planet::getHeliocentricEclipticVelocity() const return vel; } +// Return barycentric velocity of planet. +Vec3d Planet::getBarycentricEclipticVelocity() const +{ + // Note: using shared copies is too slow here. So we use direct access instead. + Vec3d vel = eclipticVelocity; + const Planet* pp = parent.data(); + if (pp) + { + while (true) + { + vel += pp->eclipticVelocity; + pp = pp->parent.data(); + // slightly different from getHeliocentricEclipticVelocity to finally add Sun barycentric velocity + if (pp == Q_NULLPTR) + { + break; + } + } + } + return vel; +} + // Compute the distance to the given position in heliocentric coordinate (in AU) // This is called by SolarSystem::draw() double Planet::computeDistance(const Vec3d& obsHelioPos) diff --git a/src/core/modules/Planet.hpp b/src/core/modules/Planet.hpp index e5046db16bde0..a693fa89b340c 100644 --- a/src/core/modules/Planet.hpp +++ b/src/core/modules/Planet.hpp @@ -475,6 +475,9 @@ class Planet : public StelObject Vec3d getHeliocentricEclipticPos() const {return getHeliocentricPos(eclipticPos);} Vec3d getHeliocentricEclipticPos(double dateJDE) const; + //! Return the barycentric ecliptical position + Vec3d getBarycentricEclipticPos(double dateJDE) const; + //! Return the heliocentric transformation for local (parentocentric) coordinate //! @arg p planetocentric rectangular ecliptical coordinate (J2000) //! @return heliocentric rectangular ecliptical coordinates (J2000) @@ -486,9 +489,12 @@ class Planet : public StelObject //! Get the planet velocity around the parent planet in ecliptical coordinates in AU/d Vec3d getEclipticVelocity() const {return eclipticVelocity;} - //! Get the planet's heliocentric velocity in the solar system in ecliptical coordinates in AU/d. Required for aberration! + //! Get the planet's heliocentric velocity in the solar system in ecliptical coordinates in AU/d. Vec3d getHeliocentricEclipticVelocity() const; + //! Return the barycentric ecliptical velocity in the solar system in ecliptical coordinates in AU/d. Required for aberration! + Vec3d getBarycentricEclipticVelocity() const; + //! Compute and return the distance to the given position in heliocentric ecliptical (J2000) coordinates (in AU) //! Preserves result for later retrieval by getDistance() //! As side effect, improve fps by juggling update frequency (deltaJDE) for asteroids and other minor bodies. They must be fast if close to observer, but can be slow if further away. diff --git a/src/core/modules/SolarSystem.cpp b/src/core/modules/SolarSystem.cpp index 70e0c816287f4..370ac09444219 100644 --- a/src/core/modules/SolarSystem.cpp +++ b/src/core/modules/SolarSystem.cpp @@ -1190,7 +1190,7 @@ bool SolarSystem::loadPlanets(const QString& filePath) else { static const QMapposfuncMap={ - { "sun_special", &get_sun_helio_coordsv}, + { "sun_special", &get_sun_barycentric_coordsv}, { "mercury_special", &get_mercury_helio_coordsv}, { "venus_special", &get_venus_helio_coordsv}, { "earth_special", &get_earth_helio_coordsv}, diff --git a/src/core/modules/Star.hpp b/src/core/modules/Star.hpp index 1207ce82b418b..9b2ae89b6ae62 100644 --- a/src/core/modules/Star.hpp +++ b/src/core/modules/Star.hpp @@ -132,7 +132,7 @@ struct Star { return static_cast(this)->getPreciseAstrometricFlag(); } // should only be true if full astrometric solution is available with getX2(), getDx2() too - inline void getJ2000Pos(float dyrs, Vec3f & pos) const + inline void getJ2000Pos(float dyrs, Vec3d & pos) const { // ideally whatever computation is done here should be done to get RA, DEC only // dont waste time computing other things because whoever calls this function dont need them @@ -145,7 +145,7 @@ struct Star } // Special thanks to Anthony Brown's astrometry tutorial // This function only compute RA, DEC in rectangular coordinate system - inline void getEquatorialPos3D(float dyrs, Vec3f & pos) const + inline void getEquatorialPos3D(float dyrs, Vec3d & pos) const { double r0 = getX0(); double r1 = getX1(); @@ -167,7 +167,7 @@ struct Star pos.set(u[0], u[1], u[2]); } - inline void getEquatorialPos2D(float dyrs, Vec3f & pos) const + inline void getEquatorialPos2D(float dyrs, Vec3d & pos) const { StelUtils::spheToRect(getX0() + dyrs * getDx0() * MAS2RAD, getX1() + dyrs * getDx1() * MAS2RAD, pos); } @@ -236,6 +236,13 @@ struct Star DE = getX1() + dyrs * getDx1() * MAS2RAD; } } + + //to get new 3D cartesian position for parallax effect given current star 3D cartesian position, planet orbital period and radius and current delta time from catalog epoch + inline void getPlxEffect(double plx, Vec3d& bS, const Vec3d diffPos) const { + if (plx <= 0.) return; + bS *= 1000./ plx; + bS += diffPos * MAS2RAD * 1000.; + } }; struct Star1 : public Star diff --git a/src/core/modules/StarMgr.cpp b/src/core/modules/StarMgr.cpp index f4a19c6af97a8..d7b4a8e1310f0 100644 --- a/src/core/modules/StarMgr.cpp +++ b/src/core/modules/StarMgr.cpp @@ -1188,11 +1188,8 @@ void StarMgr::draw(StelCore* core) Vec3d vel(0.); if (withAberration) { - vel=core->getCurrentPlanet()->getHeliocentricEclipticVelocity(); - StelCore::matVsop87ToJ2000.transfo(vel); - vel*=core->getAberrationFactor()*(AU/(86400.0*SPEED_OF_LIGHT)); + vel = core->getAberrationVec(core->getJDE()); } - const Vec3f velf=vel.toVec3f(); // Prepare openGL for drawing many stars StelPainter sPainter(prj); @@ -1242,12 +1239,17 @@ void StarMgr::draw(StelCore* core) maxMagStarName = x; } int zone; + double withParallax = core->getUseParallax() * core->getParallaxFactor(); + Vec3d diffPos(0., 0., 0.); + if (withParallax) { + diffPos = core->getParallaxDiff(core->getJDE()); + } for (GeodesicSearchInsideIterator it1(*geodesic_search_result,z->level);(zone = it1.next()) >= 0;) - z->draw(&sPainter, zone, true, rcmag_table, limitMagIndex, core, maxMagStarName, names_brightness, viewportCaps, withAberration, velf); + z->draw(&sPainter, zone, true, rcmag_table, limitMagIndex, core, maxMagStarName, names_brightness, viewportCaps, withAberration, vel, withParallax, diffPos); for (GeodesicSearchBorderIterator it1(*geodesic_search_result,z->level);(zone = it1.next()) >= 0;) - z->draw(&sPainter, zone, false, rcmag_table, limitMagIndex, core, maxMagStarName,names_brightness, viewportCaps, withAberration, velf); + z->draw(&sPainter, zone, false, rcmag_table, limitMagIndex, core, maxMagStarName,names_brightness, viewportCaps, withAberration, vel, withParallax, diffPos); // always check the last zone because it is a global zone - z->draw(&sPainter, (20<<(z->level<<1)), false, rcmag_table, limitMagIndex, core, maxMagStarName, names_brightness, viewportCaps, withAberration, velf); + z->draw(&sPainter, (20<<(z->level<<1)), false, rcmag_table, limitMagIndex, core, maxMagStarName, names_brightness, viewportCaps, withAberration, vel, withParallax, diffPos); } exit_loop: @@ -1311,6 +1313,12 @@ QList StarMgr::searchAround(const Vec3d& vv, double limFov, const SphericalConvexPolygon c(e3, e2, e2, e0); const GeodesicSearchResult* geodesic_search_result = core->getGeodesicGrid(lastMaxSearchLevel)->search(c.getBoundingSphericalCaps(),lastMaxSearchLevel); + double withParallax = core->getUseParallax() * core->getParallaxFactor(); + Vec3d diffPos(0., 0., 0.); + if (withParallax) { + diffPos = core->getParallaxDiff(core->getJDE()); + } + // Iterate over the stars inside the triangles f = cos(limFov * M_PI/180.); for (auto* z : gridLevels) @@ -1319,17 +1327,17 @@ QList StarMgr::searchAround(const Vec3d& vv, double limFov, const int zone; for (GeodesicSearchInsideIterator it1(*geodesic_search_result,z->level);(zone = it1.next()) >= 0;) { - z->searchAround(core, zone,v,f,result); + z->searchAround(core, zone, v, withParallax, diffPos, f, result); //qDebug() << " " << zone; } //qDebug() << StelUtils::getEndLineChar() << "search border(" << it->first << "):"; for (GeodesicSearchBorderIterator it1(*geodesic_search_result,z->level); (zone = it1.next()) >= 0;) { - z->searchAround(core, zone,v,f,result); + z->searchAround(core, zone, v, withParallax, diffPos, f, result); //qDebug() << " " << zone; } // always search the last zone because it is a global zone - z->searchAround(core, (20<<(z->level<<1)), v, f, result); + z->searchAround(core, (20<<(z->level<<1)), v, withParallax, diffPos, f, result); } return result; } diff --git a/src/core/modules/StarWrapper.hpp b/src/core/modules/StarWrapper.hpp index 1ff309ad5c5e6..5fd2454cbd965 100644 --- a/src/core/modules/StarWrapper.hpp +++ b/src/core/modules/StarWrapper.hpp @@ -77,24 +77,25 @@ template class StarWrapper : public StarWrapperBase const Star *star) : a(array), z(zone), s(star) {} Vec3d getJ2000EquatorialPos(const StelCore* core) const override { - Vec3f v; + Vec3d v; s->getJ2000Pos((core->getJDE()-STAR_CATALOG_JDEPOCH)/365.25, v); + double withParallax = core->getUseParallax() * core->getParallaxFactor(); + if (withParallax) { + const Vec3d diffPos = core->getParallaxDiff(core->getJDE()); + s->getPlxEffect(withParallax * s->getPlx(), v, diffPos); + v.normalize(); + } + // Aberration: Explanatory Supplement 2013, (7.38). We must get the observer planet speed vector in Equatorial J2000 coordinates. if (core->getUseAberration()) { - Vec3d vel=core->getCurrentPlanet()->getHeliocentricEclipticVelocity(); - vel=StelCore::matVsop87ToJ2000*vel*core->getAberrationFactor()*(AU/(86400.0*SPEED_OF_LIGHT)); - //Q_ASSERT_X(fabs(v.lengthSquared()-1.0f)<0.0001f, "StarWrapper aberration", "vertex length not unity"); - v.normalize(); // Required? YES! - Vec3d pos=v.toVec3d()+vel; - pos.normalize(); - return pos; - } - else - { - return v.toVec3d(); + const Vec3d vel = core->getAberrationVec(core->getJDE()); + v+=vel; + v.normalize(); } + + return v; } Vec3f getInfoColor(void) const override { diff --git a/src/core/modules/ZoneArray.cpp b/src/core/modules/ZoneArray.cpp index d0ef2bd8fac21..bfeec43a3ed65 100644 --- a/src/core/modules/ZoneArray.cpp +++ b/src/core/modules/ZoneArray.cpp @@ -424,10 +424,10 @@ template void SpecialZoneArray::draw(StelPainter* sPainter, int index, bool isInsideViewport, const RCMag* rcmag_table, int limitMagIndex, StelCore* core, int maxMagStarName, float names_brightness, const QVector &boundingCaps, - const bool withAberration, const Vec3f vel) const + const bool withAberration, const Vec3d vel, const double withParallax, const Vec3d diffPos) const { StelSkyDrawer* drawer = core->getSkyDrawer(); - Vec3f vf; + Vec3d v; const float dyrs = static_cast(core->getJDE()-STAR_CATALOG_JDEPOCH)/365.25; const Extinction& extinction=core->getSkyDrawer()->getExtinction(); @@ -465,22 +465,23 @@ void SpecialZoneArray::draw(StelPainter* sPainter, int index, bool isInsid // only recompute if has time dependence and time is far away bool recomputeMag = (s->getPreciseAstrometricFlag() && (fabs(dyrs) > 5000.)); + double Plx = s->getPlx(); if (recomputeMag) { // don't do full solution, can be very slow, just estimate here // estimate parallax from radial velocity and total proper motion - double Plx = s->getPlx(); double vr = s->getRV(); Vec3d pmvec0(s->getDx0(), s->getDx1(), s->getDx2()); pmvec0 = pmvec0 * MAS2RAD; double pmr0 = vr * Plx / (AU / JYEAR_SECONDS) * MAS2RAD; double pmtotsqr = (pmvec0[0] * pmvec0[0] + pmvec0[1] * pmvec0[1] + pmvec0[2] * pmvec0[2]); double f = 1. / sqrt(1. + 2. * pmr0 * dyrs + (pmtotsqr + pmr0*pmr0)*dyrs*dyrs); + Plx *= f; float magOffset = 5.f * log10(1/f); starMag += magOffset * 1000.; // if we reach here we might as well compute the position too Vec3d r(s->getX0(), s->getX1(), s->getX2()); Vec3d u = (r * (1. + pmr0 * dyrs) + pmvec0 * dyrs) * f; - vf.set(u[0], u[1], u[2]); + v.set(u[0], u[1], u[2]); } // recompute magIndex with the new magnitude magIndex = static_cast((starMag - (mag_min - 7000.)) * 0.02); // 1 / (50 milli-mag) @@ -494,27 +495,30 @@ void SpecialZoneArray::draw(StelPainter* sPainter, int index, bool isInsid // Get the star position from the array, only do it if not already computed // put it here because potentially cutoffMagStep bigger than magIndex and no computation needed if (!recomputeMag) { - s->getJ2000Pos(dyrs, vf); + s->getJ2000Pos(dyrs, v); + } + + if (withParallax) { + s->getPlxEffect(withParallax * Plx, v, diffPos); + v.normalize(); } // Aberration: vf contains Equatorial J2000 position. if (withAberration) { //Q_ASSERT_X(fabs(vf.lengthSquared()-1.0f)<0.0001f, "ZoneArray aberration", "vertex length not unity"); - vf.normalize(); // required! - vf+=vel; - vf.normalize(); + v += vel; + v.normalize(); } // If the star zone is not strictly contained inside the viewport, eliminate from the // beginning the stars actually outside viewport. if (!isInsideViewport) { - vf.normalize(); bool isVisible = true; for (const auto& cap : boundingCaps) { - if (!cap.contains(vf)) + if (!cap.contains(v)) { isVisible = false; continue; @@ -528,7 +532,7 @@ void SpecialZoneArray::draw(StelPainter* sPainter, int index, bool isInsid float twinkleFactor=1.0f; // allow height-dependent twinkle. if (withExtinction) { - Vec3f altAz(vf); + Vec3d altAz(v); altAz.normalize(); core->j2000ToAltAzInPlaceNoRefraction(&altAz); float extMagShift=0.0f; @@ -537,32 +541,32 @@ void SpecialZoneArray::draw(StelPainter* sPainter, int index, bool isInsid if (extinctedMagIndex >= cutoffMagStep || extinctedMagIndex<0) // i.e., if extincted it is dimmer than cutoff or extinctedMagIndex is negative (missing star catalog), so remove continue; tmpRcmag = &rcmag_table[extinctedMagIndex]; - twinkleFactor=qMin(1.0f, 1.0f-0.9f*altAz[2]); // suppress twinkling in higher altitudes. Keep 0.1 twinkle amount in zenith. + twinkleFactor=qMin(1.0, 1.0-0.9*altAz[2]); // suppress twinkling in higher altitudes. Keep 0.1 twinkle amount in zenith. } - if (drawer->drawPointSource(sPainter, vf.toVec3d(), *tmpRcmag, s->getBVIndex(), !isInsideViewport, twinkleFactor) && s->hasName() && extinctedMagIndex < maxMagStarName && s->hasComponentID()<=1) + if (drawer->drawPointSource(sPainter, v, *tmpRcmag, s->getBVIndex(), !isInsideViewport, twinkleFactor) && s->hasName() && extinctedMagIndex < maxMagStarName && s->hasComponentID()<=1) { const float offset = tmpRcmag->radius*0.7f; - const Vec3f colorr = StelSkyDrawer::indexToColor(s->getBVIndex())*0.75f; - sPainter->setColor(colorr,names_brightness); - sPainter->drawText(vf.toVec3d(), s->getScreenNameI18n(), 0, offset, offset, false); + const Vec3f color = StelSkyDrawer::indexToColor(s->getBVIndex())*0.75f; + sPainter->setColor(color, names_brightness); + sPainter->drawText(v, s->getScreenNameI18n(), 0, offset, offset, false); } } } template -void SpecialZoneArray::searchAround(const StelCore* core, int index, const Vec3d &v, double cosLimFov, - QList &result) +void SpecialZoneArray::searchAround(const StelCore* core, int index, const Vec3d &v, const double withParallax, const Vec3d diffPos, + double cosLimFov, QList &result) { const float dyrs = static_cast(core->getJDE()-STAR_CATALOG_JDEPOCH)/365.25; const SpecialZoneData *const z = getZones()+index; - Vec3f tmp; - Vec3f vf = v.toVec3f(); + Vec3d tmp; for (const Star* s=z->getStars();sgetStars()+z->size;++s) { s->getJ2000Pos(dyrs, tmp); + s->getPlxEffect(withParallax * s->getPlx(), tmp, diffPos); tmp.normalize(); - if (tmp*vf >= static_cast(cosLimFov)) + if (tmp * v >= cosLimFov) { // TODO: do not select stars that are too faint to display result.push_back(s->createStelObject(this,z)); diff --git a/src/core/modules/ZoneArray.hpp b/src/core/modules/ZoneArray.hpp index 317d499076074..bd9fd79c60ac2 100644 --- a/src/core/modules/ZoneArray.hpp +++ b/src/core/modules/ZoneArray.hpp @@ -95,8 +95,8 @@ class ZoneArray virtual void updateHipIndex(HipIndexStruct hipIndex[]) const {Q_UNUSED(hipIndex)} //! Pure virtual method. See subclass implementation. - virtual void searchAround(const StelCore* core, int index,const Vec3d &v,double cosLimFov, - QList &result) = 0; + virtual void searchAround(const StelCore* core, int index, const Vec3d &v, const double withParallax, const Vec3d diffPos, + double cosLimFov, QList &result) = 0; virtual StelObjectP searchGaiaID(int index, const StarId source_id, int& matched) const = 0; virtual void searchGaiaIDepochPos(const StarId source_id, float dyrs, double & RA, @@ -111,7 +111,7 @@ class ZoneArray const RCMag* rcmag_table, int limitMagIndex, StelCore* core, int maxMagStarName, float names_brightness, const QVector& boundingCaps, - const bool withAberration, const Vec3f vel) const = 0; + const bool withAberration, const Vec3d vel, const double withParallax, const Vec3d diffPos) const = 0; //! Get whether or not the catalog was successfully loaded. //! @return @c true if at least one zone was loaded, otherwise @c false @@ -183,10 +183,10 @@ class SpecialZoneArray : public ZoneArray const RCMag *rcmag_table, int limitMagIndex, StelCore* core, int maxMagStarName, float names_brightness, const QVector& boundingCaps, - const bool withAberration, const Vec3f vel) const override; + const bool withAberration, const Vec3d vel, const double withParallax, const Vec3d diffPos) const override; - void searchAround(const StelCore* core, int index,const Vec3d &v,double cosLimFov, - QList &result) override; + void searchAround(const StelCore* core, int index, const Vec3d &v, const double withParallax, + const Vec3d diffPos, double cosLimFov, QList &result) override; StelObjectP searchGaiaID(int index, const StarId source_id, int& matched) const override; void searchGaiaIDepochPos(const StarId source_id, float dyrs, double & RA, diff --git a/src/core/planetsephems/EphemWrapper.cpp b/src/core/planetsephems/EphemWrapper.cpp index 40ee4048de5e9..0fca1205bb6f0 100644 --- a/src/core/planetsephems/EphemWrapper.cpp +++ b/src/core/planetsephems/EphemWrapper.cpp @@ -44,6 +44,7 @@ Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. #define EPHEM_URANUS_ID 6 #define EPHEM_NEPTUNE_ID 7 #define EPHEM_PLUTO_ID 8 +#define EPHEM_SUN_ID 10 // GZ No idea what IMD stands for? //#define EPHEM_IMD_EARTH_ID 2 @@ -51,6 +52,7 @@ Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. #define EPHEM_JPL_PLUTO_ID 9 #define EPHEM_JPL_MOON_ID 10 #define EPHEM_JPL_SUN_ID 11 +#define EPHEM_JPL_SSB_ID 12 /** JPL PLANET ID LIST ** 1 = mercury 8 = neptune ** @@ -165,6 +167,45 @@ void get_planet_helio_coordsv(const double jd, double xyz[3], double xyzdot[3], xyzdot[0]=xyz6[3]; xyzdot[1]=xyz6[4]; xyzdot[2]=xyz6[5]; } +// get barycentric instead of heliocentric coordinates +void get_planet_bary_coordsv(const double jd, double xyz[3], double xyzdot[3], const int planet_id) +{ + bool deOk=false; + double xyz6[6]; + if(!std::isfinite(jd)) + { + qDebug() << "get_planet_bary_coordsv(): SKIPPED CoordCalc, jd is infinite/nan: " << jd; + return; + } + + if(EphemWrapper::use_de440(jd)) + { + deOk=GetDe440Coor(jd, planet_id + 1, xyz6, EPHEM_JPL_SSB_ID); + } + else if(EphemWrapper::use_de441(jd)) + { + deOk=GetDe441Coor(jd, planet_id + 1, xyz6, EPHEM_JPL_SSB_ID); + } + else if(EphemWrapper::use_de430(jd)) + { + deOk=GetDe430Coor(jd, planet_id + 1, xyz6, EPHEM_JPL_SSB_ID); + } + else if(EphemWrapper::use_de431(jd)) + { + deOk=GetDe431Coor(jd, planet_id + 1, xyz6, EPHEM_JPL_SSB_ID); + } + // VSOP87 + if (!deOk) //VSOP87 as fallback + { + xyz[0] =0; xyz[1] =0; xyz[2] =0; + xyzdot[0]=0; xyzdot[1]=0; xyzdot[2]=0; + } + else { + xyz[0] =xyz6[0]; xyz[1] =xyz6[1]; xyz[2] =xyz6[2]; + xyzdot[0]=xyz6[3]; xyzdot[1]=xyz6[4]; xyzdot[2]=xyz6[5]; + } +} + // Osculating positions for time JDE in elements for JDE0, if possible by the theory used (e.g. VSOP87). // For ephemerides like DE4xx, JDE0 is irrelevant. void get_planet_helio_osculating_coordsv(double jd0, double jd, double xyz[3], double xyzdot[3], int planet_id) @@ -246,15 +287,20 @@ void get_pluto_helio_coordsv(double jd,double xyz[3], double xyzdot[3], void* un } } -/* Return 0 for the sun */ void get_sun_helio_coordsv(double jd,double xyz[3], double xyzdot[3], void* unused) { - Q_UNUSED(jd) Q_UNUSED(unused) xyz[0] =0.; xyz[1] =0.; xyz[2] =0.; xyzdot[0]=0.; xyzdot[1]=0.; xyzdot[2]=0.; } +/* Return barycentric coordinates for the sun */ +void get_sun_barycentric_coordsv(double jd,double xyz[3], double xyzdot[3], void* unused) +{ + Q_UNUSED(unused) + get_planet_bary_coordsv(jd, xyz, xyzdot, EPHEM_SUN_ID); +} + void get_mercury_helio_coordsv(double jd,double xyz[3], double xyzdot[3], void* unused) { Q_UNUSED(unused) diff --git a/src/core/planetsephems/EphemWrapper.hpp b/src/core/planetsephems/EphemWrapper.hpp index 2c3bb47a2b808..02dafb879380b 100644 --- a/src/core/planetsephems/EphemWrapper.hpp +++ b/src/core/planetsephems/EphemWrapper.hpp @@ -56,6 +56,7 @@ class EphemWrapper{ }; // These functions have an unused void pointer to be compatible to PosFuncType in SolarSystem and Planet classes. +void get_sun_barycentric_coordsv(double jd,double xyz[3], double xyzdot[3], void*); void get_sun_helio_coordsv(double jd,double xyz[3], double xyzdot[3], void*); void get_mercury_helio_coordsv(double jd,double xyz[3], double xyzdot[3], void*); void get_venus_helio_coordsv(double jd,double xyz[3], double xyzdot[3], void*); diff --git a/src/gui/ConfigurationDialog.cpp b/src/gui/ConfigurationDialog.cpp index 2df6ec487ac83..c1e7d174d221d 100644 --- a/src/gui/ConfigurationDialog.cpp +++ b/src/gui/ConfigurationDialog.cpp @@ -209,6 +209,8 @@ void ConfigurationDialog::createDialogContent() connectBoolProperty(ui->nutationCheckBox, "StelCore.flagUseNutation"); connectBoolProperty(ui->aberrationCheckBox, "StelCore.flagUseAberration"); connectDoubleProperty(ui->aberrationSpinBox, "StelCore.aberrationFactor"); + connectBoolProperty(ui->parallaxCheckBox, "StelCore.flagUseParallax"); + connectDoubleProperty(ui->parallaxSpinBox, "StelCore.parallaxFactor"); connectBoolProperty(ui->topocentricCheckBox, "StelCore.flagUseTopocentricCoordinates"); // Additional settings for selected object info @@ -1088,6 +1090,8 @@ void ConfigurationDialog::saveAllSettings() conf->setValue("astro/flag_nutation", core->getUseNutation()); conf->setValue("astro/flag_aberration", core->getUseAberration()); conf->setValue("astro/aberration_factor", core->getAberrationFactor()); + conf->setValue("astro/flag_parallax", core->getUseParallax()); + conf->setValue("astro/parallax_factor", core->getParallaxFactor()); conf->setValue("astro/flag_topocentric_coordinates", core->getUseTopocentricCoordinates()); conf->setValue("astro/solar_system_threads", propMgr->getStelPropertyValue("SolarSystem.extraThreads").toInt()); diff --git a/src/gui/configurationDialog.ui b/src/gui/configurationDialog.ui index 93663bec027ec..ae0e51d88c603 100644 --- a/src/gui/configurationDialog.ui +++ b/src/gui/configurationDialog.ui @@ -1749,21 +1749,17 @@ 0 - - + + - - - Info text color at daylight + + + Dithering - - - Info text color at daylight - - + @@ -1847,17 +1843,37 @@ + + + + When enabled, the "auto zoom out" key will also set the initial viewing direction + + + Auto-direction at zoom out + + + + + + + Allow mouse to pan (drag) + + + Enable mouse navigation + + + - + - + - Additional threads for solar system + Framerate intent: - + Qt::Horizontal @@ -1870,157 +1886,94 @@ - - - A few additional threads may improve speed with many solar system objects. Observe what works best on your multicore system. - - - 31 - - - - - - - - - + - Font size: Screen + min: - + - Base font size for on-screen text + Minimum intended FPS between user interaction. Set very low to conserve energy or save CPU use. Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + false + - 5 + 1 - 50 - - - 13 + 1000 - - - Graphical user interface - + - GUI + max: - + - Base font size for dialogs + Maximum allowed FPS. 1000 just means "as fast as possible". Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + false + - 7 + 5 - 50 + 1000 - 13 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Pre-select fonts for a particular writing system - - - true - - - QComboBox::NoInsert - - - - - - - Application font - - - - - - - Store font settings - - - Save - - - - :/graphicGui/uibtSave.png - :/graphicGui/uibtSave-disabled.png:/graphicGui/uibtSave.png + 1000 - - + + - When enabled, the "auto zoom out" key will also set the initial viewing direction + Force date/time tab and focus on day input when activating date panel - Auto-direction at zoom out + Set keyboard focus to day input - - + + - Align labels with the screen center + Allow mouse to zoom (mousewheel) - Gravity labels + Enable mouse zooming - - - - - - Dithering - - - - - - - + + + + Spheric mirror distortion is used when projecting Stellarium onto a spheric mirror for low-cost planetarium systems. + + + Spheric mirror distortion + + + true + + @@ -2067,7 +2020,7 @@ - + Kinetic scrolling means dragging text panels directly instead of dragging window handles. @@ -2077,50 +2030,17 @@ - - - - Flash a short message when toggling mount mode. - - - Indication for mount mode - - - - - - Force date/time tab and focus on day input when activating date panel - - - Set keyboard focus to day input - - - - - - - Spheric mirror distortion is used when projecting Stellarium onto a spheric mirror for low-cost planetarium systems. - - - Spheric mirror distortion - - - true - - - - - + - + - Framerate intent: + Additional threads for solar system - + Qt::Horizontal @@ -2133,85 +2053,194 @@ - + + + A few additional threads may improve speed with many solar system objects. Observe what works best on your multicore system. + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 31 + + + + + + + + + Align labels with the screen center + + + Gravity labels + + + + + + + - min: + Font size: Screen - + - Minimum intended FPS between user interaction. Set very low to conserve energy or save CPU use. + Base font size for on-screen text - - false + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - 1 + 5 - 1000 + 50 + + + 13 - + + + Graphical user interface + - max: + GUI - + - Maximum allowed FPS. 1000 just means "as fast as possible". + Base font size for dialogs - - false + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - 5 + 7 - 1000 + 50 - 1000 + 13 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Pre-select fonts for a particular writing system + + + true + + + QComboBox::NoInsert + + + + + + + Application font + + + + + + + Store font settings + + + Save + + + + :/graphicGui/uibtSave.png + :/graphicGui/uibtSave-disabled.png:/graphicGui/uibtSave.png - - - - Allow mouse to zoom (mousewheel) - - - Enable mouse zooming - - - - - - - Allow mouse to pan (drag) - - - Enable mouse navigation - - - - - 0 - - + + + + + + + 0 + 0 + + + + Parallax is the apparent shift in the position of an object when viewed from two different points. + + + Parallax + + + + + + + Exaggerate parallax (for didactic explanations) + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 0 + + + 1.000000000000000 + + + 10000.000000000000000 + + + 1.000000000000000 + + + 1.000000000000000 + + + + + + + + + 0 + 0 + + Annual aberration is an annual wobble in positions, amounting to max. about 20 arcseconds for observers on Earth. @@ -2225,6 +2254,9 @@ Exaggerate aberration (for didactic explanations) + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + 1 @@ -2241,17 +2273,14 @@ - - - - Activate to view as seen from surface of the planet (recommended). If switched off, display planetocentric view. - + + - Topocentric coordinates + Include - + Nutation is a small wobble of Earth's axis, amounting to a few arcseconds. @@ -2261,10 +2290,41 @@ - - + + + + Activate to view as seen from surface of the planet (recommended). If switched off, display planetocentric view. + - Include + Topocentric coordinates + + + + + + + + + Flash a short message when toggling mount mode. + + + Indication for mount mode + + + + + + + + + Info text color at daylight + + + + + + + Info text color at daylight @@ -2444,6 +2504,9 @@ Dots per Inch (for printing size computation in image metadata). Native print size in inches is then pixelSize/dpi. + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + 50