From bd7e3a44f097becd91bbc834ba6f2d1d0cf9e1a8 Mon Sep 17 00:00:00 2001 From: curt Date: Mon, 19 Apr 1999 20:17:45 +0000 Subject: [PATCH] Added some debugging messages (mostly now commented out) to try to track down a moon display bug. Turned out to be a problem with calculating lst in fg_time.cxx --- Simulator/Astro/moon.cxx | 23 +++++++++++++++++++++++ Simulator/Astro/solarsystem.cxx | 4 ++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/Simulator/Astro/moon.cxx b/Simulator/Astro/moon.cxx index 970328a23..6c3e91bde 100644 --- a/Simulator/Astro/moon.cxx +++ b/Simulator/Astro/moon.cxx @@ -267,6 +267,11 @@ void Moon::updatePosition(FGTime *t, Star *ourSun) geoRa = atan2(ye, xe); geoDec = atan2(ze, sqrt(xe*xe + ye*ye)); + /* FG_LOG( FG_GENERAL, FG_INFO, + "(geocentric) geoRa = (" << (RAD_TO_DEG * geoRa) + << "), geoDec= (" << (RAD_TO_DEG * geoDec) << ")" ); */ + + // Given the moon's geocentric ra and dec, calculate its // topocentric ra and dec. i.e. the position as seen from the // surface of the earth, instead of the center of the earth @@ -274,16 +279,32 @@ void Moon::updatePosition(FGTime *t, Star *ourSun) // First calculate the moon's parrallax, that is, the apparent size of the // (equatorial) radius of the earth, as seen from the moon mpar = asin ( 1 / r); + // 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() ); + // FG_LOG( FG_GENERAL, FG_INFO, "gclat = " << gclat ); + rho = 0.99883 + 0.00167 * cos(2 * DEG_TO_RAD * f->get_Latitude()); + // FG_LOG( FG_GENERAL, FG_INFO, "rho = " << rho ); + if (geoRa < 0) geoRa += (2*FG_PI); HA = t->getLst() - (3.8197186 * geoRa); + /* FG_LOG( FG_GENERAL, FG_INFO, "t->getLst() = " << t->getLst() + << " HA = " << HA ); */ + g = atan (tan(gclat) / cos ((HA / 3.8197186))); + // FG_LOG( FG_GENERAL, FG_INFO, "g = " << g ); + rightAscension = geoRa - mpar * rho * cos(gclat) * sin(HA) / cos (geoDec); declination = geoDec - mpar * rho * sin (gclat) * sin (g - geoDec) / sin(g); + + /* FG_LOG( FG_GENERAL, FG_INFO, + "Ra = (" << (RAD_TO_DEG *rightAscension) + << "), Dec= (" << (RAD_TO_DEG *declination) << ")" ); */ } @@ -313,6 +334,8 @@ void Moon::newImage() if( moon_angle*RAD_TO_DEG < 100 ) { + FG_LOG( FG_ASTRO, FG_INFO, "Generating Moon Image" ); + /* x_2 = moon_angle * moon_angle; x_4 = x_2 * x_2; diff --git a/Simulator/Astro/solarsystem.cxx b/Simulator/Astro/solarsystem.cxx index d72147265..dee40dce3 100644 --- a/Simulator/Astro/solarsystem.cxx +++ b/Simulator/Astro/solarsystem.cxx @@ -105,10 +105,8 @@ void SolarSystem::rebuild() //GLfloat ambient; //GLfloat amb[4]; - glDisable(GL_LIGHTING); - // Step 1: update all the positions ourSun->updatePosition(t); earthsMoon->updatePosition(t, ourSun); @@ -129,6 +127,8 @@ void SolarSystem::rebuild() displayList = xglGenLists(1); + FG_LOG( FG_ASTRO, FG_INFO, "Rebuilding astro display list" ); + // Step 2: rebuild the display list xglNewList( displayList, GL_COMPILE); { -- 2.39.5