Pass current latitude to moon position calculations to compenstate for it's

parallax.
This commit is contained in:
curt 2000-03-16 03:14:23 +00:00
parent 09b67e9440
commit 84482ad30d
6 changed files with 19 additions and 18 deletions

View File

@ -55,10 +55,10 @@ FGEphemeris::~FGEphemeris( void ) {
// Update (recalculate) the positions of all objects for the specified // Update (recalculate) the positions of all objects for the specified
// time // time
void FGEphemeris::update( FGTime *t ) { void FGEphemeris::update( FGTime *t, double lat ) {
// update object positions // update object positions
our_sun->updatePosition( t ); our_sun->updatePosition( t );
moon->updatePosition( t, our_sun ); moon->updatePosition( t, lat, our_sun );
mercury->updatePosition( t, our_sun ); mercury->updatePosition( t, our_sun );
venus->updatePosition( t, our_sun ); venus->updatePosition( t, our_sun );
mars->updatePosition( t, our_sun ); mars->updatePosition( t, our_sun );
@ -68,6 +68,7 @@ void FGEphemeris::update( FGTime *t ) {
neptune->updatePosition( t, our_sun ); neptune->updatePosition( t, our_sun );
// update planets list // update planets list
nplanets = 7;
mercury->getPos( &planets[0][0], &planets[0][1], &planets[0][2] ); mercury->getPos( &planets[0][0], &planets[0][1], &planets[0][2] );
venus ->getPos( &planets[1][0], &planets[1][1], &planets[1][2] ); venus ->getPos( &planets[1][0], &planets[1][1], &planets[1][2] );
mars ->getPos( &planets[2][0], &planets[2][1], &planets[2][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] ); saturn ->getPos( &planets[4][0], &planets[4][1], &planets[4][2] );
uranus ->getPos( &planets[5][0], &planets[5][1], &planets[5][2] ); uranus ->getPos( &planets[5][0], &planets[5][1], &planets[5][2] );
neptune->getPos( &planets[6][0], &planets[6][1], &planets[6][2] ); neptune->getPos( &planets[6][0], &planets[6][1], &planets[6][2] );
} }

View File

@ -53,10 +53,11 @@ class FGEphemeris {
Uranus *uranus; Uranus *uranus;
Neptune *neptune; 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][0] = Right Ascension
// planets[i][1] = Declination // planets[i][1] = Declination
// planets[i][2] = Magnitude // planets[i][2] = Magnitude
int nplanets;
sgdVec3 planets[7]; sgdVec3 planets[7];
public: public:
@ -69,9 +70,10 @@ public:
// Update (recalculate) the positions of all objects for the // Update (recalculate) the positions of all objects for the
// specified time // 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 { inline double getSunRightAscension() const {
return our_sun->getRightAscension(); return our_sun->getRightAscension();
} }
@ -79,7 +81,8 @@ public:
return our_sun->getDeclination(); return our_sun->getDeclination();
} }
// moon position // moon
inline Moon *get_moon() const { return moon; }
inline double getMoonRightAscension() const { inline double getMoonRightAscension() const {
return moon->getRightAscension(); return moon->getRightAscension();
} }
@ -88,9 +91,8 @@ public:
} }
// planets // planets
inline sgdVec3 *getPlanets() const { inline int getNumPlanets() const { return nplanets; }
return planets; inline sgdVec3 *getPlanets() { return planets; }
}
}; };

View File

@ -206,7 +206,7 @@ void Moon::setHalo()
* the position of the moon as seen from the current position on the surface * the position of the moon as seen from the current position on the surface
* of the moon. * of the moon.
****************************************************************************/ ****************************************************************************/
void Moon::updatePosition(FGTime *t, Star *ourSun) void Moon::updatePosition(FGTime *t, double lat, Star *ourSun)
{ {
double double
eccAnom, ecl, actTime, 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, "r = " << r << " mpar = " << mpar );
// FG_LOG( FG_GENERAL, FG_INFO, "lat = " << f->get_Latitude() ); // FG_LOG( FG_GENERAL, FG_INFO, "lat = " << f->get_Latitude() );
gclat = f->get_Latitude() - 0.003358 * gclat = lat - 0.003358 *
sin (2 * DEG_TO_RAD * f->get_Latitude() ); sin (2 * DEG_TO_RAD * lat );
// FG_LOG( FG_GENERAL, FG_INFO, "gclat = " << gclat ); // 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 ); // FG_LOG( FG_GENERAL, FG_INFO, "rho = " << rho );
if (geoRa < 0) if (geoRa < 0)

View File

@ -55,7 +55,7 @@ public:
Moon( FGTime *t); Moon( FGTime *t);
Moon(); Moon();
~Moon(); ~Moon();
void updatePosition(FGTime *t, Star *ourSun); void updatePosition(FGTime *t, double lat, Star *ourSun);
// void newImage(); // void newImage();
}; };

View File

@ -140,7 +140,7 @@ void SolarSystem::rebuild()
// solar eclipse. This is yet untested though... // solar eclipse. This is yet untested though...
// Euhh, actually the ecplise doesn't work... // Euhh, actually the ecplise doesn't work...
earthsMoon->newImage(); // earthsMoon->newImage();
// Step 2b: Add the sun // Step 2b: Add the sun
// ourSun->newImage(); // ourSun->newImage();
// Step 2c: Add the planets // Step 2c: Add the planets

View File

@ -45,7 +45,6 @@ public:
void updatePosition(FGTime *t); void updatePosition(FGTime *t);
double getM(); double getM();
double getw(); double getw();
//double getLon();
double getxs(); double getxs();
double getys(); double getys();
double getDistance(); double getDistance();