#include <simgear/compiler.h>
-#ifdef FG_HAVE_STD_INCLUDES
+#ifdef SG_HAVE_STD_INCLUDES
# include <cmath>
# include <cstdio>
# include <ctime>
# ifdef macintosh
- FG_USING_STD(time_t);
+ SG_USING_STD(time_t);
# endif
#else
# include <math.h>
#include "sunpos.hxx"
// #undef E // should no longer be needed
-#define MeanObliquity (23.440592*(FG_2PI/360))
+#define MeanObliquity (23.440592*(SGD_2PI/360))
static void ecliptic_to_equatorial(double, double, double *, double *);
static double julian_date(int, int, int);
/* lazy test to ensure gregorian calendar */
if (y < 1583) {
- FG_LOG( FG_EVENT, FG_ALERT,
+ SG_LOG( SG_EVENT, SG_ALERT,
"WHOOPS! Julian dates only valid for 1582 oct 15 or later" );
}
ecliptic_to_equatorial( globals->get_ephem()->get_sun()->getLon(),
0.0, &alpha, &delta );
- tmp = alpha - (FG_2PI/24)*GST(ssue);
- if (tmp < -FG_PI) {
- do tmp += FG_2PI;
- while (tmp < -FG_PI);
- } else if (tmp > FG_PI) {
- do tmp -= FG_2PI;
- while (tmp < -FG_PI);
+ tmp = alpha - (SGD_2PI/24)*GST(ssue);
+ if (tmp < -SGD_PI) {
+ do tmp += SGD_2PI;
+ while (tmp < -SGD_PI);
+ } else if (tmp > SGD_PI) {
+ do tmp -= SGD_2PI;
+ while (tmp < -SGD_PI);
}
*lon = tmp;
globals->get_ephem()->get_sun()->getLat(),
&alpha, &delta );
-// tmp = alpha - (FG_2PI/24)*GST(ssue);
- tmp = alpha - (FG_2PI/24)*gst;
- if (tmp < -FG_PI) {
- do tmp += FG_2PI;
- while (tmp < -FG_PI);
- } else if (tmp > FG_PI) {
- do tmp -= FG_2PI;
- while (tmp < -FG_PI);
+// tmp = alpha - (SGD_2PI/24)*GST(ssue);
+ tmp = alpha - (SGD_2PI/24)*gst;
+ if (tmp < -SGD_PI) {
+ do tmp += SGD_2PI;
+ while (tmp < -SGD_PI);
+ } else if (tmp > SGD_PI) {
+ do tmp -= SGD_2PI;
+ while (tmp < -SGD_PI);
}
*lon = tmp;
SGTime *t = globals->get_time_params();
v = (FGViewerRPH *)globals->get_current_view();
- FG_LOG( FG_EVENT, FG_INFO, " Updating Sun position" );
- FG_LOG( FG_EVENT, FG_INFO, " Gst = " << t->getGst() );
+ SG_LOG( SG_EVENT, SG_INFO, " Updating Sun position" );
+ SG_LOG( SG_EVENT, SG_INFO, " Gst = " << t->getGst() );
fgSunPositionGST(t->getGst(), &l->sun_lon, &sun_gd_lat);
p = Point3D( l->sun_lon, l->sun_gc_lat, sl_radius );
l->fg_sunpos = sgPolarToCart3d(p);
- FG_LOG( FG_EVENT, FG_INFO, " t->cur_time = " << t->get_cur_time() );
- FG_LOG( FG_EVENT, FG_INFO,
+ SG_LOG( SG_EVENT, SG_INFO, " t->cur_time = " << t->get_cur_time() );
+ SG_LOG( SG_EVENT, SG_INFO,
" Sun Geodetic lat = " << sun_gd_lat
<< " Geocentric lat = " << l->sun_gc_lat );
// << nsun[2] << endl;
l->sun_angle = acos( sgScalarProductVec3 ( nup, nsun ) );
- cout << "sun angle relative to current location = " << l->sun_angle << endl;
+ SG_LOG( SG_EVENT, SG_INFO, "sun angle relative to current location = "
+ << l->sun_angle );
// calculate vector to sun's position on the earth's surface
Point3D vp( v->get_view_pos()[0],
l->sun_rotation = -acos(dot);
}
// cout << " Sky needs to rotate = " << angle << " rads = "
- // << angle * RAD_TO_DEG << " degrees." << endl;
+ // << angle * SGD_RADIANS_TO_DEGREES << " degrees." << endl;
}