From: curt Date: Sat, 24 Mar 2001 04:48:44 +0000 (+0000) Subject: SG_ namespace X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=17c96ae69ed7a3c33c816e821ae88c501ab7cf65;p=flightgear.git SG_ namespace --- diff --git a/src/Aircraft/aircraft.cxx b/src/Aircraft/aircraft.cxx index 498a52968..2de2265ee 100644 --- a/src/Aircraft/aircraft.cxx +++ b/src/Aircraft/aircraft.cxx @@ -50,8 +50,8 @@ void fgAircraftOutputCurrent(fgAIRCRAFT *a) { FG_LOG( FG_FLIGHT, FG_DEBUG, "Pos = (" - << (f->get_Longitude() * 3600.0 * RAD_TO_DEG) << "," - << (f->get_Latitude() * 3600.0 * RAD_TO_DEG) << "," + << (f->get_Longitude() * 3600.0 * SGD_RADIANS_TO_DEGREES) << "," + << (f->get_Latitude() * 3600.0 * SGD_RADIANS_TO_DEGREES) << "," << f->get_Altitude() << ") (Phi,Theta,Psi)=(" << f->get_Phi() << "," diff --git a/src/Autopilot/newauto.cxx b/src/Autopilot/newauto.cxx index f0b3bfbb2..8fd9fc0c5 100644 --- a/src/Autopilot/newauto.cxx +++ b/src/Autopilot/newauto.cxx @@ -595,7 +595,7 @@ int FGAutopilot::run() { double x = current_radiostack->get_nav1_gs_dist(); double y = (FGBFI::getAltitude() - current_radiostack->get_nav1_elev()) * FEET_TO_METER; - double current_angle = atan2( y, x ) * RAD_TO_DEG; + double current_angle = atan2( y, x ) * SGD_RADIANS_TO_DEGREES; // cout << "current angle = " << current_angle << endl; double target_angle = current_radiostack->get_nav1_target_gs(); @@ -613,7 +613,7 @@ int FGAutopilot::run() { double horiz_vel = cur_fdm_state->get_V_ground_speed() * FEET_TO_METER * 60.0; // cout << "Horizontal vel = " << horiz_vel << endl; - climb_rate = -sin( des_angle * DEG_TO_RAD ) * horiz_vel; + climb_rate = -sin( des_angle * SGD_DEGREES_TO_RADIANS ) * horiz_vel; // cout << "climb_rate = " << climb_rate << endl; /* climb_error_accum += gs_diff * 2.0; */ /* climb_rate = gs_diff * 200.0 + climb_error_accum; */ @@ -864,19 +864,19 @@ void FGAutopilot::set_AltitudeMode( fgAutoAltitudeMode mode ) { #if 0 static inline double get_aoa( void ) { - return( cur_fdm_state->get_Gamma_vert_rad() * RAD_TO_DEG ); + return( cur_fdm_state->get_Gamma_vert_rad() * SGD_RADIANS_TO_DEGREES ); } static inline double fgAPget_latitude( void ) { - return( cur_fdm_state->get_Latitude() * RAD_TO_DEG ); + return( cur_fdm_state->get_Latitude() * SGD_RADIANS_TO_DEGREES ); } static inline double fgAPget_longitude( void ) { - return( cur_fdm_state->get_Longitude() * RAD_TO_DEG ); + return( cur_fdm_state->get_Longitude() * SGD_RADIANS_TO_DEGREES ); } static inline double fgAPget_roll( void ) { - return( cur_fdm_state->get_Phi() * RAD_TO_DEG ); + return( cur_fdm_state->get_Phi() * SGD_RADIANS_TO_DEGREES ); } static inline double get_pitch( void ) { @@ -884,7 +884,7 @@ static inline double get_pitch( void ) { } double fgAPget_heading( void ) { - return( cur_fdm_state->get_Psi() * RAD_TO_DEG ); + return( cur_fdm_state->get_Psi() * SGD_RADIANS_TO_DEGREES ); } static inline double fgAPget_altitude( void ) { diff --git a/src/Cockpit/cockpit.cxx b/src/Cockpit/cockpit.cxx index c29f53616..9fde360bc 100644 --- a/src/Cockpit/cockpit.cxx +++ b/src/Cockpit/cockpit.cxx @@ -65,7 +65,7 @@ float get_latitude( void ) { double lat; - lat = current_aircraft.fdm_state->get_Latitude() * RAD_TO_DEG; + lat = current_aircraft.fdm_state->get_Latitude() * SGD_RADIANS_TO_DEGREES; float flat = lat; return(flat); @@ -76,7 +76,7 @@ float get_lat_min( void ) { double a, d; - a = current_aircraft.fdm_state->get_Latitude() * RAD_TO_DEG; + a = current_aircraft.fdm_state->get_Latitude() * SGD_RADIANS_TO_DEGREES; if (a < 0.0) { a = -a; } @@ -90,7 +90,7 @@ float get_longitude( void ) { double lon; - lon = current_aircraft.fdm_state->get_Longitude() * RAD_TO_DEG; + lon = current_aircraft.fdm_state->get_Longitude() * SGD_RADIANS_TO_DEGREES; float flon = lon; return(flon); @@ -112,7 +112,7 @@ get_formated_gmt_time( void ) float get_long_min( void ) { double a, d; - a = current_aircraft.fdm_state->get_Longitude() * RAD_TO_DEG; + a = current_aircraft.fdm_state->get_Longitude() * SGD_RADIANS_TO_DEGREES; if (a < 0.0) { a = -a; } @@ -167,7 +167,7 @@ float get_mach(void) float get_aoa( void ) { - float aoa = current_aircraft.fdm_state->get_Alpha() * RAD_TO_DEG; + float aoa = current_aircraft.fdm_state->get_Alpha() * SGD_RADIANS_TO_DEGREES; return( aoa ); } @@ -185,7 +185,7 @@ float get_pitch( void ) float get_heading( void ) { - float heading = (current_aircraft.fdm_state->get_Psi() * RAD_TO_DEG); + float heading = (current_aircraft.fdm_state->get_Psi() * SGD_RADIANS_TO_DEGREES); return( heading ); } @@ -276,7 +276,7 @@ float get_view_direction( void ) { double view_off = SGD_2PI - globals->get_current_view()->get_view_offset(); double view = ( current_aircraft.fdm_state->get_Psi() + view_off) - * RAD_TO_DEG; + * SGD_RADIANS_TO_DEGREES; if(view > 360.) view -= 360.; diff --git a/src/Cockpit/hud.cxx b/src/Cockpit/hud.cxx index fa6f25f4d..2ef0a1620 100644 --- a/src/Cockpit/hud.cxx +++ b/src/Cockpit/hud.cxx @@ -224,7 +224,7 @@ void strokeString(int x, int y, char *msg, void *font, float theta) if(*msg) { glPushMatrix(); - glRotatef(theta * RAD_TO_DEG, 0.0, 0.0, 1.0); + glRotatef(theta * SGD_RADIANS_TO_DEGREES, 0.0, 0.0, 1.0); sintheta = sin(theta); costheta = cos(theta); xx = (int)(x * costheta + y * sintheta); diff --git a/src/Cockpit/hud_ladr.cxx b/src/Cockpit/hud_ladr.cxx index 5127aea01..96e38e2d4 100644 --- a/src/Cockpit/hud_ladr.cxx +++ b/src/Cockpit/hud_ladr.cxx @@ -156,7 +156,7 @@ void HudLadder :: draw( void ) wowm = get_iaux4(); ihook = get_iaux5(); - float pitch_value = current_ch1() * RAD_TO_DEG; + float pitch_value = current_ch1() * SGD_RADIANS_TO_DEGREES; if(hudladder_type=="Climb/Dive Ladder") { pitch_ladder = false; @@ -234,11 +234,11 @@ void HudLadder :: draw( void ) actslope = (up_vel/fabs(up_vel))*90.0; } } else { - actslope = atan(up_vel/ground_vel)*RAD_TO_DEG; + actslope = atan(up_vel/ground_vel)*SGD_RADIANS_TO_DEGREES; } - xvvr = (((atan2(Vyy,Vxx)*RAD_TO_DEG)-psi)*(640.0/45.0)); - drift = ((atan2(Vyy,Vxx)*RAD_TO_DEG)-psi); + xvvr = (((atan2(Vyy,Vxx)*SGD_RADIANS_TO_DEGREES)-psi)*(640.0/45.0)); + drift = ((atan2(Vyy,Vxx)*SGD_RADIANS_TO_DEGREES)-psi); yvvr = ((actslope - pitch_value)*factor); vel_y = ((actslope -pitch_value) * cos(roll_value) + drift*sin(roll_value))*factor; vel_x = (-(actslope -pitch_value)*sin(roll_value) + drift*cos(roll_value))*(640/45.0); @@ -369,7 +369,7 @@ void HudLadder :: draw( void ) t1 = up_vel/total_vel; t2 = asin((Vxx*Axx + Vyy*Ayy + Vzz*Azz)/(9.81*total_vel)); } - pot_slope = ((t2/3)*RAD_TO_DEG)*factor + vel_y; + pot_slope = ((t2/3)*SGD_RADIANS_TO_DEGREES)*factor + vel_y; // if (pot_slope < (vel_y - 45)) pot_slope = vel_y-45; // if (pot_slope > (vel_y + 45)) pot_slope = vel_y+45; @@ -413,8 +413,8 @@ void HudLadder :: draw( void ) // ATTRIB - ON CONDITION glBegin(GL_LINE_STRIP); glVertex2f(-6, -134); - glVertex2f(-6, t2*RAD_TO_DEG*4.0 - 134); - glVertex2f(+6, t2*RAD_TO_DEG*4.0 - 134); + glVertex2f(-6, t2*SGD_RADIANS_TO_DEGREES*4.0 - 134); + glVertex2f(+6, t2*SGD_RADIANS_TO_DEGREES*4.0 - 134); glVertex2f(6, -134); glEnd(); // OBJECT MOVING RETICLE @@ -460,7 +460,7 @@ void HudLadder :: draw( void ) } - glRotatef(roll_value * RAD_TO_DEG, 0.0, 0.0, 1.0); + glRotatef(roll_value * SGD_RADIANS_TO_DEGREES, 0.0, 0.0, 1.0); // FRL marker not rotated - this line shifted below if( div_units ) { @@ -621,10 +621,10 @@ void HudLadder :: draw( void ) //waypoint marker computation float fromwp_lat,towp_lat,fromwp_lon,towp_lon,dist,delx,dely,hyp,theta,brg; - fromwp_lon = get_longitude()*DEG_TO_RAD; - fromwp_lat = get_latitude()*DEG_TO_RAD; - towp_lon = get_aux5()*DEG_TO_RAD; - towp_lat = get_aux6()*DEG_TO_RAD; + fromwp_lon = get_longitude()*SGD_DEGREES_TO_RADIANS; + fromwp_lat = get_latitude()*SGD_DEGREES_TO_RADIANS; + towp_lon = get_aux5()*SGD_DEGREES_TO_RADIANS; + towp_lat = get_aux6()*SGD_DEGREES_TO_RADIANS; dist = acos(sin(fromwp_lat)*sin(towp_lat)+cos(fromwp_lat)*cos(towp_lat)*cos(fabs(fromwp_lon-towp_lon))); delx= towp_lat - fromwp_lat; @@ -635,13 +635,13 @@ void HudLadder :: draw( void ) } else { theta = 0.0; } - brg = theta*RAD_TO_DEG; + brg = theta*SGD_RADIANS_TO_DEGREES; if (brg > 360.0) brg = 0.0; if (delx < 0) brg = 180 - brg; // {Brg = asin(cos(towp_lat)*sin(fabs(fromwp_lon-towp_lon))/ sin(dist)); - // Brg = Brg * RAD_TO_DEG; } - dist = dist*RAD_TO_DEG * 60.0*1852.0; //rad->deg->nm->m + // Brg = Brg * SGD_RADIANS_TO_DEGREES; } + dist = dist*SGD_RADIANS_TO_DEGREES * 60.0*1852.0; //rad->deg->nm->m // end waypoint marker computation //********************************************************* // OBJECT MOVING RETICLE diff --git a/src/Cockpit/hud_tbi.cxx b/src/Cockpit/hud_tbi.cxx index 0ddeaf954..31085aba5 100644 --- a/src/Cockpit/hud_tbi.cxx +++ b/src/Cockpit/hud_tbi.cxx @@ -84,7 +84,7 @@ operator = (const fgTBI_instr & rhs ) cen_x = centroid.x; cen_y = centroid.y; - bank = bank_angle * RAD_TO_DEG; + bank = bank_angle * SGD_RADIANS_TO_DEGREES; tee = -tee_height; fspan = span; hole = scr_hole; diff --git a/src/Cockpit/panel.cxx b/src/Cockpit/panel.cxx index b16aae2f7..6d0ac50a7 100644 --- a/src/Cockpit/panel.cxx +++ b/src/Cockpit/panel.cxx @@ -238,7 +238,7 @@ FGPanel::update () glEnable(GL_ALPHA_TEST); glEnable(GL_COLOR_MATERIAL); // glColor4f(1.0, 1.0, 1.0, 1.0); - if ( cur_light_params.sun_angle * RAD_TO_DEG < 95.0 ) { + if ( cur_light_params.sun_angle * SGD_RADIANS_TO_DEGREES < 95.0 ) { glColor4fv( cur_light_params.scene_diffuse ); } else { glColor4f(0.7, 0.2, 0.2, 1.0); @@ -718,7 +718,7 @@ FGTexturedLayer::draw () // From Curt: turn on the panel // lights after sundown. - if ( cur_light_params.sun_angle * RAD_TO_DEG < 95.0 ) { + if ( cur_light_params.sun_angle * SGD_RADIANS_TO_DEGREES < 95.0 ) { glColor4fv( cur_light_params.scene_diffuse ); } else { glColor4f(0.7, 0.2, 0.2, 1.0); diff --git a/src/Cockpit/radiostack.cxx b/src/Cockpit/radiostack.cxx index 81c753a47..89541efc3 100644 --- a/src/Cockpit/radiostack.cxx +++ b/src/Cockpit/radiostack.cxx @@ -296,8 +296,8 @@ double FGRadioStack::adjustILSRange( double stationElev, double aircraftElev, void FGRadioStack::update() { - double lon = longitudeVal->getDoubleValue() * DEG_TO_RAD; - double lat = latitudeVal->getDoubleValue() * DEG_TO_RAD; + double lon = longitudeVal->getDoubleValue() * SGD_DEGREES_TO_RADIANS; + double lat = latitudeVal->getDoubleValue() * SGD_DEGREES_TO_RADIANS; double elev = altitudeVal->getDoubleValue() * FEET_TO_METER; need_update = false; @@ -326,7 +326,7 @@ FGRadioStack::update() } // wgs84 heading - geo_inverse_wgs_84( elev, lat * RAD_TO_DEG, lon * RAD_TO_DEG, + geo_inverse_wgs_84( elev, lat * SGD_RADIANS_TO_DEGREES, lon * SGD_RADIANS_TO_DEGREES, nav1_loclat, nav1_loclon, &az1, &az2, &s ); // cout << "az1 = " << az1 << " magvar = " << nav1_magvar << endl; @@ -420,7 +420,7 @@ FGRadioStack::update() } // wgs84 heading - geo_inverse_wgs_84( elev, lat * RAD_TO_DEG, lon * RAD_TO_DEG, + geo_inverse_wgs_84( elev, lat * SGD_RADIANS_TO_DEGREES, lon * SGD_RADIANS_TO_DEGREES, nav2_loclat, nav2_loclon, &az1, &az2, &s ); nav2_heading = az1 - nav2_magvar; @@ -500,7 +500,7 @@ FGRadioStack::update() adf_dist = aircraft.distance3D( station ); // wgs84 heading - geo_inverse_wgs_84( elev, lat * RAD_TO_DEG, lon * RAD_TO_DEG, + geo_inverse_wgs_84( elev, lat * SGD_RADIANS_TO_DEGREES, lon * SGD_RADIANS_TO_DEGREES, adf_lat, adf_lon, &az1, &az2, &s ); adf_heading = az1; @@ -550,8 +550,8 @@ FGRadioStack::update() // Update current nav/adf radio stations based on current postition void FGRadioStack::search() { - double lon = longitudeVal->getDoubleValue() * DEG_TO_RAD; - double lat = latitudeVal->getDoubleValue() * DEG_TO_RAD; + double lon = longitudeVal->getDoubleValue() * SGD_DEGREES_TO_RADIANS; + double lat = latitudeVal->getDoubleValue() * SGD_DEGREES_TO_RADIANS; double elev = altitudeVal->getDoubleValue() * FEET_TO_METER; // nav1 @@ -807,7 +807,7 @@ void FGRadioStack::search() } FGBeacon::fgMkrBeacType beacon_type - = current_beacons->query( lon * RAD_TO_DEG, lat * RAD_TO_DEG, elev ); + = current_beacons->query( lon * SGD_RADIANS_TO_DEGREES, lat * SGD_RADIANS_TO_DEGREES, elev ); outer_marker = middle_marker = inner_marker = false; @@ -939,7 +939,7 @@ double FGRadioStack::get_nav1_gs_needle_deflection() const { if ( nav1_inrange && nav1_has_gs ) { double x = nav1_gs_dist; double y = (FGBFI::getAltitude() - nav1_elev) * FEET_TO_METER; - double angle = atan2( y, x ) * RAD_TO_DEG; + double angle = atan2( y, x ) * SGD_RADIANS_TO_DEGREES; return (nav1_target_gs - angle) * 5.0; } else { return 0.0; @@ -953,7 +953,7 @@ double FGRadioStack::get_nav2_gs_needle_deflection() const { if ( nav2_inrange && nav2_has_gs ) { double x = nav2_gs_dist; double y = (FGBFI::getAltitude() - nav2_elev) * FEET_TO_METER; - double angle = atan2( y, x ) * RAD_TO_DEG; + double angle = atan2( y, x ) * SGD_RADIANS_TO_DEGREES; return (nav2_target_gs - angle) * 5.0; } else { return 0.0; diff --git a/src/Cockpit/steam.cxx b/src/Cockpit/steam.cxx index 57be7d7aa..680cf84fe 100644 --- a/src/Cockpit/steam.cxx +++ b/src/Cockpit/steam.cxx @@ -261,9 +261,9 @@ void FGSteam::_CatchUp() */ set_lowpass ( & the_TC_std, current_aircraft.fdm_state->get_Phi_dot () - * RAD_TO_DEG / 20.0 + + * SGD_RADIANS_TO_DEGREES / 20.0 + current_aircraft.fdm_state->get_Psi_dot () - * RAD_TO_DEG / 3.0 , dt ); + * SGD_RADIANS_TO_DEGREES / 3.0 , dt ); /************************** We want to know the pilot accelerations, @@ -283,8 +283,8 @@ void FGSteam::_CatchUp() double EdgN, EdgE, EdgU; double TrqN, TrqE, TrqU, Torque; /* Find a force vector towards exact magnetic north */ - MagVar = FGBFI::getMagVar() / RAD_TO_DEG; - MagDip = FGBFI::getMagDip() / RAD_TO_DEG; + MagVar = FGBFI::getMagVar() / SGD_RADIANS_TO_DEGREES; + MagDip = FGBFI::getMagDip() / SGD_RADIANS_TO_DEGREES; CosDip = cos ( MagDip ); FrcN = CosDip * cos ( MagVar ); FrcE = CosDip * sin ( MagVar ); @@ -295,8 +295,8 @@ void FGSteam::_CatchUp() if ( AccTot > 1.0 ) AccTot = sqrt ( AccTot ); else AccTot = 1.0; /* Force applies to north marking on compass card */ - EdgN = cos ( the_MH_err / RAD_TO_DEG ); - EdgE = sin ( the_MH_err / RAD_TO_DEG ); + EdgN = cos ( the_MH_err / SGD_RADIANS_TO_DEGREES ); + EdgE = sin ( the_MH_err / SGD_RADIANS_TO_DEGREES ); EdgU = 0.0; /* Apply the force to the edge to get torques */ TrqN = EdgE * FrcU - EdgU * FrcE; @@ -419,7 +419,7 @@ double FGSteam::get_HackGS_deg () { double x = current_radiostack->get_nav1_gs_dist(); double y = (FGBFI::getAltitude() - current_radiostack->get_nav1_elev()) * FEET_TO_METER; - double angle = atan2( y, x ) * RAD_TO_DEG; + double angle = atan2( y, x ) * SGD_RADIANS_TO_DEGREES; return (current_radiostack->get_nav1_target_gs() - angle) * 5.0; } else { return 0.0; diff --git a/src/FDM/ADA.cxx b/src/FDM/ADA.cxx index b2dc15c26..a83daf24a 100644 --- a/src/FDM/ADA.cxx +++ b/src/FDM/ADA.cxx @@ -253,7 +253,7 @@ bool FGADA::copy_from_FGADA() { _set_Mach_number( Machno); // printf("sr=%f\n",Sea_level_radius); - // printf("psi = %f %f\n",Psi,Psi*RAD_TO_DEG); + // printf("psi = %f %f\n",Psi,Psi*SGD_RADIANS_TO_DEGREES); // controls controls.set_throttle(0,throttle/131.0); diff --git a/src/FDM/LaRCsimIC.cxx b/src/FDM/LaRCsimIC.cxx index 69af5ecdd..4bd86309d 100644 --- a/src/FDM/LaRCsimIC.cxx +++ b/src/FDM/LaRCsimIC.cxx @@ -104,7 +104,7 @@ void LaRCsimIC::SetClimbRateFpsIC( SCALAR tt) { getTheta(); vdown=-1*hdot; cout << "hdot: " << hdot << endl; - cout << "gamma: " << gamma*RAD_TO_DEG << endl; + cout << "gamma: " << gamma*SGD_RADIANS_TO_DEGREES << endl; cout << "vdown: " << vdown << endl; } } diff --git a/src/FDM/LaRCsimIC.hxx b/src/FDM/LaRCsimIC.hxx index 001019422..d5a38870b 100644 --- a/src/FDM/LaRCsimIC.hxx +++ b/src/FDM/LaRCsimIC.hxx @@ -30,6 +30,8 @@ INCLUDES *******************************************************************************/ +#include + #include #include @@ -69,7 +71,7 @@ public: void SetAltitudeAGLFtIC(SCALAR tt); //"vertical" flight path, recalculate theta - inline void SetFlightPathAngleDegIC(SCALAR tt) { SetFlightPathAngleRadIC(tt*DEG_TO_RAD); } + inline void SetFlightPathAngleDegIC(SCALAR tt) { SetFlightPathAngleRadIC(tt*SGD_DEGREES_TO_RADIANS); } void SetFlightPathAngleRadIC(SCALAR tt); //set speed first @@ -77,26 +79,26 @@ public: void SetClimbRateFpsIC(SCALAR tt); //use currently stored gamma, recalcualte theta - inline void SetAlphaDegIC(SCALAR tt) { alpha=tt*DEG_TO_RAD; getTheta(); } + inline void SetAlphaDegIC(SCALAR tt) { alpha=tt*SGD_DEGREES_TO_RADIANS; getTheta(); } inline void SetAlphaRadIC(SCALAR tt) { alpha=tt; getTheta(); } //use currently stored gamma, recalcualte alpha - inline void SetPitchAngleDegIC(SCALAR tt) { SetPitchAngleRadIC(tt*DEG_TO_RAD); } + inline void SetPitchAngleDegIC(SCALAR tt) { SetPitchAngleRadIC(tt*SGD_DEGREES_TO_RADIANS); } void SetPitchAngleRadIC(SCALAR tt); - inline void SetBetaDegIC(SCALAR tt) { beta=tt*DEG_TO_RAD; getTheta();} + inline void SetBetaDegIC(SCALAR tt) { beta=tt*SGD_DEGREES_TO_RADIANS; getTheta();} inline void SetBetaRadIC(SCALAR tt) { beta=tt; getTheta(); } - inline void SetRollAngleDegIC(SCALAR tt) { phi=tt*DEG_TO_RAD; getTheta(); } + inline void SetRollAngleDegIC(SCALAR tt) { phi=tt*SGD_DEGREES_TO_RADIANS; getTheta(); } inline void SetRollAngleRadIC(SCALAR tt) { phi=tt; getTheta(); } - inline void SetHeadingDegIC(SCALAR tt) { psi=tt*DEG_TO_RAD; } + inline void SetHeadingDegIC(SCALAR tt) { psi=tt*SGD_DEGREES_TO_RADIANS; } inline void SetHeadingRadIC(SCALAR tt) { psi=tt; } - inline void SetLatitudeGDDegIC(SCALAR tt) { SetLatitudeGDRadIC(tt*DEG_TO_RAD); } + inline void SetLatitudeGDDegIC(SCALAR tt) { SetLatitudeGDRadIC(tt*SGD_DEGREES_TO_RADIANS); } void SetLatitudeGDRadIC(SCALAR tt); - inline void SetLongitudeDegIC(SCALAR tt) { longitude=tt*DEG_TO_RAD; } + inline void SetLongitudeDegIC(SCALAR tt) { longitude=tt*SGD_DEGREES_TO_RADIANS; } inline void SetLongitudeRadIC(SCALAR tt) { longitude=tt; } void SetRunwayAltitudeFtIC(SCALAR tt); @@ -112,32 +114,32 @@ public: inline SCALAR GetRunwayAltitudeFtIC(void) { return runway_altitude; } - inline SCALAR GetFlightPathAngleDegIC(void) { return gamma*RAD_TO_DEG; } + inline SCALAR GetFlightPathAngleDegIC(void) { return gamma*SGD_RADIANS_TO_DEGREES; } inline SCALAR GetFlightPathAngleRadIC(void) { return gamma; } inline SCALAR GetClimbRateFpmIC(void) { return hdot*60; } inline SCALAR GetClimbRateFpsIC(void) { return hdot; } - inline SCALAR GetAlphaDegIC(void) { return alpha*RAD_TO_DEG; } + inline SCALAR GetAlphaDegIC(void) { return alpha*SGD_RADIANS_TO_DEGREES; } inline SCALAR GetAlphaRadIC(void) { return alpha; } - inline SCALAR GetPitchAngleDegIC(void) { return theta*RAD_TO_DEG; } + inline SCALAR GetPitchAngleDegIC(void) { return theta*SGD_RADIANS_TO_DEGREES; } inline SCALAR GetPitchAngleRadIC(void) { return theta; } - inline SCALAR GetBetaDegIC(void) { return beta*RAD_TO_DEG; } - inline SCALAR GetBetaRadIC(void) { return beta*RAD_TO_DEG; } + inline SCALAR GetBetaDegIC(void) { return beta*SGD_RADIANS_TO_DEGREES; } + inline SCALAR GetBetaRadIC(void) { return beta*SGD_RADIANS_TO_DEGREES; } - inline SCALAR GetRollAngleDegIC(void) { return phi*RAD_TO_DEG; } + inline SCALAR GetRollAngleDegIC(void) { return phi*SGD_RADIANS_TO_DEGREES; } inline SCALAR GetRollAngleRadIC(void) { return phi; } - inline SCALAR GetHeadingDegIC(void) { return psi*RAD_TO_DEG; } + inline SCALAR GetHeadingDegIC(void) { return psi*SGD_RADIANS_TO_DEGREES; } inline SCALAR GetHeadingRadIC(void) { return psi; } - inline SCALAR GetLatitudeGDDegIC(void) { return latitude_gd*RAD_TO_DEG; } + inline SCALAR GetLatitudeGDDegIC(void) { return latitude_gd*SGD_RADIANS_TO_DEGREES; } inline SCALAR GetLatitudeGDRadIC(void) { return latitude_gd; } - inline SCALAR GetLongitudeDegIC(void) { return longitude*RAD_TO_DEG; } + inline SCALAR GetLongitudeDegIC(void) { return longitude*SGD_RADIANS_TO_DEGREES; } inline SCALAR GetLongitudeRadIC(void) { return longitude; } inline SCALAR GetUBodyFpsIC(void) { return vt*cos(alpha)*cos(beta); } diff --git a/src/FDM/MagicCarpet.cxx b/src/FDM/MagicCarpet.cxx index 46816061f..75eab022a 100644 --- a/src/FDM/MagicCarpet.cxx +++ b/src/FDM/MagicCarpet.cxx @@ -74,17 +74,17 @@ bool FGMagicCarpet::update( int multiloop ) { double lat2, lon2, az2; if ( speed > SG_EPSILON ) { geo_direct_wgs_84 ( get_Altitude(), - get_Latitude() * RAD_TO_DEG, - get_Longitude() * RAD_TO_DEG, - get_Psi() * RAD_TO_DEG, + get_Latitude() * SGD_RADIANS_TO_DEGREES, + get_Longitude() * SGD_RADIANS_TO_DEGREES, + get_Psi() * SGD_RADIANS_TO_DEGREES, dist, &lat2, &lon2, &az2 ); - _set_Longitude( lon2 * DEG_TO_RAD ); - _set_Latitude( lat2 * DEG_TO_RAD ); + _set_Longitude( lon2 * SGD_DEGREES_TO_RADIANS ); + _set_Latitude( lat2 * SGD_DEGREES_TO_RADIANS ); } - // cout << "lon error = " << fabs(end.x()*RAD_TO_DEG - lon2) - // << " lat error = " << fabs(end.y()*RAD_TO_DEG - lat2) + // cout << "lon error = " << fabs(end.x()*SGD_RADIANS_TO_DEGREES - lon2) + // << " lat error = " << fabs(end.y()*SGD_RADIANS_TO_DEGREES - lat2) // << endl; double sl_radius, lat_geoc; diff --git a/src/FDM/flight.cxx b/src/FDM/flight.cxx index ec8707dc3..b7efd3490 100644 --- a/src/FDM/flight.cxx +++ b/src/FDM/flight.cxx @@ -283,7 +283,7 @@ void FGInterface::_updatePosition( double lat_geoc, double lon, double alt ) { << " tmp_alt = " << tmp_alt * METER_TO_FEET << " sl_radius1 = " << sl_radius1 * METER_TO_FEET << " sl_radius2 = " << sl_radius2 * METER_TO_FEET - << " Equator = " << EQUATORIAL_RADIUS_FT ); + << " Equator = " << SG_EQUATORIAL_RADIUS_FT ); _set_Geocentric_Position( lat_geoc, lon, sl_radius2 * METER_TO_FEET + alt ); diff --git a/src/FDM/flight.hxx b/src/FDM/flight.hxx index da905abb0..86d2ca523 100644 --- a/src/FDM/flight.hxx +++ b/src/FDM/flight.hxx @@ -496,10 +496,10 @@ public: virtual void set_Altitude(double alt); // triggers re-calc of AGL altitude virtual void set_AltitudeAGL(double altagl); // and vice-versa virtual void set_Latitude_deg (double lat) { - set_Latitude(lat * DEG_TO_RAD); + set_Latitude(lat * SGD_DEGREES_TO_RADIANS); } virtual void set_Longitude_deg (double lon) { - set_Longitude(lon * DEG_TO_RAD); + set_Longitude(lon * SGD_DEGREES_TO_RADIANS); } // Speeds -- setting any of these will trigger a re-calc of the rest @@ -525,11 +525,11 @@ public: virtual void set_Psi (double psi) { set_Euler_Angles(get_Phi(), get_Theta(), psi); } - virtual void set_Phi_deg (double phi) { set_Phi(phi * DEG_TO_RAD); } + virtual void set_Phi_deg (double phi) { set_Phi(phi * SGD_DEGREES_TO_RADIANS); } virtual void set_Theta_deg (double theta) { - set_Theta(theta * DEG_TO_RAD); + set_Theta(theta * SGD_DEGREES_TO_RADIANS); } - virtual void set_Psi_deg (double psi) { set_Psi(psi * DEG_TO_RAD); } + virtual void set_Psi_deg (double psi) { set_Psi(psi * SGD_DEGREES_TO_RADIANS); } // Flight Path virtual void set_Climb_Rate( double roc); @@ -891,19 +891,19 @@ public: inline double get_Altitude_AGL(void) const { return altitude_agl; } inline double get_Latitude_deg () const { - return get_Latitude() * RAD_TO_DEG; + return get_Latitude() * SGD_RADIANS_TO_DEGREES; } inline double get_Longitude_deg () const { - return get_Longitude() * RAD_TO_DEG; + return get_Longitude() * SGD_RADIANS_TO_DEGREES; } // inline double * get_Euler_angles_v() { return euler_angles_v; } inline double get_Phi() const { return euler_angles_v[0]; } inline double get_Theta() const { return euler_angles_v[1]; } inline double get_Psi() const { return euler_angles_v[2]; } - inline double get_Phi_deg () const { return get_Phi() * RAD_TO_DEG; } - inline double get_Theta_deg () const { return get_Theta() * RAD_TO_DEG; } - inline double get_Psi_deg () const { return get_Psi() * RAD_TO_DEG; } + inline double get_Phi_deg () const { return get_Phi() * SGD_RADIANS_TO_DEGREES; } + inline double get_Theta_deg () const { return get_Theta() * SGD_RADIANS_TO_DEGREES; } + inline double get_Psi_deg () const { return get_Psi() * SGD_RADIANS_TO_DEGREES; } // ========== Miscellaneous quantities ========== diff --git a/src/GUI/apt_dlg.cxx b/src/GUI/apt_dlg.cxx index 1c7d7f3e2..9b6f24bf2 100644 --- a/src/GUI/apt_dlg.cxx +++ b/src/GUI/apt_dlg.cxx @@ -83,7 +83,7 @@ void AptDialog_OK (puObject *) // fgSetPosFromAirportID( AptId ); fgSetPosFromAirportIDandHdg( AptId, cur_fdm_state->get_Psi() * - RAD_TO_DEG); + SGD_RADIANS_TO_DEGREES); BusyCursor(0); fgReInitSubsystems(); BusyCursor(1); diff --git a/src/Main/bfi.cxx b/src/Main/bfi.cxx index ac2810275..8a90188e2 100644 --- a/src/Main/bfi.cxx +++ b/src/Main/bfi.cxx @@ -153,8 +153,8 @@ _set_view_from_axes () viewDir = 270; } - globals->get_current_view()->set_goal_view_offset(viewDir*DEG_TO_RAD); -// globals->get_current_view()->set_view_offset(viewDir*DEG_TO_RAD); + globals->get_current_view()->set_goal_view_offset(viewDir*SGD_DEGREES_TO_RADIANS); +// globals->get_current_view()->set_view_offset(viewDir*SGD_DEGREES_TO_RADIANS); } // END: kludge @@ -362,7 +362,7 @@ FGBFI::getGMTString () double FGBFI::getLatitude () { - return current_aircraft.fdm_state->get_Latitude() * RAD_TO_DEG; + return current_aircraft.fdm_state->get_Latitude() * SGD_RADIANS_TO_DEGREES; } @@ -372,7 +372,7 @@ FGBFI::getLatitude () void FGBFI::setLatitude (double latitude) { - current_aircraft.fdm_state->set_Latitude(latitude * DEG_TO_RAD); + current_aircraft.fdm_state->set_Latitude(latitude * SGD_DEGREES_TO_RADIANS); } @@ -382,7 +382,7 @@ FGBFI::setLatitude (double latitude) double FGBFI::getLongitude () { - return current_aircraft.fdm_state->get_Longitude() * RAD_TO_DEG; + return current_aircraft.fdm_state->get_Longitude() * SGD_RADIANS_TO_DEGREES; } @@ -392,7 +392,7 @@ FGBFI::getLongitude () void FGBFI::setLongitude (double longitude) { - current_aircraft.fdm_state->set_Longitude(longitude * DEG_TO_RAD); + current_aircraft.fdm_state->set_Longitude(longitude * SGD_DEGREES_TO_RADIANS); } @@ -440,7 +440,7 @@ FGBFI::setAltitude (double altitude) double FGBFI::getHeading () { - return current_aircraft.fdm_state->get_Psi() * RAD_TO_DEG; + return current_aircraft.fdm_state->get_Psi() * SGD_RADIANS_TO_DEGREES; } @@ -450,7 +450,7 @@ FGBFI::getHeading () double FGBFI::getHeadingMag () { - return current_aircraft.fdm_state->get_Psi() * RAD_TO_DEG - getMagVar(); + return current_aircraft.fdm_state->get_Psi() * SGD_RADIANS_TO_DEGREES - getMagVar(); } @@ -462,7 +462,7 @@ FGBFI::setHeading (double heading) { FGInterface * fdm = current_aircraft.fdm_state; fdm->set_Euler_Angles(fdm->get_Phi(), fdm->get_Theta(), - heading * DEG_TO_RAD); + heading * SGD_DEGREES_TO_RADIANS); } @@ -472,7 +472,7 @@ FGBFI::setHeading (double heading) double FGBFI::getPitch () { - return current_aircraft.fdm_state->get_Theta() * RAD_TO_DEG; + return current_aircraft.fdm_state->get_Theta() * SGD_RADIANS_TO_DEGREES; } @@ -483,7 +483,7 @@ void FGBFI::setPitch (double pitch) { FGInterface * fdm = current_aircraft.fdm_state; - fdm->set_Euler_Angles(fdm->get_Phi(), pitch * DEG_TO_RAD, fdm->get_Psi()); + fdm->set_Euler_Angles(fdm->get_Phi(), pitch * SGD_DEGREES_TO_RADIANS, fdm->get_Psi()); } @@ -493,7 +493,7 @@ FGBFI::setPitch (double pitch) double FGBFI::getRoll () { - return current_aircraft.fdm_state->get_Phi() * RAD_TO_DEG; + return current_aircraft.fdm_state->get_Phi() * SGD_RADIANS_TO_DEGREES; } @@ -504,7 +504,7 @@ void FGBFI::setRoll (double roll) { FGInterface * fdm = current_aircraft.fdm_state; - fdm->set_Euler_Angles(roll * DEG_TO_RAD, fdm->get_Theta(), fdm->get_Psi()); + fdm->set_Euler_Angles(roll * SGD_DEGREES_TO_RADIANS, fdm->get_Theta(), fdm->get_Psi()); } @@ -1375,7 +1375,7 @@ FGBFI::setViewAxisLat (double axis) double FGBFI::getMagVar () { - return globals->get_mag()->get_magvar() * RAD_TO_DEG; + return globals->get_mag()->get_magvar() * SGD_RADIANS_TO_DEGREES; } @@ -1385,7 +1385,7 @@ FGBFI::getMagVar () double FGBFI::getMagDip () { - return globals->get_mag()->get_magdip() * RAD_TO_DEG; + return globals->get_mag()->get_magdip() * SGD_RADIANS_TO_DEGREES; } diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index e37b307dd..44117baa2 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -410,8 +410,8 @@ bool fgInitPosition( void ) { string id = fgGetString("/sim/startup/airport-id"); // set initial position from default or command line coordinates - f->set_Longitude( fgGetDouble("/position/longitude") * DEG_TO_RAD ); - f->set_Latitude( fgGetDouble("/position/latitude") * DEG_TO_RAD ); + f->set_Longitude( fgGetDouble("/position/longitude") * SGD_DEGREES_TO_RADIANS ); + f->set_Latitude( fgGetDouble("/position/latitude") * SGD_DEGREES_TO_RADIANS ); FG_LOG( FG_GENERAL, FG_INFO, "scenery.cur_elev = " << scenery.cur_elev ); @@ -438,8 +438,8 @@ bool fgInitPosition( void ) { f->set_Altitude( fgGetDouble("/position/altitude") ); FG_LOG( FG_GENERAL, FG_INFO, "Initial position is: (" - << (f->get_Longitude() * RAD_TO_DEG) << ", " - << (f->get_Latitude() * RAD_TO_DEG) << ", " + << (f->get_Longitude() * SGD_RADIANS_TO_DEGREES) << ", " + << (f->get_Latitude() * SGD_RADIANS_TO_DEGREES) << ", " << (f->get_Altitude() * FEET_TO_METER) << ")" ); return true; @@ -620,8 +620,8 @@ bool fgInitSubsystems( void ) { FG_LOG( FG_GENERAL, FG_INFO, "Updated position (after elevation adj): (" - << (cur_fdm_state->get_Latitude() * RAD_TO_DEG) << ", " - << (cur_fdm_state->get_Longitude() * RAD_TO_DEG) << ", " + << (cur_fdm_state->get_Latitude() * SGD_RADIANS_TO_DEGREES) << ", " + << (cur_fdm_state->get_Longitude() * SGD_RADIANS_TO_DEGREES) << ", " << (cur_fdm_state->get_Altitude() * FEET_TO_METER) << ")" ); // We need to calculate a few sea_level_radius here so we can pass @@ -642,9 +642,9 @@ bool fgInitSubsystems( void ) { // Initial Orientation // cur_fdm_state-> -// set_Euler_Angles( fgGetDouble("/orientation/roll") * DEG_TO_RAD, -// fgGetDouble("/orientation/pitch") * DEG_TO_RAD, -// fgGetDouble("/orientation/heading") * DEG_TO_RAD ); +// set_Euler_Angles( fgGetDouble("/orientation/roll") * SGD_DEGREES_TO_RADIANS, +// fgGetDouble("/orientation/pitch") * SGD_DEGREES_TO_RADIANS, +// fgGetDouble("/orientation/heading") * SGD_DEGREES_TO_RADIANS ); // Initialize the event manager global_events.Init(); @@ -794,8 +794,8 @@ bool fgInitSubsystems( void ) { FG_LOG( FG_GENERAL, FG_INFO, "Updated position (after elevation adj): (" - << (cur_fdm_state->get_Latitude() * RAD_TO_DEG) << ", " - << (cur_fdm_state->get_Longitude() * RAD_TO_DEG) << ", " + << (cur_fdm_state->get_Latitude() * SGD_RADIANS_TO_DEGREES) << ", " + << (cur_fdm_state->get_Longitude() * SGD_RADIANS_TO_DEGREES) << ", " << (cur_fdm_state->get_Altitude() * FEET_TO_METER) << ")" ); // *ABCD* end of thing that I just stuck in that I should probably // move @@ -906,9 +906,9 @@ void fgReInitSubsystems( void ) // Initial Orientation // cur_fdm_state-> -// set_Euler_Angles( fgGetDouble("/orientation/roll") * DEG_TO_RAD, -// fgGetDouble("/orientation/pitch") * DEG_TO_RAD, -// fgGetDouble("/orientation/heading") * DEG_TO_RAD ); +// set_Euler_Angles( fgGetDouble("/orientation/roll") * SGD_DEGREES_TO_RADIANS, +// fgGetDouble("/orientation/pitch") * SGD_DEGREES_TO_RADIANS, +// fgGetDouble("/orientation/heading") * SGD_DEGREES_TO_RADIANS ); // Initialize view parameters FGViewerRPH *pilot_view = diff --git a/src/Main/keyboard.cxx b/src/Main/keyboard.cxx index ed96a39cd..e98483d16 100644 --- a/src/Main/keyboard.cxx +++ b/src/Main/keyboard.cxx @@ -348,8 +348,8 @@ void GLUTkey(unsigned char k, int x, int y) { globals->set_freeze( ! globals->get_freeze() ); { - SGBucket p( f->get_Longitude() * RAD_TO_DEG, - f->get_Latitude() * RAD_TO_DEG ); + SGBucket p( f->get_Longitude() * SGD_RADIANS_TO_DEGREES, + f->get_Latitude() * SGD_RADIANS_TO_DEGREES ); FGPath tile_path( globals->get_fg_root() ); tile_path.append( "Scenery" ); tile_path.append( p.gen_base_path() ); @@ -357,14 +357,14 @@ void GLUTkey(unsigned char k, int x, int y) { // printf position and attitude information FG_LOG( FG_INPUT, FG_INFO, - "Lon = " << f->get_Longitude() * RAD_TO_DEG - << " Lat = " << f->get_Latitude() * RAD_TO_DEG + "Lon = " << f->get_Longitude() * SGD_RADIANS_TO_DEGREES + << " Lat = " << f->get_Latitude() * SGD_RADIANS_TO_DEGREES << " Altitude = " << f->get_Altitude() * FEET_TO_METER ); FG_LOG( FG_INPUT, FG_INFO, - "Heading = " << f->get_Psi() * RAD_TO_DEG - << " Roll = " << f->get_Phi() * RAD_TO_DEG - << " Pitch = " << f->get_Theta() * RAD_TO_DEG ); + "Heading = " << f->get_Psi() * SGD_RADIANS_TO_DEGREES + << " Roll = " << f->get_Phi() * SGD_RADIANS_TO_DEGREES + << " Pitch = " << f->get_Theta() * SGD_RADIANS_TO_DEGREES ); FG_LOG( FG_INPUT, FG_INFO, tile_path.c_str()); } return; @@ -534,8 +534,8 @@ void GLUTspecialkey(int k, int x, int y) { if ( global_tile_mgr.init() ) { // Load the local scenery data global_tile_mgr.update( - cur_fdm_state->get_Longitude() * RAD_TO_DEG, - cur_fdm_state->get_Latitude() * RAD_TO_DEG ); + cur_fdm_state->get_Longitude() * SGD_RADIANS_TO_DEGREES, + cur_fdm_state->get_Latitude() * SGD_RADIANS_TO_DEGREES ); } else { FG_LOG( FG_GENERAL, FG_ALERT, "Error in Tile Manager initialization!" ); diff --git a/src/Main/main.cxx b/src/Main/main.cxx index aa5ef3958..38e4aaf3a 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -369,8 +369,8 @@ void fgRenderFrame( void ) { sgCopyVec3( wup, pilot_view->get_world_up() ); sgMat4 CXFM; // chase view + pilot offset xform sgMakeRotMat4( CXFM, - chase_view->get_view_offset() * RAD_TO_DEG - - cur_fdm_state->get_Psi() * RAD_TO_DEG, + chase_view->get_view_offset() * SGD_RADIANS_TO_DEGREES - + cur_fdm_state->get_Psi() * SGD_RADIANS_TO_DEGREES, wup ); sgVec3 npo; // new pilot offset after rotation sgVec3 *pPO = PilotOffsetGet(); @@ -832,8 +832,8 @@ void fgUpdateTimeDepCalcs() { tmp -= SGD_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+SGD_PI) * RAD_TO_DEG, tmp * RAD_TO_DEG); */ + FG_Psi * SGD_RADIANS_TO_DEGREES, current_view.view_offset * SGD_RADIANS_TO_DEGREES, + -(l->sun_rotation+SGD_PI) * SGD_RADIANS_TO_DEGREES, tmp * SGD_RADIANS_TO_DEGREES); */ l->UpdateAdjFog(); // Update solar system @@ -1024,8 +1024,8 @@ static void fgMainLoop( void ) { #endif // see if we need to load any new scenery tiles - global_tile_mgr.update( cur_fdm_state->get_Longitude() * RAD_TO_DEG, - cur_fdm_state->get_Latitude() * RAD_TO_DEG ); + global_tile_mgr.update( cur_fdm_state->get_Longitude() * SGD_RADIANS_TO_DEGREES, + cur_fdm_state->get_Latitude() * SGD_RADIANS_TO_DEGREES ); // Process/manage pending events global_events.Process(); @@ -1449,8 +1449,8 @@ int main( int argc, char **argv ) { // Initialize time FGPath zone( globals->get_fg_root() ); zone.append( "Timezone" ); - SGTime *t = new SGTime( fgGetDouble("/position/longitude") * DEG_TO_RAD, - fgGetDouble("/position/latitude") * DEG_TO_RAD, + SGTime *t = new SGTime( fgGetDouble("/position/longitude") * SGD_DEGREES_TO_RADIANS, + fgGetDouble("/position/latitude") * SGD_DEGREES_TO_RADIANS, zone.str() ); // Handle potential user specified time offsets @@ -1696,8 +1696,8 @@ void fgLoadDCS(void) { /* cout << endl << obj_filename << " " << obj_lat[objc] << " " << obj_lon[objc] << " " << obj_alt[objc] << endl; int chj=getchar();*/ - obj_lon[objc] *=DEG_TO_RAD; - obj_lat[objc] *=DEG_TO_RAD; + obj_lon[objc] *=SGD_DEGREES_TO_RADIANS; + obj_lat[objc] *=SGD_DEGREES_TO_RADIANS; ship_pos[objc] = new ssgTransform; @@ -1742,14 +1742,14 @@ void fgUpdateDCS (void) { if (fgGetString("/sim/flight-model") == "ada") { - obj_lon[0] = fdm->get_aux5()*DEG_TO_RAD; - obj_lat[0] = fdm->get_aux6()*DEG_TO_RAD; + obj_lon[0] = fdm->get_aux5()*SGD_DEGREES_TO_RADIANS; + obj_lat[0] = fdm->get_aux6()*SGD_DEGREES_TO_RADIANS; obj_alt[0] = fdm->get_aux7(); } for (int m=0; m<=objc; m++) { - //cout << endl << obj_lat[m]*RAD_TO_DEG << " " << obj_lon[m]*RAD_TO_DEG << " " << obj_alt[m] << " " << objc << endl; + //cout << endl << obj_lat[m]*SGD_RADIANS_TO_DEGREES << " " << obj_lon[m]*SGD_RADIANS_TO_DEGREES << " " << obj_alt[m] << " " << objc << endl; //int v=getchar(); //Geodetic to Geocentric angles for rotation @@ -1776,8 +1776,8 @@ void fgUpdateDCS (void) { sgSetVec3( ship_up, 0.0, 0.0, 1.0); //north,yaw sgMat4 sgROT_lon, sgROT_lat, sgROT_hdg; - sgMakeRotMat4( sgROT_lon, obj_lon[m]*RAD_TO_DEG, ship_up ); - sgMakeRotMat4( sgROT_lat, 90-obj_latgc*RAD_TO_DEG, ship_rt ); + sgMakeRotMat4( sgROT_lon, obj_lon[m]*SGD_RADIANS_TO_DEGREES, ship_up ); + sgMakeRotMat4( sgROT_lat, 90-obj_latgc*SGD_RADIANS_TO_DEGREES, ship_rt ); sgMakeRotMat4( sgROT_hdg, 180.0, ship_up ); sgMat4 sgTUX; diff --git a/src/Main/options.cxx b/src/Main/options.cxx index b64ebfd71..669e1640e 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -826,7 +826,7 @@ parse_option (const string& arg) } else if ( woffset == "CENTER" ) { default_view_offset = 0.00; } else { - default_view_offset = atof( woffset.c_str() ) * DEG_TO_RAD; + default_view_offset = atof( woffset.c_str() ) * SGD_DEGREES_TO_RADIANS; } FGViewerRPH *pilot_view = (FGViewerRPH *)globals->get_viewmgr()->get_view( 0 ); @@ -855,7 +855,7 @@ parse_option (const string& arg) dir += 180; if (dir >= 360) dir -= 360; - dir *= DEG_TO_RAD; + dir *= SGD_DEGREES_TO_RADIANS; fgSetDouble("/environment/wind-north", speed * cos(dir)); fgSetDouble("/environment/wind-east", diff --git a/src/Main/ttest.cxx b/src/Main/ttest.cxx index 312ba3fa1..e6eb86376 100644 --- a/src/Main/ttest.cxx +++ b/src/Main/ttest.cxx @@ -12,10 +12,10 @@ main() { double FG_Phi = 0.00; double FG_Theta = 0.00; double FG_Psi = 0.00; - // double FG_Latitude = 33.3528917 * DEG_TO_RAD; + // double FG_Latitude = 33.3528917 * SGD_DEGREES_TO_RADIANS; double FG_Latitude = 0.0; - // double FG_Longitude = -110.6642444 * DEG_TO_RAD; - double FG_Longitude = 90.0 * DEG_TO_RAD; + // double FG_Longitude = -110.6642444 * SGD_DEGREES_TO_RADIANS; + double FG_Longitude = 90.0 * SGD_DEGREES_TO_RADIANS; // double view_pos[] = {2936.3222, 1736.9243, 3689.5359, 1.0}; double view_pos[] = {0.0, 0.0, 0.0, 1.0}; diff --git a/src/Main/viewer_lookat.cxx b/src/Main/viewer_lookat.cxx index 37f8748fe..e717c86c1 100644 --- a/src/Main/viewer_lookat.cxx +++ b/src/Main/viewer_lookat.cxx @@ -163,9 +163,9 @@ void FGViewerLookAt::update() { // Make the world up rotation matrix sgMakeRotMat4( UP, - geod_view_pos[0] * RAD_TO_DEG, + geod_view_pos[0] * SGD_RADIANS_TO_DEGREES, 0.0, - -geod_view_pos[1] * RAD_TO_DEG ); + -geod_view_pos[1] * SGD_RADIANS_TO_DEGREES ); // use a clever observation into the nature of our tranformation // matrix to grab the world_up vector @@ -200,7 +200,7 @@ void FGViewerLookAt::update() { sgNegateVec3(world_down, world_up); sgVectorProductVec3(surface_east, surface_south, world_down); #else - sgMakeRotMat4( TMP, SGD_PI_2 * RAD_TO_DEG, world_up ); + sgMakeRotMat4( TMP, SGD_PI_2 * SGD_RADIANS_TO_DEGREES, 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 04d131ca7..602013a40 100644 --- a/src/Main/viewer_rph.cxx +++ b/src/Main/viewer_rph.cxx @@ -206,12 +206,12 @@ void FGViewerRPH::update() { sgVec3 rollvec; sgSetVec3( rollvec, 0.0, 0.0, 1.0 ); sgMat4 PHI; // roll - sgMakeRotMat4( PHI, rph[0] * RAD_TO_DEG, rollvec ); + sgMakeRotMat4( PHI, rph[0] * SGD_RADIANS_TO_DEGREES, rollvec ); sgVec3 pitchvec; sgSetVec3( pitchvec, 0.0, 1.0, 0.0 ); sgMat4 THETA; // pitch - sgMakeRotMat4( THETA, rph[1] * RAD_TO_DEG, pitchvec ); + sgMakeRotMat4( THETA, rph[1] * SGD_RADIANS_TO_DEGREES, pitchvec ); // ROT = PHI * THETA sgMat4 ROT; @@ -222,7 +222,7 @@ void FGViewerRPH::update() { sgVec3 yawvec; sgSetVec3( yawvec, 1.0, 0.0, 0.0 ); sgMat4 PSI; // heading - sgMakeRotMat4( PSI, -rph[2] * RAD_TO_DEG, yawvec ); + sgMakeRotMat4( PSI, -rph[2] * SGD_RADIANS_TO_DEGREES, yawvec ); // LOCAL = ROT * PSI // sgMultMat4( LOCAL, ROT, PSI ); @@ -235,9 +235,9 @@ void FGViewerRPH::update() { // print_sgMat4( LOCAL ); sgMakeRotMat4( UP, - geod_view_pos[0] * RAD_TO_DEG, + geod_view_pos[0] * SGD_RADIANS_TO_DEGREES, 0.0, - -geod_view_pos[1] * RAD_TO_DEG ); + -geod_view_pos[1] * SGD_RADIANS_TO_DEGREES ); sgSetVec3( world_up, UP[0][0], UP[0][1], UP[0][2] ); // sgXformVec3( world_up, UP ); @@ -272,7 +272,7 @@ void FGViewerRPH::update() { sgXformVec3( pilot_offset_world, pilot_offset_world, VIEWo ); // generate the view offset matrix - sgMakeRotMat4( VIEW_OFFSET, view_offset * RAD_TO_DEG, view_up ); + sgMakeRotMat4( VIEW_OFFSET, view_offset * SGD_RADIANS_TO_DEGREES, view_up ); // cout << "VIEW_OFFSET matrix" << endl; // print_sgMat4( VIEW_OFFSET ); sgXformVec3( view_forward, forward, VIEW_OFFSET ); @@ -326,7 +326,7 @@ void FGViewerRPH::update() { sgNegateVec3(world_down, world_up); sgVectorProductVec3(surface_east, surface_south, world_down); #else - sgMakeRotMat4( TMP, SGD_PI_2 * RAD_TO_DEG, world_up ); + sgMakeRotMat4( TMP, SGD_PI_2 * SGD_RADIANS_TO_DEGREES, 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 37fd9fd5b..4c59b47df 100644 --- a/src/Navaids/ils.hxx +++ b/src/Navaids/ils.hxx @@ -142,7 +142,7 @@ operator >> ( istream& in, FGILS& i ) // generate cartesian coordinates Point3D geod, cart; - geod = Point3D( i.loclon * DEG_TO_RAD, i.loclat * DEG_TO_RAD, i.gselev ); + geod = Point3D( i.loclon * SGD_DEGREES_TO_RADIANS, i.loclat * SGD_DEGREES_TO_RADIANS, i.gselev ); cart = sgGeodToCart( geod ); i.x = cart.x(); i.y = cart.y(); @@ -153,7 +153,7 @@ operator >> ( istream& in, FGILS& i ) } else { i.has_gs = true; - geod = Point3D( i.gslon * DEG_TO_RAD, i.gslat * DEG_TO_RAD, i.gselev ); + geod = Point3D( i.gslon * SGD_DEGREES_TO_RADIANS, i.gslat * SGD_DEGREES_TO_RADIANS, i.gselev ); cart = sgGeodToCart( geod ); i.gs_x = cart.x(); i.gs_y = cart.y(); @@ -166,7 +166,7 @@ operator >> ( istream& in, FGILS& i ) } else { i.has_dme = true; - geod = Point3D( i.dmelon * DEG_TO_RAD, i.dmelat * DEG_TO_RAD, i.gselev); + geod = Point3D( i.dmelon * SGD_DEGREES_TO_RADIANS, i.dmelat * SGD_DEGREES_TO_RADIANS, i.gselev); cart = sgGeodToCart( geod ); i.dme_x = cart.x(); i.dme_y = cart.y(); diff --git a/src/Navaids/mkrbeacons.cxx b/src/Navaids/mkrbeacons.cxx index 861e2093f..181dde50a 100644 --- a/src/Navaids/mkrbeacons.cxx +++ b/src/Navaids/mkrbeacons.cxx @@ -36,7 +36,7 @@ FGBeacon::FGBeacon( double _lon, double _lat, double _elev, elev = _elev; type = _type; - Point3D pos = sgGeodToCart(Point3D(lon * DEG_TO_RAD, lat * DEG_TO_RAD, 0)); + Point3D pos = sgGeodToCart(Point3D(lon * SGD_DEGREES_TO_RADIANS, lat * SGD_DEGREES_TO_RADIANS, 0)); // cout << "pos = " << pos << endl; x = pos.x(); y = pos.y(); @@ -160,7 +160,7 @@ FGBeacon::fgMkrBeacType FGMarkerBeacons::query( double lon, double lat, beacon_list_iterator current = beacons.begin(); beacon_list_iterator last = beacons.end(); - Point3D aircraft = sgGeodToCart(Point3D(lon*DEG_TO_RAD, lat*DEG_TO_RAD, 0)); + Point3D aircraft = sgGeodToCart(Point3D(lon*SGD_DEGREES_TO_RADIANS, lat*SGD_DEGREES_TO_RADIANS, 0)); double min_dist = 999999999.0; diff --git a/src/Navaids/nav.hxx b/src/Navaids/nav.hxx index d939e2d01..f080a4255 100644 --- a/src/Navaids/nav.hxx +++ b/src/Navaids/nav.hxx @@ -129,9 +129,9 @@ operator >> ( istream& in, FGNav& n ) // cout << "lat = " << n.lat << " lon = " << n.lon << " elev = " // << n.elev << " JD = " // << julian_date << endl; - n.magvar = sgGetMagVar(n.lon * DEG_TO_RAD, n.lat * DEG_TO_RAD, + n.magvar = sgGetMagVar(n.lon * SGD_DEGREES_TO_RADIANS, n.lat * SGD_DEGREES_TO_RADIANS, n.elev * FEET_TO_METER, - julian_date) * RAD_TO_DEG; + julian_date) * SGD_RADIANS_TO_DEGREES; // cout << "Default variation at " << n.lon << ',' << n.lat // << " is " << var << endl; #if 0 @@ -156,7 +156,7 @@ operator >> ( istream& in, FGNav& n ) // cout << n.ident << " " << n.magvar << endl; // generate cartesian coordinates - Point3D geod( n.lon * DEG_TO_RAD, n.lat * DEG_TO_RAD, n.elev ); + Point3D geod( n.lon * SGD_DEGREES_TO_RADIANS, n.lat * SGD_DEGREES_TO_RADIANS, n.elev ); Point3D cart = sgGeodToCart( geod ); n.x = cart.x(); n.y = cart.y(); diff --git a/src/Network/atlas.cxx b/src/Network/atlas.cxx index 7f3321be4..91f4172ed 100644 --- a/src/Network/atlas.cxx +++ b/src/Network/atlas.cxx @@ -76,7 +76,7 @@ bool FGAtlas::gen_message() { t->getGmt()->tm_hour, t->getGmt()->tm_min, t->getGmt()->tm_sec ); char lat[20]; - double latd = cur_fdm_state->get_Latitude() * RAD_TO_DEG; + double latd = cur_fdm_state->get_Latitude() * SGD_RADIANS_TO_DEGREES; if ( latd < 0.0 ) { latd *= -1.0; dir = 'S'; @@ -88,7 +88,7 @@ bool FGAtlas::gen_message() { sprintf( lat, "%02d%06.3f,%c", abs(deg), min, dir); char lon[20]; - double lond = cur_fdm_state->get_Longitude() * RAD_TO_DEG; + double lond = cur_fdm_state->get_Longitude() * SGD_RADIANS_TO_DEGREES; if ( lond < 0.0 ) { lond *= -1.0; dir = 'W'; @@ -103,7 +103,7 @@ bool FGAtlas::gen_message() { sprintf( speed, "%05.1f", cur_fdm_state->get_V_equiv_kts() ); char heading[10]; - sprintf( heading, "%05.1f", cur_fdm_state->get_Psi() * RAD_TO_DEG ); + sprintf( heading, "%05.1f", cur_fdm_state->get_Psi() * SGD_RADIANS_TO_DEGREES ); char altitude_m[10]; sprintf( altitude_m, "%02d", @@ -257,7 +257,7 @@ bool FGAtlas::parse_message() { lat *= -1; } - cur_fdm_state->set_Latitude( lat * DEG_TO_RAD ); + cur_fdm_state->set_Latitude( lat * SGD_DEGREES_TO_RADIANS ); FG_LOG( FG_IO, FG_INFO, " lat = " << lat ); // lon val @@ -286,7 +286,7 @@ bool FGAtlas::parse_message() { lon *= -1; } - cur_fdm_state->set_Longitude( lon * DEG_TO_RAD ); + cur_fdm_state->set_Longitude( lon * SGD_DEGREES_TO_RADIANS ); FG_LOG( FG_IO, FG_INFO, " lon = " << lon ); #if 0 @@ -323,7 +323,7 @@ bool FGAtlas::parse_message() { heading = atof( hdg_str.c_str() ); cur_fdm_state->set_Euler_Angles( cur_fdm_state->get_Phi(), cur_fdm_state->get_Theta(), - heading * DEG_TO_RAD ); + heading * SGD_DEGREES_TO_RADIANS ); FG_LOG( FG_IO, FG_INFO, " heading = " << heading ); } else if ( sentence == "GPGGA" ) { // time @@ -362,7 +362,7 @@ bool FGAtlas::parse_message() { lat *= -1; } - // cur_fdm_state->set_Latitude( lat * DEG_TO_RAD ); + // cur_fdm_state->set_Latitude( lat * SGD_DEGREES_TO_RADIANS ); FG_LOG( FG_IO, FG_INFO, " lat = " << lat ); // lon val @@ -391,7 +391,7 @@ bool FGAtlas::parse_message() { lon *= -1; } - // cur_fdm_state->set_Longitude( lon * DEG_TO_RAD ); + // cur_fdm_state->set_Longitude( lon * SGD_DEGREES_TO_RADIANS ); FG_LOG( FG_IO, FG_INFO, " lon = " << lon ); // junk diff --git a/src/Network/garmin.cxx b/src/Network/garmin.cxx index 8c4a3d3da..00a266f47 100644 --- a/src/Network/garmin.cxx +++ b/src/Network/garmin.cxx @@ -74,7 +74,7 @@ bool FGGarmin::gen_message() { t->getGmt()->tm_hour, t->getGmt()->tm_min, t->getGmt()->tm_sec ); char lat[20]; - double latd = cur_fdm_state->get_Latitude() * RAD_TO_DEG; + double latd = cur_fdm_state->get_Latitude() * SGD_RADIANS_TO_DEGREES; if ( latd < 0.0 ) { latd *= -1.0; dir = 'S'; @@ -86,7 +86,7 @@ bool FGGarmin::gen_message() { sprintf( lat, "%02d%06.3f,%c", abs(deg), min, dir); char lon[20]; - double lond = cur_fdm_state->get_Longitude() * RAD_TO_DEG; + double lond = cur_fdm_state->get_Longitude() * SGD_RADIANS_TO_DEGREES; if ( lond < 0.0 ) { lond *= -1.0; dir = 'W'; @@ -101,7 +101,7 @@ bool FGGarmin::gen_message() { sprintf( speed, "%05.1f", cur_fdm_state->get_V_equiv_kts() ); char heading[10]; - sprintf( heading, "%05.1f", cur_fdm_state->get_Psi() * RAD_TO_DEG ); + sprintf( heading, "%05.1f", cur_fdm_state->get_Psi() * SGD_RADIANS_TO_DEGREES ); char altitude_m[10]; sprintf( altitude_m, "%02d", @@ -236,7 +236,7 @@ bool FGGarmin::parse_message() { lat *= -1; } - cur_fdm_state->set_Latitude( lat * DEG_TO_RAD ); + cur_fdm_state->set_Latitude( lat * SGD_DEGREES_TO_RADIANS ); FG_LOG( FG_IO, FG_INFO, " lat = " << lat ); // lon val @@ -265,7 +265,7 @@ bool FGGarmin::parse_message() { lon *= -1; } - cur_fdm_state->set_Longitude( lon * DEG_TO_RAD ); + cur_fdm_state->set_Longitude( lon * SGD_DEGREES_TO_RADIANS ); FG_LOG( FG_IO, FG_INFO, " lon = " << lon ); #if 0 @@ -302,7 +302,7 @@ bool FGGarmin::parse_message() { heading = atof( hdg_str.c_str() ); cur_fdm_state->set_Euler_Angles( cur_fdm_state->get_Phi(), cur_fdm_state->get_Theta(), - heading * DEG_TO_RAD ); + heading * SGD_DEGREES_TO_RADIANS ); FG_LOG( FG_IO, FG_INFO, " heading = " << heading ); } else if ( sentence == "PGRMZ" ) { // altitude diff --git a/src/Network/nmea.cxx b/src/Network/nmea.cxx index 486dc1551..68c85a297 100644 --- a/src/Network/nmea.cxx +++ b/src/Network/nmea.cxx @@ -75,7 +75,7 @@ bool FGNMEA::gen_message() { t->getGmt()->tm_hour, t->getGmt()->tm_min, t->getGmt()->tm_sec ); char lat[20]; - double latd = cur_fdm_state->get_Latitude() * RAD_TO_DEG; + double latd = cur_fdm_state->get_Latitude() * SGD_RADIANS_TO_DEGREES; if ( latd < 0.0 ) { latd *= -1.0; dir = 'S'; @@ -87,7 +87,7 @@ bool FGNMEA::gen_message() { sprintf( lat, "%02d%06.3f,%c", abs(deg), min, dir); char lon[20]; - double lond = cur_fdm_state->get_Longitude() * RAD_TO_DEG; + double lond = cur_fdm_state->get_Longitude() * SGD_RADIANS_TO_DEGREES; if ( lond < 0.0 ) { lond *= -1.0; dir = 'W'; @@ -102,7 +102,7 @@ bool FGNMEA::gen_message() { sprintf( speed, "%05.1f", cur_fdm_state->get_V_equiv_kts() ); char heading[10]; - sprintf( heading, "%05.1f", cur_fdm_state->get_Psi() * RAD_TO_DEG ); + sprintf( heading, "%05.1f", cur_fdm_state->get_Psi() * SGD_RADIANS_TO_DEGREES ); char altitude_m[10]; sprintf( altitude_m, "%02d", @@ -241,7 +241,7 @@ bool FGNMEA::parse_message() { lat *= -1; } - cur_fdm_state->set_Latitude( lat * DEG_TO_RAD ); + cur_fdm_state->set_Latitude( lat * SGD_DEGREES_TO_RADIANS ); FG_LOG( FG_IO, FG_INFO, " lat = " << lat ); // lon val @@ -270,7 +270,7 @@ bool FGNMEA::parse_message() { lon *= -1; } - cur_fdm_state->set_Longitude( lon * DEG_TO_RAD ); + cur_fdm_state->set_Longitude( lon * SGD_DEGREES_TO_RADIANS ); FG_LOG( FG_IO, FG_INFO, " lon = " << lon ); #if 0 @@ -307,7 +307,7 @@ bool FGNMEA::parse_message() { heading = atof( hdg_str.c_str() ); cur_fdm_state->set_Euler_Angles( cur_fdm_state->get_Phi(), cur_fdm_state->get_Theta(), - heading * DEG_TO_RAD ); + heading * SGD_DEGREES_TO_RADIANS ); FG_LOG( FG_IO, FG_INFO, " heading = " << heading ); } else if ( sentence == "GPGGA" ) { // time @@ -346,7 +346,7 @@ bool FGNMEA::parse_message() { lat *= -1; } - // cur_fdm_state->set_Latitude( lat * DEG_TO_RAD ); + // cur_fdm_state->set_Latitude( lat * SGD_DEGREES_TO_RADIANS ); FG_LOG( FG_IO, FG_INFO, " lat = " << lat ); // lon val @@ -375,7 +375,7 @@ bool FGNMEA::parse_message() { lon *= -1; } - // cur_fdm_state->set_Longitude( lon * DEG_TO_RAD ); + // cur_fdm_state->set_Longitude( lon * SGD_DEGREES_TO_RADIANS ); FG_LOG( FG_IO, FG_INFO, " lon = " << lon ); // junk diff --git a/src/Network/pve.cxx b/src/Network/pve.cxx index f8defdf1a..6ccc9300a 100644 --- a/src/Network/pve.cxx +++ b/src/Network/pve.cxx @@ -55,7 +55,7 @@ bool FGPVE::gen_message() { FGInterface *f = cur_fdm_state; // get roll and pitch, convert to degrees - double roll_deg = f->get_Phi() * RAD_TO_DEG; + double roll_deg = f->get_Phi() * SGD_RADIANS_TO_DEGREES; while ( roll_deg <= -180.0 ) { roll_deg += 360.0; } @@ -63,7 +63,7 @@ bool FGPVE::gen_message() { roll_deg -= 360.0; } - double pitch_deg = f->get_Theta() * RAD_TO_DEG; + double pitch_deg = f->get_Theta() * SGD_RADIANS_TO_DEGREES; while ( pitch_deg <= -180.0 ) { pitch_deg += 360.0; } diff --git a/src/Network/rul.cxx b/src/Network/rul.cxx index 73f5c4541..815f11503 100644 --- a/src/Network/rul.cxx +++ b/src/Network/rul.cxx @@ -61,7 +61,7 @@ bool FGRUL::gen_message() { FGInterface *f = cur_fdm_state; // get roll and pitch, convert to degrees - double roll_deg = f->get_Phi() * RAD_TO_DEG; + double roll_deg = f->get_Phi() * SGD_RADIANS_TO_DEGREES; while ( roll_deg < -180.0 ) { roll_deg += 360.0; } @@ -69,7 +69,7 @@ bool FGRUL::gen_message() { roll_deg -= 360.0; } - double pitch_deg = f->get_Theta() * RAD_TO_DEG; + double pitch_deg = f->get_Theta() * SGD_RADIANS_TO_DEGREES; while ( pitch_deg < -180.0 ) { pitch_deg += 360.0; } diff --git a/src/NetworkOLK/net_send.cxx b/src/NetworkOLK/net_send.cxx index a8e5204ae..b417c1d72 100644 --- a/src/NetworkOLK/net_send.cxx +++ b/src/NetworkOLK/net_send.cxx @@ -382,8 +382,8 @@ void fgd_send_com( char *FGD_com, char *FGFS_host) { speed loss/gain in network-area... */ get_latitude(), get_longitude(), get_altitude(), - get_speed(), get_roll()*RAD_TO_DEG, - get_pitch()*RAD_TO_DEG, get_heading()); + get_speed(), get_roll()*SGD_RADIANS_TO_DEGREES, + get_pitch()*SGD_RADIANS_TO_DEGREES, get_heading()); write( sock, fgd_txt, 56); break; diff --git a/src/Objects/obj.cxx b/src/Objects/obj.cxx index 5f467ca6f..9f12377f7 100644 --- a/src/Objects/obj.cxx +++ b/src/Objects/obj.cxx @@ -87,12 +87,12 @@ static Point3D local_calc_tex_coords(const Point3D& node, const Point3D& ref) { pp = sgCartToPolar3d(cp); - // tmplon = pp.lon() * RAD_TO_DEG; - // tmplat = pp.lat() * RAD_TO_DEG; + // tmplon = pp.lon() * SGD_RADIANS_TO_DEGREES; + // tmplat = pp.lat() * SGD_RADIANS_TO_DEGREES; // cout << tmplon << " " << tmplat << endl; - pp.setx( fmod(RAD_TO_DEG * FG_TEX_CONSTANT * pp.x(), 11.0) ); - pp.sety( fmod(RAD_TO_DEG * FG_TEX_CONSTANT * pp.y(), 11.0) ); + pp.setx( fmod(SGD_RADIANS_TO_DEGREES * FG_TEX_CONSTANT * pp.x(), 11.0) ); + pp.sety( fmod(SGD_RADIANS_TO_DEGREES * FG_TEX_CONSTANT * pp.y(), 11.0) ); if ( pp.x() < 0.0 ) { pp.setx( pp.x() + 11.0 ); @@ -143,7 +143,7 @@ ssgBranch *fgGenTile( const string& path, FGTileEntry *t) { double height = b.get_height(); double width = b.get_width(); - Point3D center = sgGeodToCart(Point3D(clon*DEG_TO_RAD,clat*DEG_TO_RAD,0.0)); + Point3D center = sgGeodToCart(Point3D(clon*SGD_DEGREES_TO_RADIANS,clat*SGD_DEGREES_TO_RADIANS,0.0)); t->center = center; // cout << "center = " << center << endl;; @@ -157,7 +157,7 @@ ssgBranch *fgGenTile( const string& path, FGTileEntry *t) { Point3D rad[4]; int i; for ( i = 0; i < 4; ++i ) { - rad[i] = Point3D( geod[i].x() * DEG_TO_RAD, geod[i].y() * DEG_TO_RAD, + rad[i] = Point3D( geod[i].x() * SGD_DEGREES_TO_RADIANS, geod[i].y() * SGD_DEGREES_TO_RADIANS, geod[i].z() ); } diff --git a/src/Scenery/tileentry.cxx b/src/Scenery/tileentry.cxx index 9980cb36c..f55f77db2 100644 --- a/src/Scenery/tileentry.cxx +++ b/src/Scenery/tileentry.cxx @@ -217,7 +217,7 @@ void FGTileEntry::prep_ssg_node( const Point3D& p, float vis) { lights_transform->setTransform( sgTrans ); // select which set of lights based on sun angle - float sun_angle = cur_light_params.sun_angle * RAD_TO_DEG; + float sun_angle = cur_light_params.sun_angle * SGD_RADIANS_TO_DEGREES; if ( sun_angle > 95 ) { lights_brightness->select(0x04); } else if ( sun_angle > 92 ) { diff --git a/src/Scenery/tilemgr.cxx b/src/Scenery/tilemgr.cxx index 3fa403b35..46ddbaca9 100644 --- a/src/Scenery/tilemgr.cxx +++ b/src/Scenery/tilemgr.cxx @@ -318,8 +318,8 @@ int FGTileMgr::update( double lon, double lat ) { // FGInterface *f = current_aircraft.fdm_state; // lonlat for this update - // longitude = f->get_Longitude() * RAD_TO_DEG; - // latitude = f->get_Latitude() * RAD_TO_DEG; + // longitude = f->get_Longitude() * SGD_RADIANS_TO_DEGREES; + // latitude = f->get_Latitude() * SGD_RADIANS_TO_DEGREES; longitude = lon; latitude = lat; // FG_LOG( FG_TERRAIN, FG_DEBUG, "lon "<< lonlat[LON] << @@ -361,8 +361,8 @@ int FGTileMgr::update( double lon, double lat ) { sgdVec3 tmp_abs_view_pos; sgVec3 tmp_view_pos; - Point3D geod_pos = Point3D( longitude * DEG_TO_RAD, - latitude * DEG_TO_RAD, + Point3D geod_pos = Point3D( longitude * SGD_DEGREES_TO_RADIANS, + latitude * SGD_DEGREES_TO_RADIANS, 0.0); Point3D tmp = sgGeodToCart( geod_pos ); scenery.center = tmp; diff --git a/src/Time/light.cxx b/src/Time/light.cxx index be46d20ca..64147ec1b 100644 --- a/src/Time/light.cxx +++ b/src/Time/light.cxx @@ -112,7 +112,7 @@ void fgLIGHT::Update( void ) { // calculate lighting parameters based on sun's relative angle to // local up - deg = sun_angle * RAD_TO_DEG; + deg = sun_angle * SGD_RADIANS_TO_DEGREES; FG_LOG( FG_EVENT, FG_INFO, " Sun angle = " << deg ); ambient = ambient_tbl->interpolate( deg ); @@ -178,12 +178,12 @@ void fgLIGHT::UpdateAdjFog( void ) { while ( rotation > SGD_2PI ) { rotation -= SGD_2PI; } - rotation *= RAD_TO_DEG; + rotation *= SGD_RADIANS_TO_DEGREES; // fgPrintf( FG_EVENT, FG_INFO, // " View to sun difference in degrees = %.2f\n", rotation); // next check if we are in a sunset/sunrise situation - sun_angle_deg = sun_angle * RAD_TO_DEG; + sun_angle_deg = sun_angle * SGD_RADIANS_TO_DEGREES; if ( (sun_angle_deg > 80.0) && (sun_angle_deg < 100.0) ) { /* 0.0 - 0.6 */ param1[0] = (10.0 - fabs(90.0 - sun_angle_deg)) / 20.0; diff --git a/src/Time/moonpos.cxx b/src/Time/moonpos.cxx index f63a32bdd..3add5d22c 100644 --- a/src/Time/moonpos.cxx +++ b/src/Time/moonpos.cxx @@ -435,7 +435,7 @@ void fgUpdateMoonPos( void ) { l->moon_rotation = -acos(dot); } // cout << " Sky needs to rotate = " << angle << " rads = " - // << angle * RAD_TO_DEG << " degrees." << endl; + // << angle * SGD_RADIANS_TO_DEGREES << " degrees." << endl; } diff --git a/src/Time/sunpos.cxx b/src/Time/sunpos.cxx index 3c1c3434f..92b6ab708 100644 --- a/src/Time/sunpos.cxx +++ b/src/Time/sunpos.cxx @@ -343,7 +343,7 @@ void fgUpdateSunPos( void ) { 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; } diff --git a/src/WeatherCM/FGWeatherParse.cpp b/src/WeatherCM/FGWeatherParse.cpp index 8dfcfb33b..dfad23e4d 100644 --- a/src/WeatherCM/FGWeatherParse.cpp +++ b/src/WeatherCM/FGWeatherParse.cpp @@ -169,6 +169,6 @@ FGPhysicalProperties FGWeatherParse::getFGPhysicalProperties(const unsigned int void FGWeatherParse::getPosition(const unsigned int nr, sgVec2 pos) const { //set the position of the station - sgSetVec2( pos, weather_station[nr].lat * DEG_TO_RAD, weather_station[nr].lon * DEG_TO_RAD ); + sgSetVec2( pos, weather_station[nr].lat * SGD_DEGREES_TO_RADIANS, weather_station[nr].lon * SGD_DEGREES_TO_RADIANS ); } diff --git a/tests/test-up.cxx b/tests/test-up.cxx index 96fb2c341..3aac58306 100644 --- a/tests/test-up.cxx +++ b/tests/test-up.cxx @@ -23,10 +23,10 @@ int main() { cout << "lon = " << lon << " geod lat = " << lat; double sl_radius, lat_geoc; - sgGeodToGeoc( lat * DEG_TO_RAD, alt, &sl_radius, &lat_geoc ); - cout << " geoc lat = " << lat_geoc * RAD_TO_DEG << endl; + sgGeodToGeoc( lat * SGD_DEGREES_TO_RADIANS, alt, &sl_radius, &lat_geoc ); + cout << " geoc lat = " << lat_geoc * SGD_RADIANS_TO_DEGREES << endl; - Point3D pgd( lon * DEG_TO_RAD, lat * DEG_TO_RAD, 0.0 ); + Point3D pgd( lon * SGD_DEGREES_TO_RADIANS, lat * SGD_DEGREES_TO_RADIANS, 0.0 ); Point3D pc = sgGeodToCart( pgd ); cout << " cartesian = " << pc << endl; @@ -39,7 +39,7 @@ int main() { sgdMat4 GEOC_UP; sgdVec3 geoc_up; - sgdMakeRotMat4( GEOC_UP, lon, 0.0, -lat_geoc * RAD_TO_DEG ); + sgdMakeRotMat4( GEOC_UP, lon, 0.0, -lat_geoc * SGD_RADIANS_TO_DEGREES ); sgdSetVec3( geoc_up, GEOC_UP[0][0], GEOC_UP[0][1], GEOC_UP[0][2] ); cout << " geoc up = " << geoc_up[0] << ", " << geoc_up[1] << ", " << geoc_up[2] << endl;