From b5cf8b7323fb3c789c91442387bccb5b4452eea5 Mon Sep 17 00:00:00 2001 From: curt Date: Tue, 15 Sep 1998 04:27:49 +0000 Subject: [PATCH] Changes for new astro code. --- Time/fg_time.cxx | 11 ++++++++--- Time/sunpos.cxx | 30 ++++++++++++++++++++++++++---- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/Time/fg_time.cxx b/Time/fg_time.cxx index d75517be1..eb321c9b2 100644 --- a/Time/fg_time.cxx +++ b/Time/fg_time.cxx @@ -42,9 +42,10 @@ # include // for get/setitimer, gettimeofday, struct timeval #endif -#include -#include +//#include +//#include #include +#include #include #include #include @@ -66,7 +67,8 @@ fgTIME cur_time_params; // Force an update of the sky and lighting parameters static void local_update_sky_and_lighting_params( void ) { - fgSunInit(); + // fgSunInit(); + SolarSystem::theSolarSystem->rebuild(); cur_light_params.Update(); fgSkyColorsInit(); } @@ -425,6 +427,9 @@ void fgTimeUpdate(fgFLIGHT *f, fgTIME *t) { // $Log$ +// Revision 1.17 1998/09/15 04:27:49 curt +// Changes for new astro code. +// // Revision 1.16 1998/08/29 13:11:32 curt // Bernie Bright writes: // I've created some new classes to enable pointers-to-functions and diff --git a/Time/sunpos.cxx b/Time/sunpos.cxx index 2b746ca78..af40285cd 100644 --- a/Time/sunpos.cxx +++ b/Time/sunpos.cxx @@ -43,7 +43,8 @@ #include #include -#include +//#include +#include #include #include
#include @@ -55,6 +56,7 @@ #include "fg_time.hxx" #include "sunpos.hxx" +extern SolarSystem *solarSystem; #undef E @@ -255,8 +257,23 @@ void fgSunPosition(time_t ssue, double *lon, double *lat) { /* lambda = sun_ecliptic_longitude(ssue); */ /* ecliptic_to_equatorial(lambda, 0.0, &alpha, &delta); */ - ecliptic_to_equatorial (solarPosition.lonSun, 0.0, &alpha, &delta); - + //ecliptic_to_equatorial (solarPosition.lonSun, 0.0, &alpha, &delta); + + /* ********************************************************************** + * NOTE: in the next function, each time the sun's position is updated, the + * the sun's longitude is returned from solarSystem->sun. Note that the + * sun's position is updated at a much higher frequency than the rate at + * which the solar system's rebuilds occur. This is not a problem, however, + * because the fgSunPosition we're talking about here concerns the changing + * position of the sun due to the daily rotation of the earth. + * The ecliptic longitude, however, represents the position of the sun with + * respect to the stars, and completes just one cycle over the course of a + * year. Its therefore pretty safe to update the sun's longitude only once + * every ten minutes. (Comment added by Durk Talsma). + ************************************************************************/ + + ecliptic_to_equatorial( SolarSystem::theSolarSystem->getSun()->getLon(), + 0.0, &alpha, &delta ); tmp = alpha - (FG_2PI/24)*GST(ssue); if (tmp < -FG_PI) { do tmp += FG_2PI; @@ -286,7 +303,9 @@ static void fgSunPositionGST(double gst, double *lon, double *lat) { /* lambda = sun_ecliptic_longitude(ssue); */ /* ecliptic_to_equatorial(lambda, 0.0, &alpha, &delta); */ - ecliptic_to_equatorial (solarPosition.lonSun, 0.0, &alpha, &delta); + //ecliptic_to_equatorial (solarPosition.lonSun, 0.0, &alpha, &delta); + ecliptic_to_equatorial( SolarSystem::theSolarSystem->getSun()->getLon(), + 0.0, &alpha, &delta ); // tmp = alpha - (FG_2PI/24)*GST(ssue); tmp = alpha - (FG_2PI/24)*gst; @@ -404,6 +423,9 @@ void fgUpdateSunPos( void ) { // $Log$ +// Revision 1.12 1998/09/15 04:27:50 curt +// Changes for new astro code. +// // Revision 1.11 1998/08/12 21:13:22 curt // Optimizations by Norman Vine. // -- 2.39.2