Pass current latitude to moon position calculations to compenstate for it's
parallax.
This commit is contained in:
parent
09b67e9440
commit
84482ad30d
@ -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] );
|
||||
|
||||
}
|
||||
|
||||
|
@ -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; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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();
|
||||
};
|
||||
|
||||
|
@ -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
|
||||
|
@ -45,7 +45,6 @@ public:
|
||||
void updatePosition(FGTime *t);
|
||||
double getM();
|
||||
double getw();
|
||||
//double getLon();
|
||||
double getxs();
|
||||
double getys();
|
||||
double getDistance();
|
||||
|
Loading…
Reference in New Issue
Block a user