|
45 | 45 | #include "Planet.hpp" |
46 | 46 | #include "StelUtils.hpp" |
47 | 47 | #include "StelHealpix.hpp" |
| 48 | +#include "SolarSystem.hpp" |
48 | 49 |
|
49 | 50 | #include <QTextStream> |
50 | 51 | #include <QFile> |
@@ -1242,16 +1243,26 @@ void StarMgr::draw(StelCore* core) |
1242 | 1243 | maxMagStarName = x; |
1243 | 1244 | } |
1244 | 1245 | int zone; |
1245 | | - const double withParallax = core->getUseParallax() * core->getParallaxFactor(); |
1246 | | - double orbital_period = core->getCurrentPlanet()->getSiderealPeriod() / 365.25; // in earth years |
1247 | | - // get orbital_radius in AU using Kepler's third law |
1248 | | - double orbital_radius = pow(orbital_period, 2.0/3.0); |
| 1246 | + double withParallax = core->getUseParallax() * core->getParallaxFactor(); |
| 1247 | + Vec3d diffPos(0., 0., 0.); |
| 1248 | + if (withParallax) { |
| 1249 | + static SolarSystem *ssystem=GETSTELMODULE(SolarSystem); |
| 1250 | + const PlanetP earth = ssystem->getEarth(); |
| 1251 | + // diff between earth location at STAR_CATALOG_JDEPOCH and current location |
| 1252 | + Vec3d earthPosCatalog = earth->getHeliocentricEclipticPos(STAR_CATALOG_JDEPOCH); |
| 1253 | + Vec3d PosNow = core->getCurrentPlanet()->getHeliocentricEclipticPos(core->getJDE()); |
| 1254 | + double obliquity = earth->getRotObliquity(core->getJDE()); // need to always use Earth's obliquity because thats what the catalog is based on |
| 1255 | + // Transform from heliocentric ecliptic to equatorial coordinates |
| 1256 | + earthPosCatalog.set(earthPosCatalog[0], earthPosCatalog[1]*cos(obliquity)-earthPosCatalog[2]*sin(obliquity), earthPosCatalog[1]*sin(obliquity)+earthPosCatalog[2]*cos(obliquity)); |
| 1257 | + PosNow.set(PosNow[0], PosNow[1]*cos(obliquity)-PosNow[2]*sin(obliquity), PosNow[1]*sin(obliquity)+PosNow[2]*cos(obliquity)); |
| 1258 | + diffPos = earthPosCatalog - PosNow; |
| 1259 | + } |
1249 | 1260 | for (GeodesicSearchInsideIterator it1(*geodesic_search_result,z->level);(zone = it1.next()) >= 0;) |
1250 | | - z->draw(&sPainter, zone, true, rcmag_table, limitMagIndex, core, maxMagStarName, names_brightness, viewportCaps, withAberration, velf, withParallax, orbital_period, orbital_radius); |
| 1261 | + z->draw(&sPainter, zone, true, rcmag_table, limitMagIndex, core, maxMagStarName, names_brightness, viewportCaps, withAberration, velf, withParallax, diffPos); |
1251 | 1262 | for (GeodesicSearchBorderIterator it1(*geodesic_search_result,z->level);(zone = it1.next()) >= 0;) |
1252 | | - z->draw(&sPainter, zone, false, rcmag_table, limitMagIndex, core, maxMagStarName,names_brightness, viewportCaps, withAberration, velf, withParallax, orbital_period, orbital_radius); |
| 1263 | + z->draw(&sPainter, zone, false, rcmag_table, limitMagIndex, core, maxMagStarName,names_brightness, viewportCaps, withAberration, velf, withParallax, diffPos); |
1253 | 1264 | // always check the last zone because it is a global zone |
1254 | | - z->draw(&sPainter, (20<<(z->level<<1)), false, rcmag_table, limitMagIndex, core, maxMagStarName, names_brightness, viewportCaps, withAberration, velf, withParallax, orbital_period, orbital_radius); |
| 1265 | + z->draw(&sPainter, (20<<(z->level<<1)), false, rcmag_table, limitMagIndex, core, maxMagStarName, names_brightness, viewportCaps, withAberration, velf, withParallax, diffPos); |
1255 | 1266 | } |
1256 | 1267 | exit_loop: |
1257 | 1268 |
|
|
0 commit comments