]> git.mxchange.org Git - flightgear.git/commitdiff
Still trying to get those durned stars aligned properly.
authorcurt <curt>
Sat, 20 Sep 1997 03:34:25 +0000 (03:34 +0000)
committercurt <curt>
Sat, 20 Sep 1997 03:34:25 +0000 (03:34 +0000)
Main/depend
Scenery/depend
Scenery/stars.c
Time/depend
Time/fg_time.c
Time/fg_time.h

index a468e5febb0035260fbf0f1faa305e41e33b8b08..33d6d38e54da3d2dfb15722a72c1adaa845a02c3 100644 (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 \
  ../Math/../types.h ../Scenery/mesh.h ../Scenery/scenery.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 \
  ../Flight/Slew/slew.h ../Flight/LaRCsim/ls_interface.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 \
  ../Joystick/joystick.h ../Math/fg_random.h ../Scenery/mesh.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 \
  ../Flight/Slew/slew.h ../Flight/LaRCsim/ls_interface.h \
  ../Flight/LaRCsim/../flight.h ../Math/mat3.h ../constants.h \
index 2fcd2dea74e2171cb0eb202afa09ea6a49e116a1..faadb7fa8912dd3b0abe7729075ce5068e6205b0 100644 (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 \
  ../Aircraft/aircraft.h ../Aircraft/../Flight/flight.h \
  ../Aircraft/../Controls/controls.h \
- ../Aircraft/../Controls/../limits.h
+ ../Aircraft/../Controls/../limits.h ../Time/fg_time.h \
+ ../Time/../types.h ../Time/../Flight/flight.h
index c45265bbd4cdef9fdb17467b19570643c2f78c75..6c3ff954fe0eac608af9a6fdda57e723ace29196 100644 (file)
@@ -233,12 +233,12 @@ void fgStarsRender() {
 
        glTranslatef( v->view_pos.x, v->view_pos.y, v->view_pos.z );
 
-       angle = FG_2PI * t->lst / 24.0;
-       /* warp += 1.0 * DEG_TO_RAD; */
-       warp = 15.0 * DEG_TO_RAD;
-       glRotatef( -(angle+warp) * RAD_TO_DEG, 0.0, 0.0, 1.0 );
-       printf("Rotating stars by %.2f + %.2f\n", -angle * RAD_TO_DEG,
-              -warp * RAD_TO_DEG);
+       angle = t->gst * 15.0;  /* 15 degrees per hour rotation */
+       /* warp += 1.0; */
+       /* warp = 15.0; */
+       warp = 0.0;
+       glRotatef( -(angle+warp), 0.0, 0.0, 1.0 );
+       printf("Rotating stars by %.2f degrees + %.2f degrees\n",-angle,-warp);
 
        glCallList(stars[i]);
 
@@ -252,9 +252,12 @@ void fgStarsRender() {
 
 
 /* $Log$
-/* Revision 1.9  1997/09/18 16:20:09  curt
-/* At dusk/dawn add/remove stars in stages.
+/* Revision 1.10  1997/09/20 03:34:32  curt
+/* 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
  * Tweaked time of day lighting equations.  Don't draw stars during the day.
  *
index 2ba06afddcdf825319f15b69117ce2d02aa8cee8..ab061cf3d7e2cdd9723f3b9798629abddca0a451 100644 (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
-sidereal.o: sidereal.c
-sunpos.o: sunpos.c sunpos.h ../types.h fg_time.h ../constants.h \
- ../GLUT/views.h ../GLUT/../types.h ../GLUT/../Flight/flight.h \
- ../GLUT/../Flight/Slew/slew.h \
- ../GLUT/../Flight/LaRCsim/ls_interface.h \
- ../GLUT/../Flight/LaRCsim/../flight.h ../GLUT/../Math/mat3.h \
+sidereal.o: sidereal.c ../constants.h
+sunpos.o: sunpos.c sunpos.h ../types.h fg_time.h ../Flight/flight.h \
+ ../Flight/Slew/slew.h ../Flight/LaRCsim/ls_interface.h \
+ ../Flight/LaRCsim/../flight.h ../constants.h ../GLUT/views.h \
+ ../GLUT/../types.h ../GLUT/../Flight/flight.h ../GLUT/../Math/mat3.h \
  ../Math/fg_geodesy.h ../Math/mat3.h ../Math/polar.h \
  ../Math/../types.h
 ttest.o: ttest.c
index d5b34c1690e45d9fbe3d9845ac10cf3610c2f6c4..4b9c23075fd91d9b7ece5014fd4fec4c0b3eb825 100644 (file)
@@ -45,7 +45,7 @@ struct fgTIME cur_time_params;
 /* Initialize the time dependent variables */
 
 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;
     gst = (1.0/SIDRATE)*hr + x;
 
+    printf("gst => %.4f\n", gst);
+
     return(gst);
 }
 
@@ -136,7 +138,7 @@ double sidereal_precise (double mjd, double lng) {
     gst = utc_gst (mjd);
     lst = gst - RADHR (lng);
     lst -= 24.0*floor(lst/24.0);
-    printf ("%7.4f\n", lst);
+    /* printf ("%7.4f\n", lst); */
 
     /* that's all */
     return (lst);
@@ -199,7 +201,7 @@ double sidereal_course(struct tm *gmt, time_t now, double lng) {
 /* Update the time dependent variables */
 
 void fgTimeUpdate(struct FLIGHT *f, struct fgTIME *t) {
-    double lst_precise, lst_course;
+    double gst_precise, gst_course;
     static long int warp = 0;
 
     /* 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);
 
     /* 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
            calculation to get the difference. */
-       printf("First time, doing precise lst\n");
-       t->lst = lst_precise = 
-           sidereal_precise(t->mjd, -(FG_Longitude * RAD_TO_DEG));
-       lst_course = 
-           sidereal_course(t->gmt, t->cur_time, -(FG_Longitude * RAD_TO_DEG));
-       t->lst_diff = lst_precise - lst_course;
+       printf("First time, doing precise gst\n");
+       t->gst = gst_precise = sidereal_precise(t->mjd, 0.00);
+       gst_course = sidereal_course(t->gmt, t->cur_time, 0.00);
+       t->gst_diff = gst_precise - gst_course;
+
+       t->lst = 
+           sidereal_course(t->gmt, t->cur_time, -(FG_Longitude * RAD_TO_DEG))
+           + 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->lst_diff;
+           + 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)),
-          t->lst_diff);
+          t->gst_diff);
 }
 
 
 /* $Log$
-/* 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.6  1997/09/20 03:34:34  curt
+/* 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
  * Working on star alignment and time issues.
  *
index 19f589066d981593fbc7002efe078e0e29a6ab83..3b8b3f0090defb4e743e636eb47b8f068dcf5553 100644 (file)
@@ -48,9 +48,10 @@ struct fgTIME {
     double jd;           /* Julian date */
     double mjd;          /* modified Julian date */
 
+    double gst;          /* side real time at prime meridian */
     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
                            course result.  course + diff has good
                            accuracy for the short term */
@@ -77,9 +78,12 @@ void fgTimeUpdate(struct FLIGHT *f, struct fgTIME *t);
 
 
 /* $Log$
-/* Revision 1.5  1997/09/16 15:50:31  curt
-/* Working on star alignment and time issues.
+/* Revision 1.6  1997/09/20 03:34:35  curt
+/* 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
  * Mostly working on stars and generating sidereal time for accurate star
  * placement.