From: curt Date: Thu, 16 Mar 2000 03:14:23 +0000 (+0000) Subject: Pass current latitude to moon position calculations to compenstate for it's X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=84482ad30d179259b6a76a5d2d0b1d2d9a1d62d5;p=simgear.git Pass current latitude to moon position calculations to compenstate for it's parallax. --- diff --git a/simgear/ephemeris/ephemeris.cxx b/simgear/ephemeris/ephemeris.cxx index c795a858..2f96b9bc 100644 --- a/simgear/ephemeris/ephemeris.cxx +++ b/simgear/ephemeris/ephemeris.cxx @@ -55,10 +55,10 @@ FGEphemeris::~FGEphemeris( void ) { // Update (recalculate) the positions of all objects for the specified // time -void FGEphemeris::update( FGTime *t ) { +void FGEphemeris::update( FGTime *t, double lat ) { // update object positions our_sun->updatePosition( t ); - moon->updatePosition( t, our_sun ); + moon->updatePosition( t, lat, our_sun ); mercury->updatePosition( t, our_sun ); venus->updatePosition( t, our_sun ); mars->updatePosition( t, our_sun ); @@ -68,6 +68,7 @@ void FGEphemeris::update( FGTime *t ) { neptune->updatePosition( t, our_sun ); // update planets list + nplanets = 7; mercury->getPos( &planets[0][0], &planets[0][1], &planets[0][2] ); venus ->getPos( &planets[1][0], &planets[1][1], &planets[1][2] ); mars ->getPos( &planets[2][0], &planets[2][1], &planets[2][2] ); @@ -75,6 +76,5 @@ void FGEphemeris::update( FGTime *t ) { saturn ->getPos( &planets[4][0], &planets[4][1], &planets[4][2] ); uranus ->getPos( &planets[5][0], &planets[5][1], &planets[5][2] ); neptune->getPos( &planets[6][0], &planets[6][1], &planets[6][2] ); - } diff --git a/simgear/ephemeris/ephemeris.hxx b/simgear/ephemeris/ephemeris.hxx index b57fc02c..7b9a7c42 100644 --- a/simgear/ephemeris/ephemeris.hxx +++ b/simgear/ephemeris/ephemeris.hxx @@ -53,12 +53,13 @@ class FGEphemeris { Uranus *uranus; Neptune *neptune; - // 9 planets - earth - pluto which we don't draw = 7 + // 9 planets, minus earth, minus pluto which we don't draw = 7 // planets[i][0] = Right Ascension // planets[i][1] = Declination // planets[i][2] = Magnitude + int nplanets; sgdVec3 planets[7]; - + public: // Constructor @@ -69,9 +70,10 @@ public: // Update (recalculate) the positions of all objects for the // specified time - void update(FGTime *t); + void update(FGTime *t, double lat); - // sun position + // sun + inline Star *get_sun() const { return our_sun; } inline double getSunRightAscension() const { return our_sun->getRightAscension(); } @@ -79,7 +81,8 @@ public: return our_sun->getDeclination(); } - // moon position + // moon + inline Moon *get_moon() const { return moon; } inline double getMoonRightAscension() const { return moon->getRightAscension(); } @@ -88,9 +91,8 @@ public: } // planets - inline sgdVec3 *getPlanets() const { - return planets; - } + inline int getNumPlanets() const { return nplanets; } + inline sgdVec3 *getPlanets() { return planets; } }; diff --git a/simgear/ephemeris/moon.cxx b/simgear/ephemeris/moon.cxx index 78fbc886..d6042498 100644 --- a/simgear/ephemeris/moon.cxx +++ b/simgear/ephemeris/moon.cxx @@ -206,7 +206,7 @@ void Moon::setHalo() * the position of the moon as seen from the current position on the surface * of the moon. ****************************************************************************/ -void Moon::updatePosition(FGTime *t, Star *ourSun) +void Moon::updatePosition(FGTime *t, double lat, Star *ourSun) { double eccAnom, ecl, actTime, @@ -298,11 +298,11 @@ void Moon::updatePosition(FGTime *t, Star *ourSun) // FG_LOG( FG_GENERAL, FG_INFO, "r = " << r << " mpar = " << mpar ); // FG_LOG( FG_GENERAL, FG_INFO, "lat = " << f->get_Latitude() ); - gclat = f->get_Latitude() - 0.003358 * - sin (2 * DEG_TO_RAD * f->get_Latitude() ); + gclat = lat - 0.003358 * + sin (2 * DEG_TO_RAD * lat ); // FG_LOG( FG_GENERAL, FG_INFO, "gclat = " << gclat ); - rho = 0.99883 + 0.00167 * cos(2 * DEG_TO_RAD * f->get_Latitude()); + rho = 0.99883 + 0.00167 * cos(2 * DEG_TO_RAD * lat); // FG_LOG( FG_GENERAL, FG_INFO, "rho = " << rho ); if (geoRa < 0) diff --git a/simgear/ephemeris/moon.hxx b/simgear/ephemeris/moon.hxx index bb8b083f..91210753 100644 --- a/simgear/ephemeris/moon.hxx +++ b/simgear/ephemeris/moon.hxx @@ -55,7 +55,7 @@ public: Moon( FGTime *t); Moon(); ~Moon(); - void updatePosition(FGTime *t, Star *ourSun); + void updatePosition(FGTime *t, double lat, Star *ourSun); // void newImage(); }; diff --git a/simgear/ephemeris/solarsystem.cxx b/simgear/ephemeris/solarsystem.cxx index 35692e4c..001f7958 100644 --- a/simgear/ephemeris/solarsystem.cxx +++ b/simgear/ephemeris/solarsystem.cxx @@ -140,7 +140,7 @@ void SolarSystem::rebuild() // solar eclipse. This is yet untested though... // Euhh, actually the ecplise doesn't work... - earthsMoon->newImage(); + // earthsMoon->newImage(); // Step 2b: Add the sun // ourSun->newImage(); // Step 2c: Add the planets diff --git a/simgear/ephemeris/star.hxx b/simgear/ephemeris/star.hxx index 38786541..7b3b02a5 100644 --- a/simgear/ephemeris/star.hxx +++ b/simgear/ephemeris/star.hxx @@ -45,7 +45,6 @@ public: void updatePosition(FGTime *t); double getM(); double getw(); - //double getLon(); double getxs(); double getys(); double getDistance();