1
0
Fork 0

Still trying to get those durned stars aligned properly.

This commit is contained in:
curt 1997-09-20 03:34:25 +00:00
parent e17c832c36
commit 14efd49c8b
6 changed files with 59 additions and 38 deletions

View file

@ -15,7 +15,8 @@ GLUTmain.o: GLUTmain.c GLUTkey.h fg_init.h views.h ../types.h \
../Joystick/joystick.h ../Math/fg_geodesy.h ../Math/polar.h \ ../Joystick/joystick.h ../Math/fg_geodesy.h ../Math/polar.h \
../Math/../types.h ../Scenery/mesh.h ../Scenery/scenery.h \ ../Math/../types.h ../Scenery/mesh.h ../Scenery/scenery.h \
../Scenery/../types.h ../Time/fg_time.h ../Time/../types.h \ ../Scenery/../types.h ../Time/fg_time.h ../Time/../types.h \
../Time/fg_timer.h ../Time/sunpos.h ../Weather/weather.h ../Time/../Flight/flight.h ../Time/fg_timer.h ../Time/sunpos.h \
../Weather/weather.h
fg_init.o: fg_init.c fg_init.h views.h ../types.h ../Flight/flight.h \ fg_init.o: fg_init.c fg_init.h views.h ../types.h ../Flight/flight.h \
../Flight/Slew/slew.h ../Flight/LaRCsim/ls_interface.h \ ../Flight/Slew/slew.h ../Flight/LaRCsim/ls_interface.h \
../Flight/LaRCsim/../flight.h ../Math/mat3.h ../constants.h \ ../Flight/LaRCsim/../flight.h ../Math/mat3.h ../constants.h \
@ -26,7 +27,8 @@ fg_init.o: fg_init.c fg_init.h views.h ../types.h ../Flight/flight.h \
../Cockpit/../Flight/flight.h ../Cockpit/../Controls/controls.h \ ../Cockpit/../Flight/flight.h ../Cockpit/../Controls/controls.h \
../Joystick/joystick.h ../Math/fg_random.h ../Scenery/mesh.h \ ../Joystick/joystick.h ../Math/fg_random.h ../Scenery/mesh.h \
../Scenery/scenery.h ../Scenery/../types.h ../Scenery/stars.h \ ../Scenery/scenery.h ../Scenery/../types.h ../Scenery/stars.h \
../Time/sunpos.h ../Time/../types.h ../Weather/weather.h ../Time/fg_time.h ../Time/../types.h ../Time/../Flight/flight.h \
../Time/sunpos.h ../Weather/weather.h
views.o: views.c views.h ../types.h ../Flight/flight.h \ views.o: views.c views.h ../types.h ../Flight/flight.h \
../Flight/Slew/slew.h ../Flight/LaRCsim/ls_interface.h \ ../Flight/Slew/slew.h ../Flight/LaRCsim/ls_interface.h \
../Flight/LaRCsim/../flight.h ../Math/mat3.h ../constants.h \ ../Flight/LaRCsim/../flight.h ../Math/mat3.h ../constants.h \

View file

@ -16,4 +16,5 @@ stars.o: stars.c stars.h ../constants.h ../general.h ../GLUT/views.h \
../GLUT/../Flight/LaRCsim/../flight.h ../GLUT/../Math/mat3.h \ ../GLUT/../Flight/LaRCsim/../flight.h ../GLUT/../Math/mat3.h \
../Aircraft/aircraft.h ../Aircraft/../Flight/flight.h \ ../Aircraft/aircraft.h ../Aircraft/../Flight/flight.h \
../Aircraft/../Controls/controls.h \ ../Aircraft/../Controls/controls.h \
../Aircraft/../Controls/../limits.h ../Aircraft/../Controls/../limits.h ../Time/fg_time.h \
../Time/../types.h ../Time/../Flight/flight.h

View file

@ -233,12 +233,12 @@ void fgStarsRender() {
glTranslatef( v->view_pos.x, v->view_pos.y, v->view_pos.z ); glTranslatef( v->view_pos.x, v->view_pos.y, v->view_pos.z );
angle = FG_2PI * t->lst / 24.0; angle = t->gst * 15.0; /* 15 degrees per hour rotation */
/* warp += 1.0 * DEG_TO_RAD; */ /* warp += 1.0; */
warp = 15.0 * DEG_TO_RAD; /* warp = 15.0; */
glRotatef( -(angle+warp) * RAD_TO_DEG, 0.0, 0.0, 1.0 ); warp = 0.0;
printf("Rotating stars by %.2f + %.2f\n", -angle * RAD_TO_DEG, glRotatef( -(angle+warp), 0.0, 0.0, 1.0 );
-warp * RAD_TO_DEG); printf("Rotating stars by %.2f degrees + %.2f degrees\n",-angle,-warp);
glCallList(stars[i]); glCallList(stars[i]);
@ -252,9 +252,12 @@ void fgStarsRender() {
/* $Log$ /* $Log$
/* Revision 1.9 1997/09/18 16:20:09 curt /* Revision 1.10 1997/09/20 03:34:32 curt
/* At dusk/dawn add/remove stars in stages. /* Still trying to get those durned stars aligned properly.
/* /*
* Revision 1.9 1997/09/18 16:20:09 curt
* At dusk/dawn add/remove stars in stages.
*
* Revision 1.8 1997/09/16 22:14:52 curt * Revision 1.8 1997/09/16 22:14:52 curt
* Tweaked time of day lighting equations. Don't draw stars during the day. * Tweaked time of day lighting equations. Don't draw stars during the day.
* *

View file

@ -1,11 +1,12 @@
fg_time.o: fg_time.c fg_time.h ../types.h fg_time.o: fg_time.c fg_time.h ../types.h ../Flight/flight.h \
../Flight/Slew/slew.h ../Flight/LaRCsim/ls_interface.h \
../Flight/LaRCsim/../flight.h ../constants.h ../Time/fg_time.h
fg_timer.o: fg_timer.c fg_timer.h fg_timer.o: fg_timer.c fg_timer.h
sidereal.o: sidereal.c sidereal.o: sidereal.c ../constants.h
sunpos.o: sunpos.c sunpos.h ../types.h fg_time.h ../constants.h \ sunpos.o: sunpos.c sunpos.h ../types.h fg_time.h ../Flight/flight.h \
../GLUT/views.h ../GLUT/../types.h ../GLUT/../Flight/flight.h \ ../Flight/Slew/slew.h ../Flight/LaRCsim/ls_interface.h \
../GLUT/../Flight/Slew/slew.h \ ../Flight/LaRCsim/../flight.h ../constants.h ../GLUT/views.h \
../GLUT/../Flight/LaRCsim/ls_interface.h \ ../GLUT/../types.h ../GLUT/../Flight/flight.h ../GLUT/../Math/mat3.h \
../GLUT/../Flight/LaRCsim/../flight.h ../GLUT/../Math/mat3.h \
../Math/fg_geodesy.h ../Math/mat3.h ../Math/polar.h \ ../Math/fg_geodesy.h ../Math/mat3.h ../Math/polar.h \
../Math/../types.h ../Math/../types.h
ttest.o: ttest.c ttest.o: ttest.c

View file

@ -45,7 +45,7 @@ struct fgTIME cur_time_params;
/* Initialize the time dependent variables */ /* Initialize the time dependent variables */
void fgTimeInit(struct fgTIME *t) { void fgTimeInit(struct fgTIME *t) {
t->lst_diff = -9999.0; t->gst_diff = -9999.0;
} }
@ -112,6 +112,8 @@ double utc_gst (double mjd) {
x /= 3600.0; x /= 3600.0;
gst = (1.0/SIDRATE)*hr + x; gst = (1.0/SIDRATE)*hr + x;
printf("gst => %.4f\n", gst);
return(gst); return(gst);
} }
@ -136,7 +138,7 @@ double sidereal_precise (double mjd, double lng) {
gst = utc_gst (mjd); gst = utc_gst (mjd);
lst = gst - RADHR (lng); lst = gst - RADHR (lng);
lst -= 24.0*floor(lst/24.0); lst -= 24.0*floor(lst/24.0);
printf ("%7.4f\n", lst); /* printf ("%7.4f\n", lst); */
/* that's all */ /* that's all */
return (lst); return (lst);
@ -199,7 +201,7 @@ double sidereal_course(struct tm *gmt, time_t now, double lng) {
/* Update the time dependent variables */ /* Update the time dependent variables */
void fgTimeUpdate(struct FLIGHT *f, struct fgTIME *t) { void fgTimeUpdate(struct FLIGHT *f, struct fgTIME *t) {
double lst_precise, lst_course; double gst_precise, gst_course;
static long int warp = 0; static long int warp = 0;
/* get current Unix calendar time (in seconds) */ /* get current Unix calendar time (in seconds) */
@ -230,31 +232,39 @@ void fgTimeUpdate(struct FLIGHT *f, struct fgTIME *t) {
printf("Current Longitude = %.3f\n", FG_Longitude * RAD_TO_DEG); printf("Current Longitude = %.3f\n", FG_Longitude * RAD_TO_DEG);
/* Calculate local side real time */ /* Calculate local side real time */
if ( t->lst_diff < -100.0 ) { if ( t->gst_diff < -100.0 ) {
/* first time through do the expensive calculation & cheap /* first time through do the expensive calculation & cheap
calculation to get the difference. */ calculation to get the difference. */
printf("First time, doing precise lst\n"); printf("First time, doing precise gst\n");
t->lst = lst_precise = t->gst = gst_precise = sidereal_precise(t->mjd, 0.00);
sidereal_precise(t->mjd, -(FG_Longitude * RAD_TO_DEG)); gst_course = sidereal_course(t->gmt, t->cur_time, 0.00);
lst_course = t->gst_diff = gst_precise - gst_course;
sidereal_course(t->gmt, t->cur_time, -(FG_Longitude * RAD_TO_DEG));
t->lst_diff = lst_precise - lst_course;
} else {
/* course + difference should drift off very slowly */
t->lst = t->lst =
sidereal_course(t->gmt, t->cur_time, -(FG_Longitude * RAD_TO_DEG)) sidereal_course(t->gmt, t->cur_time, -(FG_Longitude * RAD_TO_DEG))
+ t->lst_diff; + t->gst_diff;
} else {
/* course + difference should drift off very slowly */
t->gst =
sidereal_course(t->gmt, t->cur_time, 0.00) + t->gst_diff;
t->lst =
sidereal_course(t->gmt, t->cur_time, -(FG_Longitude * RAD_TO_DEG))
+ t->gst_diff;
} }
printf("Current Sidereal Time = %.3f (%.3f) (diff = %.3f)\n", t->lst, printf("Current lon=0.00 Sidereal Time = %.3f\n", t->gst);
printf("Current LOCAL Sidereal Time = %.3f (%.3f) (diff = %.3f)\n", t->lst,
sidereal_precise(t->mjd, -(FG_Longitude * RAD_TO_DEG)), sidereal_precise(t->mjd, -(FG_Longitude * RAD_TO_DEG)),
t->lst_diff); t->gst_diff);
} }
/* $Log$ /* $Log$
/* Revision 1.5 1997/09/16 22:14:52 curt /* Revision 1.6 1997/09/20 03:34:34 curt
/* Tweaked time of day lighting equations. Don't draw stars during the day. /* Still trying to get those durned stars aligned properly.
/* /*
* Revision 1.5 1997/09/16 22:14:52 curt
* Tweaked time of day lighting equations. Don't draw stars during the day.
*
* Revision 1.4 1997/09/16 15:50:31 curt * Revision 1.4 1997/09/16 15:50:31 curt
* Working on star alignment and time issues. * Working on star alignment and time issues.
* *

View file

@ -48,9 +48,10 @@ struct fgTIME {
double jd; /* Julian date */ double jd; /* Julian date */
double mjd; /* modified Julian date */ double mjd; /* modified Julian date */
double gst; /* side real time at prime meridian */
double lst; /* local side real time */ double lst; /* local side real time */
double lst_diff; /* the difference between the precise double gst_diff; /* the difference between the precise
sidereal time algorithm result and the sidereal time algorithm result and the
course result. course + diff has good course result. course + diff has good
accuracy for the short term */ accuracy for the short term */
@ -77,9 +78,12 @@ void fgTimeUpdate(struct FLIGHT *f, struct fgTIME *t);
/* $Log$ /* $Log$
/* Revision 1.5 1997/09/16 15:50:31 curt /* Revision 1.6 1997/09/20 03:34:35 curt
/* Working on star alignment and time issues. /* Still trying to get those durned stars aligned properly.
/* /*
* Revision 1.5 1997/09/16 15:50:31 curt
* Working on star alignment and time issues.
*
* Revision 1.4 1997/09/13 02:00:08 curt * Revision 1.4 1997/09/13 02:00:08 curt
* Mostly working on stars and generating sidereal time for accurate star * Mostly working on stars and generating sidereal time for accurate star
* placement. * placement.