From 1bf3001749ee560d3da6dafe556418f3f53348a3 Mon Sep 17 00:00:00 2001 From: curt Date: Sat, 24 Mar 2001 00:18:01 +0000 Subject: [PATCH] FG_ to SG_ namespace changes. --- src/Autopilot/newauto.cxx | 6 ++--- src/Cockpit/cockpit.cxx | 2 +- src/Cockpit/hud_ladr.cxx | 4 +-- src/Cockpit/hud_tbi.cxx | 18 ++++++------- src/Cockpit/radiostack.cxx | 4 +-- src/FDM/Balloon/BalloonSim.cpp | 6 ++--- src/FDM/JSBSim/FGDefs.h | 4 +-- src/FDM/JSBSim/FGFCS.h | 2 +- src/FDM/JSBSim/FGRotation.h | 2 +- src/FDM/JSBSim/FGState.cpp | 10 ++++---- src/FDM/JSBSim/FGTrim.cpp | 2 +- src/FDM/LaRCsim.cxx | 8 +++--- src/FDM/MagicCarpet.cxx | 6 ++--- src/GUI/mouse.cxx | 10 ++++---- src/Main/fg_init.cxx | 4 +-- src/Main/keyboard.cxx | 28 ++++++++++----------- src/Main/main.cxx | 20 +++++++-------- src/Main/options.cxx | 4 +-- src/Main/ttest.cxx | 4 +-- src/Main/viewer_lookat.cxx | 2 +- src/Main/viewer_rph.cxx | 2 +- src/Navaids/ils.hxx | 4 +-- src/Navaids/ilslist.cxx | 12 ++++----- src/Navaids/mkrbeacons.cxx | 8 +++--- src/Network/ray.cxx | 20 +++++++-------- src/Scenery/hitlist.cxx | 6 ++--- src/Sound/morse.cxx | 36 +++++++++++++------------- src/Time/light.cxx | 10 ++++---- src/Time/moonpos.cxx | 46 +++++++++++++++++----------------- src/Time/sunpos.cxx | 32 +++++++++++------------ 30 files changed, 161 insertions(+), 161 deletions(-) diff --git a/src/Autopilot/newauto.cxx b/src/Autopilot/newauto.cxx index 99bf553c1..f0b3bfbb2 100644 --- a/src/Autopilot/newauto.cxx +++ b/src/Autopilot/newauto.cxx @@ -321,7 +321,7 @@ static double LinearExtrapolate( double x, double x1, double y1, double x2, doub // Could be // static double y = 0.0; // double dx = x2 -x1; - // if( (dx < -FG_EPSILON ) || ( dx > FG_EPSILON ) ) + // if( (dx < -SG_EPSILON ) || ( dx > SG_EPSILON ) ) // { double m, b, y; // the constants to find in y=mx+b @@ -955,13 +955,13 @@ void FGAutopilot::AltitudeAdjust( double inc ) // cout << "target_agl / inc = " << target_agl / inc << endl; // cout << "(int)(target_agl / inc) = " << (int)(target_agl / inc) << endl; - if ( fabs((int)(target_alt / inc) * inc - target_alt) < FG_EPSILON ) { + if ( fabs((int)(target_alt / inc) * inc - target_alt) < SG_EPSILON ) { target_alt += inc; } else { target_alt = ( int ) ( target_alt / inc ) * inc + inc; } - if ( fabs((int)(target_agl / inc) * inc - target_agl) < FG_EPSILON ) { + if ( fabs((int)(target_agl / inc) * inc - target_agl) < SG_EPSILON ) { target_agl += inc; } else { target_agl = ( int ) ( target_agl / inc ) * inc + inc; diff --git a/src/Cockpit/cockpit.cxx b/src/Cockpit/cockpit.cxx index 81f40ddb9..9ffee6e00 100644 --- a/src/Cockpit/cockpit.cxx +++ b/src/Cockpit/cockpit.cxx @@ -274,7 +274,7 @@ float get_climb_rate( void ) float get_view_direction( void ) { - double view_off = FG_2PI - globals->get_current_view()->get_view_offset(); + double view_off = SG_2PI - globals->get_current_view()->get_view_offset(); double view = ( current_aircraft.fdm_state->get_Psi() + view_off) * RAD_TO_DEG; diff --git a/src/Cockpit/hud_ladr.cxx b/src/Cockpit/hud_ladr.cxx index 2e9524ac3..2ef45b607 100644 --- a/src/Cockpit/hud_ladr.cxx +++ b/src/Cockpit/hud_ladr.cxx @@ -276,8 +276,8 @@ void HudLadder :: draw( void ) // velocity vector glBegin(GL_LINE_LOOP); // Use polygon to approximate a circle for(count=0; count<50; count++) { - cosine = 6 * cos(count * 2 * FG_PI/50.0); - sine = 6 * sin(count * 2 * FG_PI/50.0); + cosine = 6 * cos(count * 2 * SG_PI/50.0); + sine = 6 * sin(count * 2 * SG_PI/50.0); glVertex2f(cosine+vel_x, sine+vel_y); } glEnd(); diff --git a/src/Cockpit/hud_tbi.cxx b/src/Cockpit/hud_tbi.cxx index 25968b563..25db5111c 100644 --- a/src/Cockpit/hud_tbi.cxx +++ b/src/Cockpit/hud_tbi.cxx @@ -68,18 +68,18 @@ operator = (const fgTBI_instr & rhs ) bank_angle = current_ch2(); // Roll limit +/- 30 degrees - if( bank_angle < -FG_PI_2/3 ) { - bank_angle = -FG_PI_2/3; - } else if( bank_angle > FG_PI_2/3 ) { - bank_angle = FG_PI_2/3; + if( bank_angle < -SG_PI_2/3 ) { + bank_angle = -SG_PI_2/3; + } else if( bank_angle > SG_PI_2/3 ) { + bank_angle = SG_PI_2/3; } sideslip_angle = current_ch1(); // Sideslip limit +/- 20 degrees - if( sideslip_angle < -FG_PI/9 ) { - sideslip_angle = -FG_PI/9; - } else if( sideslip_angle > FG_PI/9 ) { - sideslip_angle = FG_PI/9; + if( sideslip_angle < -SG_PI/9 ) { + sideslip_angle = -SG_PI/9; + } else if( sideslip_angle > SG_PI/9 ) { + sideslip_angle = SG_PI/9; } cen_x = centroid.x; @@ -88,7 +88,7 @@ operator = (const fgTBI_instr & rhs ) tee = -tee_height; fspan = span; hole = scr_hole; - ss_const = 2 * sideslip_angle * fspan/(FG_2PI/9); // width represents 40 degrees + ss_const = 2 * sideslip_angle * fspan/(SG_2PI/9); // width represents 40 degrees // printf("side_slip: %f fspan: %f\n", sideslip_angle, fspan); // printf("ss_const: %f hole: %f\n", ss_const, hole); diff --git a/src/Cockpit/radiostack.cxx b/src/Cockpit/radiostack.cxx index ae0382315..81c753a47 100644 --- a/src/Cockpit/radiostack.cxx +++ b/src/Cockpit/radiostack.cxx @@ -253,10 +253,10 @@ double FGRadioStack::adjustNavRange( double stationElev, double aircraftElev, // cout << "aircraft elev = " << aircraftElev * METER_TO_FEET // << " station elev = " << stationElev << endl; - if ( nominalRange < 25.0 + FG_EPSILON ) { + if ( nominalRange < 25.0 + SG_EPSILON ) { // Standard Terminal Service Volume return term_tbl->interpolate( alt ) * usability_factor; - } else if ( nominalRange < 50.0 + FG_EPSILON ) { + } else if ( nominalRange < 50.0 + SG_EPSILON ) { // Standard Low Altitude Service Volume // table is based on range of 40, scale to actual range return low_tbl->interpolate( alt ) * nominalRange / 40.0 diff --git a/src/FDM/Balloon/BalloonSim.cpp b/src/FDM/Balloon/BalloonSim.cpp index 88dd3a691..697fcd62b 100644 --- a/src/FDM/Balloon/BalloonSim.cpp +++ b/src/FDM/Balloon/BalloonSim.cpp @@ -78,10 +78,10 @@ balloon::balloon() /* size for hot air balloons */ /************************************************************************/ - balloon_envelope_area = 4.0 * (8.8 * 8.8) * FG_PI; - balloon_envelope_volume = (4.0/3.0) * (8.8 * 8.8 * 8.8) * FG_PI; + balloon_envelope_area = 4.0 * (8.8 * 8.8) * SG_PI; + balloon_envelope_volume = (4.0/3.0) * (8.8 * 8.8 * 8.8) * SG_PI; - wind_facing_area_of_balloon = FG_PI * (8.8 * 8.8); + wind_facing_area_of_balloon = SG_PI * (8.8 * 8.8); wind_facing_area_of_basket = 2.0; //guessed: 2 m^2 cw_envelope=0.45; //a sphere in this case diff --git a/src/FDM/JSBSim/FGDefs.h b/src/FDM/JSBSim/FGDefs.h index 132b7470a..1f0aa12ab 100644 --- a/src/FDM/JSBSim/FGDefs.h +++ b/src/FDM/JSBSim/FGDefs.h @@ -69,7 +69,7 @@ enum eParam { FG_ALPHADOT, FG_BETA, FG_BETADOT, - FG_PITCHRATE, + SG_PITCHRATE, FG_ROLLRATE, FG_YAWRATE, FG_MACH, @@ -91,7 +91,7 @@ enum eParam { FG_THROTTLE_CMD, FG_THROTTLE_POS, FG_HOVERB, - FG_PITCH_TRIM_CMD + SG_PITCH_TRIM_CMD }; /******************************************************************************/ diff --git a/src/FDM/JSBSim/FGFCS.h b/src/FDM/JSBSim/FGFCS.h index f09b12591..c9d033c7e 100644 --- a/src/FDM/JSBSim/FGFCS.h +++ b/src/FDM/JSBSim/FGFCS.h @@ -89,7 +89,7 @@ CLASS DOCUMENTATION < COMPONENT NAME="Pitch Trim Sum" TYPE="SUMMER"> ID 0 INPUT FG_ELEVATOR_CMD - INPUT FG_PITCH_TRIM_CMD + INPUT SG_PITCH_TRIM_CMD CLIPTO -1 1 </COMPONENT> diff --git a/src/FDM/JSBSim/FGRotation.h b/src/FDM/JSBSim/FGRotation.h index b33f77642..26e1d372b 100644 --- a/src/FDM/JSBSim/FGRotation.h +++ b/src/FDM/JSBSim/FGRotation.h @@ -69,7 +69,7 @@ INCLUDES #ifndef M_PI # include -# define M_PI FG_PI +# define M_PI SG_PI #endif #include "FGModel.h" diff --git a/src/FDM/JSBSim/FGState.cpp b/src/FDM/JSBSim/FGState.cpp index ec183c13c..062846195 100644 --- a/src/FDM/JSBSim/FGState.cpp +++ b/src/FDM/JSBSim/FGState.cpp @@ -49,7 +49,7 @@ INCLUDES #ifndef M_PI # include -# define M_PI FG_PI +# define M_PI SG_PI #endif #include "FGState.h" @@ -102,7 +102,7 @@ FGState::FGState(FGFDMExec* fdex) : mTb2l(3,3), RegisterVariable(FG_ALPHADOT, " alphadot " ); RegisterVariable(FG_BETA, " beta " ); RegisterVariable(FG_BETADOT, " betadot " ); - RegisterVariable(FG_PITCHRATE, " pitch_rate " ); + RegisterVariable(SG_PITCHRATE, " pitch_rate " ); RegisterVariable(FG_ROLLRATE, " roll_rate " ); RegisterVariable(FG_YAWRATE, " yaw_rate " ); RegisterVariable(FG_MACH, " mach " ); @@ -124,7 +124,7 @@ FGState::FGState(FGFDMExec* fdex) : mTb2l(3,3), RegisterVariable(FG_THROTTLE_CMD, " throttle_cmd " ); RegisterVariable(FG_THROTTLE_POS, " throttle_pos " ); RegisterVariable(FG_HOVERB, " height/span " ); - RegisterVariable(FG_PITCH_TRIM_CMD, " pitch_trim_cmd " ); + RegisterVariable(SG_PITCH_TRIM_CMD, " pitch_trim_cmd " ); } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -151,7 +151,7 @@ float FGState::GetParameter(eParam val_idx) { return FDMExec->GetTranslation()->Getbeta(); case FG_BETADOT: return FDMExec->GetTranslation()->Getbdot(); - case FG_PITCHRATE: + case SG_PITCHRATE: return (FDMExec->GetRotation()->GetPQR())(2); case FG_ROLLRATE: return (FDMExec->GetRotation()->GetPQR())(1); @@ -201,7 +201,7 @@ float FGState::GetParameter(eParam val_idx) { return FDMExec->GetFCS()->GetThrottlePos(0); case FG_HOVERB: return FDMExec->GetPosition()->GetHOverB(); - case FG_PITCH_TRIM_CMD: + case SG_PITCH_TRIM_CMD: return FDMExec->GetFCS()->GetPitchTrimCmd(); default: cerr << "FGState::GetParameter() - No handler for parameter " << val_idx << endl; diff --git a/src/FDM/JSBSim/FGTrim.cpp b/src/FDM/JSBSim/FGTrim.cpp index 5c2bf2d52..8583bdf1e 100644 --- a/src/FDM/JSBSim/FGTrim.cpp +++ b/src/FDM/JSBSim/FGTrim.cpp @@ -189,7 +189,7 @@ void FGTrim::ReportState(void) { cout << out; sprintf(out, " Normal Load Factor: %4.2f g's Pitch Rate: %5.2f deg/s\n", fdmex->GetAircraft()->GetNlf(), - fdmex->GetState()->GetParameter(FG_PITCHRATE)*RADTODEG ); + fdmex->GetState()->GetParameter(SG_PITCHRATE)*RADTODEG ); cout << out; sprintf(out, " Heading: %3.0f deg true Sideslip: %5.2f deg\n", fdmex->GetRotation()->Getpsi()*RADTODEG, diff --git a/src/FDM/LaRCsim.cxx b/src/FDM/LaRCsim.cxx index 09e193381..d4975bf2c 100644 --- a/src/FDM/LaRCsim.cxx +++ b/src/FDM/LaRCsim.cxx @@ -474,12 +474,12 @@ bool FGLaRCsim::copy_from_LaRCsim() { << " radius_to_vehicle = " << Radius_to_vehicle ); double tmp_lon_geoc = Lon_geocentric; - while ( tmp_lon_geoc < -FG_PI ) { tmp_lon_geoc += FG_2PI; } - while ( tmp_lon_geoc > FG_PI ) { tmp_lon_geoc -= FG_2PI; } + while ( tmp_lon_geoc < -SG_PI ) { tmp_lon_geoc += SG_2PI; } + while ( tmp_lon_geoc > SG_PI ) { tmp_lon_geoc -= SG_2PI; } double tmp_lon = Longitude; - while ( tmp_lon < -FG_PI ) { tmp_lon += FG_2PI; } - while ( tmp_lon > FG_PI ) { tmp_lon -= FG_2PI; } + while ( tmp_lon < -SG_PI ) { tmp_lon += SG_2PI; } + while ( tmp_lon > SG_PI ) { tmp_lon -= SG_2PI; } // Positions _set_Geocentric_Position( Lat_geocentric, tmp_lon_geoc, diff --git a/src/FDM/MagicCarpet.cxx b/src/FDM/MagicCarpet.cxx index 0e8f8b308..01c82a079 100644 --- a/src/FDM/MagicCarpet.cxx +++ b/src/FDM/MagicCarpet.cxx @@ -62,16 +62,16 @@ bool FGMagicCarpet::update( int multiloop ) { _set_V_ground_speed( kts ); // angle of turn - double turn_rate = controls.get_aileron() * FG_PI_4; // radians/sec + double turn_rate = controls.get_aileron() * SG_PI_4; // radians/sec double turn = turn_rate * time_step; // update euler angles - _set_Euler_Angles( get_Phi(), get_Theta(), fmod(get_Psi() + turn, FG_2PI) ); + _set_Euler_Angles( get_Phi(), get_Theta(), fmod(get_Psi() + turn, SG_2PI) ); _set_Euler_Rates(0,0,0); // update (lon/lat) position double lat2, lon2, az2; - if ( speed > FG_EPSILON ) { + if ( speed > SG_EPSILON ) { geo_direct_wgs_84 ( get_Altitude(), get_Latitude() * RAD_TO_DEG, get_Longitude() * RAD_TO_DEG, diff --git a/src/GUI/mouse.cxx b/src/GUI/mouse.cxx index 3feca5e61..1c28a46aa 100644 --- a/src/GUI/mouse.cxx +++ b/src/GUI/mouse.cxx @@ -349,7 +349,7 @@ void guiMotionFunc ( int x, int y ) need_warp = 1; x = 1; } - // try to get FG_PI movement in each half of screen + // try to get SG_PI movement in each half of screen // do spherical pan W = ww; H = wh; @@ -378,12 +378,12 @@ void guiMotionFunc ( int x, int y ) // this could be done in above quat // but requires redoing view pipeline offset = globals->get_current_view()->get_goal_view_offset(); - offset += ((_mX - x) * FG_2PI / W ); + offset += ((_mX - x) * SG_2PI / W ); while (offset < 0.0) { - offset += FG_2PI; + offset += SG_2PI; } - while (offset > FG_2PI) { - offset -= FG_2PI; + while (offset > SG_2PI) { + offset -= SG_2PI; } globals->get_current_view()->set_goal_view_offset(offset); #ifdef NO_SMOOTH_MOUSE_VIEW diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index 41f886e25..e37b307dd 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -377,12 +377,12 @@ bool fgSetPosFromAirportIDandHdg( const string& id, double tgt_hdg ) { azimuth, found_r.length * FEET_TO_METER * 0.5 - 5.0, &lat2, &lon2, &az2 ); - if ( fabs( fgGetDouble("/sim/startup/offset-distance") ) > FG_EPSILON ) { + if ( fabs( fgGetDouble("/sim/startup/offset-distance") ) > SG_EPSILON ) { double olat, olon; double odist = fgGetDouble("/sim/startup/offset-distance"); odist *= NM_TO_METER; double oaz = azimuth; - if ( fabs(fgGetDouble("/sim/startup/offset-azimuth")) > FG_EPSILON ) { + if ( fabs(fgGetDouble("/sim/startup/offset-azimuth")) > SG_EPSILON ) { oaz = fgGetDouble("/sim/startup/offset-azimuth") + 180; } while ( oaz >= 360.0 ) { oaz -= 360.0; } diff --git a/src/Main/keyboard.cxx b/src/Main/keyboard.cxx index b7a994c85..6b5d95054 100644 --- a/src/Main/keyboard.cxx +++ b/src/Main/keyboard.cxx @@ -152,28 +152,28 @@ void GLUTkey(unsigned char k, int x, int y) { } return; case 49: // numeric keypad 1 - v->set_goal_view_offset( FG_PI * 0.75 ); + v->set_goal_view_offset( SG_PI * 0.75 ); return; case 50: // numeric keypad 2 - v->set_goal_view_offset( FG_PI ); + v->set_goal_view_offset( SG_PI ); return; case 51: // numeric keypad 3 - v->set_goal_view_offset( FG_PI * 1.25 ); + v->set_goal_view_offset( SG_PI * 1.25 ); return; case 52: // numeric keypad 4 - v->set_goal_view_offset( FG_PI * 0.50 ); + v->set_goal_view_offset( SG_PI * 0.50 ); return; case 54: // numeric keypad 6 - v->set_goal_view_offset( FG_PI * 1.50 ); + v->set_goal_view_offset( SG_PI * 1.50 ); return; case 55: // numeric keypad 7 - v->set_goal_view_offset( FG_PI * 0.25 ); + v->set_goal_view_offset( SG_PI * 0.25 ); return; case 56: // numeric keypad 8 v->set_goal_view_offset( 0.00 ); return; case 57: // numeric keypad 9 - v->set_goal_view_offset( FG_PI * 1.75 ); + v->set_goal_view_offset( SG_PI * 1.75 ); return; case 65: // A key speed = fgGetInt("/sim/speed-up"); @@ -497,28 +497,28 @@ void GLUTspecialkey(int k, int x, int y) { return; } case GLUT_KEY_END: // numeric keypad 1 - v->set_goal_view_offset( FG_PI * 0.75 ); + v->set_goal_view_offset( SG_PI * 0.75 ); return; case GLUT_KEY_DOWN: // numeric keypad 2 - v->set_goal_view_offset( FG_PI ); + v->set_goal_view_offset( SG_PI ); return; case GLUT_KEY_PAGE_DOWN: // numeric keypad 3 - v->set_goal_view_offset( FG_PI * 1.25 ); + v->set_goal_view_offset( SG_PI * 1.25 ); return; case GLUT_KEY_LEFT: // numeric keypad 4 - v->set_goal_view_offset( FG_PI * 0.50 ); + v->set_goal_view_offset( SG_PI * 0.50 ); return; case GLUT_KEY_RIGHT: // numeric keypad 6 - v->set_goal_view_offset( FG_PI * 1.50 ); + v->set_goal_view_offset( SG_PI * 1.50 ); return; case GLUT_KEY_HOME: // numeric keypad 7 - v->set_goal_view_offset( FG_PI * 0.25 ); + v->set_goal_view_offset( SG_PI * 0.25 ); return; case GLUT_KEY_UP: // numeric keypad 8 v->set_goal_view_offset( 0.00 ); return; case GLUT_KEY_PAGE_UP: // numeric keypad 9 - v->set_goal_view_offset( FG_PI * 1.75 ); + v->set_goal_view_offset( SG_PI * 1.75 ); return; } } else { diff --git a/src/Main/main.cxx b/src/Main/main.cxx index 196619393..ea9caccaf 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -802,38 +802,38 @@ void fgUpdateTimeDepCalcs() { // current_view.goal_view_offset if ( v->get_goal_view_offset() > v->get_view_offset() ) { - if ( v->get_goal_view_offset() - v->get_view_offset() < FG_PI ){ + if ( v->get_goal_view_offset() - v->get_view_offset() < SG_PI ){ v->inc_view_offset( 0.01 ); } else { v->inc_view_offset( -0.01 ); } } else { - if ( v->get_view_offset() - v->get_goal_view_offset() < FG_PI ){ + if ( v->get_view_offset() - v->get_goal_view_offset() < SG_PI ){ v->inc_view_offset( -0.01 ); } else { v->inc_view_offset( 0.01 ); } } - if ( v->get_view_offset() > FG_2PI ) { - v->inc_view_offset( -FG_2PI ); + if ( v->get_view_offset() > SG_2PI ) { + v->inc_view_offset( -SG_2PI ); } else if ( v->get_view_offset() < 0 ) { - v->inc_view_offset( FG_2PI ); + v->inc_view_offset( SG_2PI ); } } } - double tmp = -(l->sun_rotation + FG_PI) + double tmp = -(l->sun_rotation + SG_PI) - (cur_fdm_state->get_Psi() - globals->get_current_view()->get_view_offset() ); while ( tmp < 0.0 ) { - tmp += FG_2PI; + tmp += SG_2PI; } - while ( tmp > FG_2PI ) { - tmp -= FG_2PI; + while ( tmp > SG_2PI ) { + tmp -= SG_2PI; } /* printf("Psi = %.2f, viewoffset = %.2f sunrot = %.2f rottosun = %.2f\n", FG_Psi * RAD_TO_DEG, current_view.view_offset * RAD_TO_DEG, - -(l->sun_rotation+FG_PI) * RAD_TO_DEG, tmp * RAD_TO_DEG); */ + -(l->sun_rotation+SG_PI) * RAD_TO_DEG, tmp * RAD_TO_DEG); */ l->UpdateAdjFog(); // Update solar system diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 299e1e06a..959f64c7b 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -820,9 +820,9 @@ parse_option (const string& arg) string woffset = arg.substr( 14 ); double default_view_offset = 0.0; if ( woffset == "LEFT" ) { - default_view_offset = FG_PI * 0.25; + default_view_offset = SG_PI * 0.25; } else if ( woffset == "RIGHT" ) { - default_view_offset = FG_PI * 1.75; + default_view_offset = SG_PI * 1.75; } else if ( woffset == "CENTER" ) { default_view_offset = 0.00; } else { diff --git a/src/Main/ttest.cxx b/src/Main/ttest.cxx index 7dc778b30..9518bc019 100644 --- a/src/Main/ttest.cxx +++ b/src/Main/ttest.cxx @@ -33,7 +33,7 @@ main() { // Yaw Matrix MAT3_SET_HVEC(vec, 0.0, -1.0, 0.0, 1.0); - MAT3rotate(R_Psi, vec, FG_PI + FG_Psi); + MAT3rotate(R_Psi, vec, SG_PI + FG_Psi); printf("\nYaw matrix (Psi)\n"); MAT3print(R_Psi, stdout); @@ -47,7 +47,7 @@ main() { // Longitude MAT3_SET_HVEC(vec, 0.0, 0.0, 1.0, 1.0); // R_Lon = rotate about Z axis - MAT3rotate(R_Lon, vec, FG_Longitude - FG_PI_2 ); + MAT3rotate(R_Lon, vec, FG_Longitude - SG_PI_2 ); printf("\nLongitude matrix\n"); MAT3print(R_Lon, stdout); diff --git a/src/Main/viewer_lookat.cxx b/src/Main/viewer_lookat.cxx index 82c35cce8..511bded43 100644 --- a/src/Main/viewer_lookat.cxx +++ b/src/Main/viewer_lookat.cxx @@ -200,7 +200,7 @@ void FGViewerLookAt::update() { sgNegateVec3(world_down, world_up); sgVectorProductVec3(surface_east, surface_south, world_down); #else - sgMakeRotMat4( TMP, FG_PI_2 * RAD_TO_DEG, world_up ); + sgMakeRotMat4( TMP, SG_PI_2 * RAD_TO_DEG, world_up ); // cout << "sgMat4 TMP" << endl; // print_sgMat4( TMP ); sgXformVec3(surface_east, surface_south, TMP); diff --git a/src/Main/viewer_rph.cxx b/src/Main/viewer_rph.cxx index 53128e7ff..83db4916f 100644 --- a/src/Main/viewer_rph.cxx +++ b/src/Main/viewer_rph.cxx @@ -326,7 +326,7 @@ void FGViewerRPH::update() { sgNegateVec3(world_down, world_up); sgVectorProductVec3(surface_east, surface_south, world_down); #else - sgMakeRotMat4( TMP, FG_PI_2 * RAD_TO_DEG, world_up ); + sgMakeRotMat4( TMP, SG_PI_2 * RAD_TO_DEG, world_up ); // cout << "sgMat4 TMP" << endl; // print_sgMat4( TMP ); sgXformVec3(surface_east, surface_south, TMP); diff --git a/src/Navaids/ils.hxx b/src/Navaids/ils.hxx index a94d8ceb0..37fd9fd5b 100644 --- a/src/Navaids/ils.hxx +++ b/src/Navaids/ils.hxx @@ -148,7 +148,7 @@ operator >> ( istream& in, FGILS& i ) i.y = cart.y(); i.z = cart.z(); - if ( i.gslon < FG_EPSILON && i.gslat < FG_EPSILON ) { + if ( i.gslon < SG_EPSILON && i.gslat < SG_EPSILON ) { i.has_gs = false; } else { i.has_gs = true; @@ -161,7 +161,7 @@ operator >> ( istream& in, FGILS& i ) // cout << "gs = " << cart << endl; } - if ( i.dmelon < FG_EPSILON && i.dmelat < FG_EPSILON ) { + if ( i.dmelon < SG_EPSILON && i.dmelat < SG_EPSILON ) { i.has_dme = false; } else { i.has_dme = true; diff --git a/src/Navaids/ilslist.cxx b/src/Navaids/ilslist.cxx index 318b3f055..e11112afa 100644 --- a/src/Navaids/ilslist.cxx +++ b/src/Navaids/ilslist.cxx @@ -98,18 +98,18 @@ bool FGILSList::init( FGPath path ) { } // update the marker beacon list - if ( fabs(ils.get_omlon()) > FG_EPSILON || - fabs(ils.get_omlat()) > FG_EPSILON ) { + if ( fabs(ils.get_omlon()) > SG_EPSILON || + fabs(ils.get_omlat()) > SG_EPSILON ) { current_beacons->add( ils.get_omlon(), ils.get_omlat(), ils.get_gselev(), FGBeacon::OUTER ); } - if ( fabs(ils.get_mmlon()) > FG_EPSILON || - fabs(ils.get_mmlat()) > FG_EPSILON ) { + if ( fabs(ils.get_mmlon()) > SG_EPSILON || + fabs(ils.get_mmlat()) > SG_EPSILON ) { current_beacons->add( ils.get_mmlon(), ils.get_mmlat(), ils.get_gselev(), FGBeacon::MIDDLE ); } - if ( fabs(ils.get_imlon()) > FG_EPSILON || - fabs(ils.get_imlat()) > FG_EPSILON ) { + if ( fabs(ils.get_imlon()) > SG_EPSILON || + fabs(ils.get_imlat()) > SG_EPSILON ) { current_beacons->add( ils.get_imlon(), ils.get_imlat(), ils.get_gselev(), FGBeacon::INNER ); } diff --git a/src/Navaids/mkrbeacons.cxx b/src/Navaids/mkrbeacons.cxx index 6c4da70ed..861e2093f 100644 --- a/src/Navaids/mkrbeacons.cxx +++ b/src/Navaids/mkrbeacons.cxx @@ -82,7 +82,7 @@ bool FGMarkerBeacons::add( double lon, double lat, double elev, int lonidx = (int)lon; diff = lon - (double)lonidx; - if ( (lon < 0.0) && (fabs(diff) > FG_EPSILON) ) { + if ( (lon < 0.0) && (fabs(diff) > SG_EPSILON) ) { lonidx -= 1; } double lonfrac = lon - (double)lonidx; @@ -90,7 +90,7 @@ bool FGMarkerBeacons::add( double lon, double lat, double elev, int latidx = (int)lat; diff = lat - (double)latidx; - if ( (lat < 0.0) && (fabs(diff) > FG_EPSILON) ) { + if ( (lat < 0.0) && (fabs(diff) > SG_EPSILON) ) { latidx -= 1; } double latfrac = lat - (double)latidx; @@ -139,14 +139,14 @@ FGBeacon::fgMkrBeacType FGMarkerBeacons::query( double lon, double lat, int lonidx = (int)lon; diff = lon - (double)lonidx; - if ( (lon < 0.0) && (fabs(diff) > FG_EPSILON) ) { + if ( (lon < 0.0) && (fabs(diff) > SG_EPSILON) ) { lonidx -= 1; } lonidx += 180; int latidx = (int)lat; diff = lat - (double)latidx; - if ( (lat < 0.0) && (fabs(diff) > FG_EPSILON) ) { + if ( (lat < 0.0) && (fabs(diff) > SG_EPSILON) ) { latidx -= 1; } latidx += 90; diff --git a/src/Network/ray.cxx b/src/Network/ray.cxx index 4f8d1c473..2644e7057 100644 --- a/src/Network/ray.cxx +++ b/src/Network/ray.cxx @@ -104,11 +104,11 @@ bool FGRAY::gen_message() { /* Make sure the angles are reasonable onscale */ /* We use an asymmetric mapping so that the chair behaves reasonably when upside down. Otherwise it oscillates. */ - while ( ang_pos < -2*FG_PI/3 ) { - ang_pos += 2 * FG_PI; + while ( ang_pos < -2*SG_PI/3 ) { + ang_pos += 2 * SG_PI; } - while ( ang_pos > 4*FG_PI/3 ) { - ang_pos -= 2 * FG_PI; + while ( ang_pos > 4*SG_PI/3 ) { + ang_pos -= 2 * SG_PI; } /* Tell interested parties what the situation is */ @@ -131,11 +131,11 @@ bool FGRAY::gen_message() { /* yaw */ /* Make sure that we walk through North cleanly */ - if ( fabs ( ang_pos - chair_heading ) > FG_PI ) + if ( fabs ( ang_pos - chair_heading ) > SG_PI ) { /* Need to swing chair by 360 degrees */ if ( ang_pos < chair_heading ) - chair_heading -= 2 * FG_PI; - else chair_heading += 2 * FG_PI; + chair_heading -= 2 * SG_PI; + else chair_heading += 2 * SG_PI; } /* Remove the chair heading from the true heading */ ang_pos -= chair_heading; @@ -144,7 +144,7 @@ bool FGRAY::gen_message() { can just about represent 30 degrees full scale. */ chair_heading += ang_pos * dt * 0.2; /* If they turn fast, at 90 deg error subtract 30 deg */ - if ( fabs(ang_pos) > FG_PI / 2 ) + if ( fabs(ang_pos) > SG_PI / 2 ) chair_heading += ang_pos / 3; } else @@ -178,8 +178,8 @@ bool FGRAY::gen_message() { /* Scale to the hardware's full scale range */ propose /= fullscale [ subaxis ]; /* Use a sine shaped washout on all axes */ - if ( propose < -FG_PI / 2 ) *dac = 0x0000; else - if ( propose > FG_PI / 2 ) *dac = 0xFFFF; else + if ( propose < -SG_PI / 2 ) *dac = 0x0000; else + if ( propose > SG_PI / 2 ) *dac = 0xFFFF; else *dac = (unsigned short) ( 32767 * ( 1.0 + sin ( propose ) ) ); } diff --git a/src/Scenery/hitlist.cxx b/src/Scenery/hitlist.cxx index 8ed9a0dfc..31dc508a7 100644 --- a/src/Scenery/hitlist.cxx +++ b/src/Scenery/hitlist.cxx @@ -53,7 +53,7 @@ static bool sgdPointInTriangle( sgdVec3 point, sgdVec3 tri[3] ) //first, drop the smallest dimension so we only have to work //in 2d. double x1, y1, x2, y2, x3, y3, rx, ry; - if ( fabs(min_dim-dx) <= FG_EPSILON ) { + if ( fabs(min_dim-dx) <= SG_EPSILON ) { // x is the smallest dimension x1 = point[1]; y1 = point[2]; @@ -63,7 +63,7 @@ static bool sgdPointInTriangle( sgdVec3 point, sgdVec3 tri[3] ) y3 = tri[1][2]; rx = tri[2][1]; ry = tri[2][2]; - } else if ( fabs(min_dim-dy) <= FG_EPSILON ) { + } else if ( fabs(min_dim-dy) <= SG_EPSILON ) { // y is the smallest dimension x1 = point[0]; y1 = point[2]; @@ -73,7 +73,7 @@ static bool sgdPointInTriangle( sgdVec3 point, sgdVec3 tri[3] ) y3 = tri[1][2]; rx = tri[2][0]; ry = tri[2][2]; - } else if ( fabs(min_dim-dz) <= FG_EPSILON ) { + } else if ( fabs(min_dim-dz) <= SG_EPSILON ) { // z is the smallest dimension x1 = point[0]; y1 = point[1]; diff --git a/src/Sound/morse.cxx b/src/Sound/morse.cxx index 6516eb5ff..0e134fbf5 100644 --- a/src/Sound/morse.cxx +++ b/src/Sound/morse.cxx @@ -71,7 +71,7 @@ bool FGMorse::init() { // Make Low DIT for ( i = 0; i < TRANSITION_BYTES; ++i ) { - float level = ( sin( (double) i * 2.0 * FG_PI + float level = ( sin( (double) i * 2.0 * SG_PI / (8000.0 / LO_FREQUENCY) ) ) * ((double)i / TRANSITION_BYTES) / 2.0 + 0.5; @@ -82,7 +82,7 @@ bool FGMorse::init() { for ( i = TRANSITION_BYTES; i < DIT_SIZE - TRANSITION_BYTES - COUNT_SIZE; ++i ) { - float level = ( sin( (double) i * 2.0 * FG_PI + float level = ( sin( (double) i * 2.0 * SG_PI / (8000.0 / LO_FREQUENCY) ) ) / 2.0 + 0.5; @@ -93,7 +93,7 @@ bool FGMorse::init() { for ( i = DIT_SIZE - TRANSITION_BYTES - COUNT_SIZE; i < DIT_SIZE - COUNT_SIZE; ++i ) { - float level = ( sin( (double) i * 2.0 * FG_PI + float level = ( sin( (double) i * 2.0 * SG_PI / (8000.0 / LO_FREQUENCY) ) ) * ((double)j / TRANSITION_BYTES) / 2.0 + 0.5; --j; @@ -107,7 +107,7 @@ bool FGMorse::init() { // Make High DIT for ( i = 0; i < TRANSITION_BYTES; ++i ) { - float level = ( sin( (double) i * 2.0 * FG_PI + float level = ( sin( (double) i * 2.0 * SG_PI / (8000.0 / HI_FREQUENCY)) ) * ((double)i / TRANSITION_BYTES) / 2.0 + 0.5; @@ -117,7 +117,7 @@ bool FGMorse::init() { for ( i = TRANSITION_BYTES; i < DIT_SIZE - TRANSITION_BYTES - COUNT_SIZE; ++i ) { - float level = ( sin( (double) i * 2.0 * FG_PI + float level = ( sin( (double) i * 2.0 * SG_PI / (8000.0 / HI_FREQUENCY) ) ) / 2.0 + 0.5; @@ -128,7 +128,7 @@ bool FGMorse::init() { for ( i = DIT_SIZE - TRANSITION_BYTES - COUNT_SIZE; i < DIT_SIZE - COUNT_SIZE; ++i ) { - float level = ( sin( (double) i * 2.0 * FG_PI + float level = ( sin( (double) i * 2.0 * SG_PI / (8000.0 / HI_FREQUENCY) ) ) * ((double)j / TRANSITION_BYTES) / 2.0 + 0.5; --j; @@ -142,7 +142,7 @@ bool FGMorse::init() { // Make Low DAH for ( i = 0; i < TRANSITION_BYTES; ++i ) { - float level = ( sin( (double) i * 2.0 * FG_PI + float level = ( sin( (double) i * 2.0 * SG_PI / (8000.0 / LO_FREQUENCY) ) ) * ((double)i / TRANSITION_BYTES) / 2.0 + 0.5; @@ -153,7 +153,7 @@ bool FGMorse::init() { for ( i = TRANSITION_BYTES; i < DAH_SIZE - TRANSITION_BYTES - COUNT_SIZE; ++i ) { - float level = ( sin( (double) i * 2.0 * FG_PI + float level = ( sin( (double) i * 2.0 * SG_PI / (8000.0 / LO_FREQUENCY) ) ) / 2.0 + 0.5; @@ -164,7 +164,7 @@ bool FGMorse::init() { for ( i = DAH_SIZE - TRANSITION_BYTES - COUNT_SIZE; i < DAH_SIZE - COUNT_SIZE; ++i ) { - float level = ( sin( (double) i * 2.0 * FG_PI + float level = ( sin( (double) i * 2.0 * SG_PI / (8000.0 / LO_FREQUENCY) ) ) * ((double)j / TRANSITION_BYTES) / 2.0 + 0.5; --j; @@ -178,7 +178,7 @@ bool FGMorse::init() { // Make High DAH for ( i = 0; i < TRANSITION_BYTES; ++i ) { - float level = ( sin( (double) i * 2.0 * FG_PI + float level = ( sin( (double) i * 2.0 * SG_PI / (8000.0 / HI_FREQUENCY) ) ) * ((double)i / TRANSITION_BYTES) / 2.0 + 0.5; @@ -189,7 +189,7 @@ bool FGMorse::init() { for ( i = TRANSITION_BYTES; i < DAH_SIZE - TRANSITION_BYTES - COUNT_SIZE; ++i ) { - float level = ( sin( (double) i * 2.0 * FG_PI + float level = ( sin( (double) i * 2.0 * SG_PI / (8000.0 / HI_FREQUENCY) ) ) / 2.0 + 0.5; @@ -200,7 +200,7 @@ bool FGMorse::init() { for ( i = DAH_SIZE - TRANSITION_BYTES - COUNT_SIZE; i < DAH_SIZE - COUNT_SIZE; ++i ) { - float level = ( sin( (double) i * 2.0 * FG_PI + float level = ( sin( (double) i * 2.0 * SG_PI / (8000.0 / HI_FREQUENCY) ) ) * ((double)j / TRANSITION_BYTES) / 2.0 + 0.5; --j; @@ -227,7 +227,7 @@ bool FGMorse::cust_init(const int freq ) { // Make DIT for ( i = 0; i < TRANSITION_BYTES; ++i ) { - float level = ( sin( (double) i * 2.0 * FG_PI / (8000.0 / freq)) ) + float level = ( sin( (double) i * 2.0 * SG_PI / (8000.0 / freq)) ) * ((double)i / TRANSITION_BYTES) / 2.0 + 0.5; /* Convert to unsigned byte */ @@ -236,7 +236,7 @@ bool FGMorse::cust_init(const int freq ) { for ( i = TRANSITION_BYTES; i < DIT_SIZE - TRANSITION_BYTES - COUNT_SIZE; ++i ) { - float level = ( sin( (double) i * 2.0 * FG_PI / (8000.0 / freq) ) ) + float level = ( sin( (double) i * 2.0 * SG_PI / (8000.0 / freq) ) ) / 2.0 + 0.5; /* Convert to unsigned byte */ @@ -246,7 +246,7 @@ bool FGMorse::cust_init(const int freq ) { for ( i = DIT_SIZE - TRANSITION_BYTES - COUNT_SIZE; i < DIT_SIZE - COUNT_SIZE; ++i ) { - float level = ( sin( (double) i * 2.0 * FG_PI / (8000.0 / freq) ) ) + float level = ( sin( (double) i * 2.0 * SG_PI / (8000.0 / freq) ) ) * ((double)j / TRANSITION_BYTES) / 2.0 + 0.5; --j; @@ -259,7 +259,7 @@ bool FGMorse::cust_init(const int freq ) { // Make DAH for ( i = 0; i < TRANSITION_BYTES; ++i ) { - float level = ( sin( (double) i * 2.0 * FG_PI / (8000.0 / freq) ) ) + float level = ( sin( (double) i * 2.0 * SG_PI / (8000.0 / freq) ) ) * ((double)i / TRANSITION_BYTES) / 2.0 + 0.5; /* Convert to unsigned byte */ @@ -269,7 +269,7 @@ bool FGMorse::cust_init(const int freq ) { for ( i = TRANSITION_BYTES; i < DAH_SIZE - TRANSITION_BYTES - COUNT_SIZE; ++i ) { - float level = ( sin( (double) i * 2.0 * FG_PI / (8000.0 / freq) ) ) + float level = ( sin( (double) i * 2.0 * SG_PI / (8000.0 / freq) ) ) / 2.0 + 0.5; /* Convert to unsigned byte */ @@ -279,7 +279,7 @@ bool FGMorse::cust_init(const int freq ) { for ( i = DAH_SIZE - TRANSITION_BYTES - COUNT_SIZE; i < DAH_SIZE - COUNT_SIZE; ++i ) { - float level = ( sin( (double) i * 2.0 * FG_PI / (8000.0 / freq) ) ) + float level = ( sin( (double) i * 2.0 * SG_PI / (8000.0 / freq) ) ) * ((double)j / TRANSITION_BYTES) / 2.0 + 0.5; --j; diff --git a/src/Time/light.cxx b/src/Time/light.cxx index e9917a8ff..d2567a13d 100644 --- a/src/Time/light.cxx +++ b/src/Time/light.cxx @@ -167,16 +167,16 @@ void fgLIGHT::UpdateAdjFog( void ) { // first determine the difference between our view angle and local // direction to the sun - rotation = -(sun_rotation + FG_PI) + rotation = -(sun_rotation + SG_PI) - (f->get_Psi() - globals->get_current_view()->get_view_offset()); if ( globals->get_current_view()->get_reverse_view_offset() ) { - rotation += FG_PI; + rotation += SG_PI; } while ( rotation < 0 ) { - rotation += FG_2PI; + rotation += SG_2PI; } - while ( rotation > FG_2PI ) { - rotation -= FG_2PI; + while ( rotation > SG_2PI ) { + rotation -= SG_2PI; } rotation *= RAD_TO_DEG; // fgPrintf( FG_EVENT, FG_INFO, diff --git a/src/Time/moonpos.cxx b/src/Time/moonpos.cxx index aa8d19228..fd63cd69f 100644 --- a/src/Time/moonpos.cxx +++ b/src/Time/moonpos.cxx @@ -85,10 +85,10 @@ /* * assuming the apparent orbit of the moon about the earth is circular, * the rate at which the orbit progresses is given by RadsPerDay -- - * FG_2PI radians per orbit divided by 365.242191 days per year: + * SG_2PI radians per orbit divided by 365.242191 days per year: */ -#define RadsPerDay (FG_2PI/365.242191) +#define RadsPerDay (SG_2PI/365.242191) /* * details of moon's apparent orbit at epoch 1990.0 (after @@ -99,8 +99,8 @@ * Eccentricity (eccentricity of orbit) 0.016713 */ -#define Epsilon_g (279.403303*(FG_2PI/360)) -#define OmegaBar_g (282.768422*(FG_2PI/360)) +#define Epsilon_g (279.403303*(SG_2PI/360)) +#define OmegaBar_g (282.768422*(SG_2PI/360)) #define Eccentricity (0.016713) /* @@ -108,7 +108,7 @@ * 1990.0 (computed as 23.440592 degrees according to the method given * in duffett-smith, section 27) */ -#define MeanObliquity (23.440592*(FG_2PI/360)) +#define MeanObliquity (23.440592*(SG_2PI/360)) /* static double solve_keplers_equation(double); */ /* static double moon_ecliptic_longitude(time_t); */ @@ -149,11 +149,11 @@ static double moon_ecliptic_longitude(time_t ssue) { D = DaysSinceEpoch(ssue); N = RadsPerDay * D; - N = fmod(N, FG_2PI); - if (N < 0) N += FG_2PI; + N = fmod(N, SG_2PI); + if (N < 0) N += SG_2PI; M_moon = N + Epsilon_g - OmegaBar_g; - if (M_moon < 0) M_moon += FG_2PI; + if (M_moon < 0) M_moon += SG_2PI; E = solve_keplers_equation(M_moon); v = 2 * atan(sqrt((1+Eccentricity)/(1-Eccentricity)) * tan(E/2)); @@ -283,13 +283,13 @@ void fgMoonPosition(time_t ssue, double *lon, double *lat) { ecliptic_to_equatorial( globals->get_ephem()->get_moon()->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 - (SG_2PI/24)*GST(ssue); + if (tmp < -SG_PI) { + do tmp += SG_2PI; + while (tmp < -SG_PI); + } else if (tmp > SG_PI) { + do tmp -= SG_2PI; + while (tmp < -SG_PI); } *lon = tmp; @@ -317,14 +317,14 @@ static void fgMoonPositionGST(double gst, double *lon, double *lat) { globals->get_ephem()->get_moon()->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 - (SG_2PI/24)*GST(ssue); + tmp = alpha - (SG_2PI/24)*gst; + if (tmp < -SG_PI) { + do tmp += SG_2PI; + while (tmp < -SG_PI); + } else if (tmp > SG_PI) { + do tmp -= SG_2PI; + while (tmp < -SG_PI); } *lon = tmp; diff --git a/src/Time/sunpos.cxx b/src/Time/sunpos.cxx index 05c6eac8f..e693757f1 100644 --- a/src/Time/sunpos.cxx +++ b/src/Time/sunpos.cxx @@ -68,7 +68,7 @@ #include "sunpos.hxx" // #undef E // should no longer be needed -#define MeanObliquity (23.440592*(FG_2PI/360)) +#define MeanObliquity (23.440592*(SG_2PI/360)) static void ecliptic_to_equatorial(double, double, double *, double *); static double julian_date(int, int, int); @@ -191,13 +191,13 @@ void fgSunPosition(time_t ssue, double *lon, double *lat) { 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 - (SG_2PI/24)*GST(ssue); + if (tmp < -SG_PI) { + do tmp += SG_2PI; + while (tmp < -SG_PI); + } else if (tmp > SG_PI) { + do tmp -= SG_2PI; + while (tmp < -SG_PI); } *lon = tmp; @@ -225,14 +225,14 @@ static void fgSunPositionGST(double gst, double *lon, double *lat) { 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 - (SG_2PI/24)*GST(ssue); + tmp = alpha - (SG_2PI/24)*gst; + if (tmp < -SG_PI) { + do tmp += SG_2PI; + while (tmp < -SG_PI); + } else if (tmp > SG_PI) { + do tmp -= SG_2PI; + while (tmp < -SG_PI); } *lon = tmp;