From 17f3d48e03c889e0e10dfc7ea4123caa230ee55a Mon Sep 17 00:00:00 2001 From: curt Date: Sat, 24 Mar 2001 02:36:45 +0000 Subject: [PATCH] FG_ to SG_ namespace changes. --- src/Cockpit/cockpit.cxx | 2 +- src/Cockpit/hud_ladr.cxx | 4 ++-- src/Cockpit/hud_tbi.cxx | 18 ++++++++--------- 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 | 5 +++-- src/GUI/mouse.cxx | 2 +- src/Main/keyboard.cxx | 28 +++++++++++++------------- src/Main/main.cxx | 8 ++++---- src/Main/options.cxx | 4 ++-- src/Main/ttest.cxx | 4 ++-- src/Main/viewer_lookat.cxx | 2 +- src/Main/viewer_rph.cxx | 2 +- src/Network/ray.cxx | 20 +++++++++---------- src/Sound/morse.cxx | 36 +++++++++++++++++----------------- src/Time/light.cxx | 4 ++-- src/Time/moonpos.cxx | 16 +++++++-------- src/Time/sunpos.cxx | 16 +++++++-------- 23 files changed, 103 insertions(+), 102 deletions(-) diff --git a/src/Cockpit/cockpit.cxx b/src/Cockpit/cockpit.cxx index 9ffee6e00..c29f53616 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 = SG_2PI - globals->get_current_view()->get_view_offset(); + 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; diff --git a/src/Cockpit/hud_ladr.cxx b/src/Cockpit/hud_ladr.cxx index 2ef45b607..5127aea01 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 * SG_PI/50.0); - sine = 6 * sin(count * 2 * SG_PI/50.0); + cosine = 6 * cos(count * 2 * SGD_PI/50.0); + sine = 6 * sin(count * 2 * SGD_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 25db5111c..0ddeaf954 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 < -SG_PI_2/3 ) { - bank_angle = -SG_PI_2/3; - } else if( bank_angle > SG_PI_2/3 ) { - bank_angle = SG_PI_2/3; + if( bank_angle < -SGD_PI_2/3 ) { + bank_angle = -SGD_PI_2/3; + } else if( bank_angle > SGD_PI_2/3 ) { + bank_angle = SGD_PI_2/3; } sideslip_angle = current_ch1(); // Sideslip limit +/- 20 degrees - if( sideslip_angle < -SG_PI/9 ) { - sideslip_angle = -SG_PI/9; - } else if( sideslip_angle > SG_PI/9 ) { - sideslip_angle = SG_PI/9; + if( sideslip_angle < -SGD_PI/9 ) { + sideslip_angle = -SGD_PI/9; + } else if( sideslip_angle > SGD_PI/9 ) { + sideslip_angle = SGD_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/(SG_2PI/9); // width represents 40 degrees + ss_const = 2 * sideslip_angle * fspan/(SGD_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/FDM/Balloon/BalloonSim.cpp b/src/FDM/Balloon/BalloonSim.cpp index 697fcd62b..10c1642f2 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) * SG_PI; - balloon_envelope_volume = (4.0/3.0) * (8.8 * 8.8 * 8.8) * SG_PI; + balloon_envelope_area = 4.0 * (8.8 * 8.8) * SGD_PI; + balloon_envelope_volume = (4.0/3.0) * (8.8 * 8.8 * 8.8) * SGD_PI; - wind_facing_area_of_balloon = SG_PI * (8.8 * 8.8); + wind_facing_area_of_balloon = SGD_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 1f0aa12ab..07c86c0b0 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, - SG_PITCHRATE, + SGD_PITCHRATE, FG_ROLLRATE, FG_YAWRATE, FG_MACH, @@ -91,7 +91,7 @@ enum eParam { FG_THROTTLE_CMD, FG_THROTTLE_POS, FG_HOVERB, - SG_PITCH_TRIM_CMD + SGD_PITCH_TRIM_CMD }; /******************************************************************************/ diff --git a/src/FDM/JSBSim/FGFCS.h b/src/FDM/JSBSim/FGFCS.h index c9d033c7e..4643e1c35 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 SG_PITCH_TRIM_CMD + INPUT SGD_PITCH_TRIM_CMD CLIPTO -1 1 </COMPONENT> diff --git a/src/FDM/JSBSim/FGRotation.h b/src/FDM/JSBSim/FGRotation.h index 26e1d372b..c6741290e 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 SG_PI +# define M_PI SGD_PI #endif #include "FGModel.h" diff --git a/src/FDM/JSBSim/FGState.cpp b/src/FDM/JSBSim/FGState.cpp index 062846195..d0ab74ab7 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 SG_PI +# define M_PI SGD_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(SG_PITCHRATE, " pitch_rate " ); + RegisterVariable(SGD_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(SG_PITCH_TRIM_CMD, " pitch_trim_cmd " ); + RegisterVariable(SGD_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 SG_PITCHRATE: + case SGD_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 SG_PITCH_TRIM_CMD: + case SGD_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 8583bdf1e..5bc3f407a 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(SG_PITCHRATE)*RADTODEG ); + fdmex->GetState()->GetParameter(SGD_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 d4975bf2c..209bd345f 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 < -SG_PI ) { tmp_lon_geoc += SG_2PI; } - while ( tmp_lon_geoc > SG_PI ) { tmp_lon_geoc -= SG_2PI; } + while ( tmp_lon_geoc < -SGD_PI ) { tmp_lon_geoc += SG_2PI; } + while ( tmp_lon_geoc > SGD_PI ) { tmp_lon_geoc -= SG_2PI; } double tmp_lon = Longitude; - while ( tmp_lon < -SG_PI ) { tmp_lon += SG_2PI; } - while ( tmp_lon > SG_PI ) { tmp_lon -= SG_2PI; } + while ( tmp_lon < -SGD_PI ) { tmp_lon += SG_2PI; } + while ( tmp_lon > SGD_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 01c82a079..46816061f 100644 --- a/src/FDM/MagicCarpet.cxx +++ b/src/FDM/MagicCarpet.cxx @@ -62,11 +62,12 @@ bool FGMagicCarpet::update( int multiloop ) { _set_V_ground_speed( kts ); // angle of turn - double turn_rate = controls.get_aileron() * SG_PI_4; // radians/sec + double turn_rate = controls.get_aileron() * SGD_PI_4; // radians/sec double turn = turn_rate * time_step; // update euler angles - _set_Euler_Angles( get_Phi(), get_Theta(), fmod(get_Psi() + turn, SG_2PI) ); + _set_Euler_Angles( get_Phi(), get_Theta(), + fmod(get_Psi() + turn, SGD_2PI) ); _set_Euler_Rates(0,0,0); // update (lon/lat) position diff --git a/src/GUI/mouse.cxx b/src/GUI/mouse.cxx index 1c28a46aa..258b619f4 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 SG_PI movement in each half of screen + // try to get SGD_PI movement in each half of screen // do spherical pan W = ww; H = wh; diff --git a/src/Main/keyboard.cxx b/src/Main/keyboard.cxx index 6b5d95054..ed96a39cd 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( SG_PI * 0.75 ); + v->set_goal_view_offset( SGD_PI * 0.75 ); return; case 50: // numeric keypad 2 - v->set_goal_view_offset( SG_PI ); + v->set_goal_view_offset( SGD_PI ); return; case 51: // numeric keypad 3 - v->set_goal_view_offset( SG_PI * 1.25 ); + v->set_goal_view_offset( SGD_PI * 1.25 ); return; case 52: // numeric keypad 4 - v->set_goal_view_offset( SG_PI * 0.50 ); + v->set_goal_view_offset( SGD_PI * 0.50 ); return; case 54: // numeric keypad 6 - v->set_goal_view_offset( SG_PI * 1.50 ); + v->set_goal_view_offset( SGD_PI * 1.50 ); return; case 55: // numeric keypad 7 - v->set_goal_view_offset( SG_PI * 0.25 ); + v->set_goal_view_offset( SGD_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( SG_PI * 1.75 ); + v->set_goal_view_offset( SGD_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( SG_PI * 0.75 ); + v->set_goal_view_offset( SGD_PI * 0.75 ); return; case GLUT_KEY_DOWN: // numeric keypad 2 - v->set_goal_view_offset( SG_PI ); + v->set_goal_view_offset( SGD_PI ); return; case GLUT_KEY_PAGE_DOWN: // numeric keypad 3 - v->set_goal_view_offset( SG_PI * 1.25 ); + v->set_goal_view_offset( SGD_PI * 1.25 ); return; case GLUT_KEY_LEFT: // numeric keypad 4 - v->set_goal_view_offset( SG_PI * 0.50 ); + v->set_goal_view_offset( SGD_PI * 0.50 ); return; case GLUT_KEY_RIGHT: // numeric keypad 6 - v->set_goal_view_offset( SG_PI * 1.50 ); + v->set_goal_view_offset( SGD_PI * 1.50 ); return; case GLUT_KEY_HOME: // numeric keypad 7 - v->set_goal_view_offset( SG_PI * 0.25 ); + v->set_goal_view_offset( SGD_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( SG_PI * 1.75 ); + v->set_goal_view_offset( SGD_PI * 1.75 ); return; } } else { diff --git a/src/Main/main.cxx b/src/Main/main.cxx index ea9caccaf..69291af59 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -802,13 +802,13 @@ 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() < SG_PI ){ + if ( v->get_goal_view_offset() - v->get_view_offset() < SGD_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() < SG_PI ){ + if ( v->get_view_offset() - v->get_goal_view_offset() < SGD_PI ){ v->inc_view_offset( -0.01 ); } else { v->inc_view_offset( 0.01 ); @@ -822,7 +822,7 @@ void fgUpdateTimeDepCalcs() { } } - double tmp = -(l->sun_rotation + SG_PI) + double tmp = -(l->sun_rotation + SGD_PI) - (cur_fdm_state->get_Psi() - globals->get_current_view()->get_view_offset() ); while ( tmp < 0.0 ) { @@ -833,7 +833,7 @@ void fgUpdateTimeDepCalcs() { } /* 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+SG_PI) * RAD_TO_DEG, tmp * RAD_TO_DEG); */ + -(l->sun_rotation+SGD_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 959f64c7b..b64ebfd71 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 = SG_PI * 0.25; + default_view_offset = SGD_PI * 0.25; } else if ( woffset == "RIGHT" ) { - default_view_offset = SG_PI * 1.75; + default_view_offset = SGD_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 9518bc019..312ba3fa1 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, SG_PI + FG_Psi); + MAT3rotate(R_Psi, vec, SGD_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 - SG_PI_2 ); + MAT3rotate(R_Lon, vec, FG_Longitude - SGD_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 511bded43..37f8748fe 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, SG_PI_2 * RAD_TO_DEG, world_up ); + sgMakeRotMat4( TMP, SGD_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 83db4916f..04d131ca7 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, SG_PI_2 * RAD_TO_DEG, world_up ); + sgMakeRotMat4( TMP, SGD_PI_2 * RAD_TO_DEG, world_up ); // cout << "sgMat4 TMP" << endl; // print_sgMat4( TMP ); sgXformVec3(surface_east, surface_south, TMP); diff --git a/src/Network/ray.cxx b/src/Network/ray.cxx index 2644e7057..ece2b67fc 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*SG_PI/3 ) { - ang_pos += 2 * SG_PI; + while ( ang_pos < -2*SGD_PI/3 ) { + ang_pos += 2 * SGD_PI; } - while ( ang_pos > 4*SG_PI/3 ) { - ang_pos -= 2 * SG_PI; + while ( ang_pos > 4*SGD_PI/3 ) { + ang_pos -= 2 * SGD_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 ) > SG_PI ) + if ( fabs ( ang_pos - chair_heading ) > SGD_PI ) { /* Need to swing chair by 360 degrees */ if ( ang_pos < chair_heading ) - chair_heading -= 2 * SG_PI; - else chair_heading += 2 * SG_PI; + chair_heading -= 2 * SGD_PI; + else chair_heading += 2 * SGD_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) > SG_PI / 2 ) + if ( fabs(ang_pos) > SGD_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 < -SG_PI / 2 ) *dac = 0x0000; else - if ( propose > SG_PI / 2 ) *dac = 0xFFFF; else + if ( propose < -SGD_PI / 2 ) *dac = 0x0000; else + if ( propose > SGD_PI / 2 ) *dac = 0xFFFF; else *dac = (unsigned short) ( 32767 * ( 1.0 + sin ( propose ) ) ); } diff --git a/src/Sound/morse.cxx b/src/Sound/morse.cxx index 0e134fbf5..50f58ab99 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 * SG_PI + float level = ( sin( (double) i * 2.0 * SGD_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 * SG_PI + float level = ( sin( (double) i * 2.0 * SGD_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 * SG_PI + float level = ( sin( (double) i * 2.0 * SGD_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 * SG_PI + float level = ( sin( (double) i * 2.0 * SGD_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 * SG_PI + float level = ( sin( (double) i * 2.0 * SGD_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 * SG_PI + float level = ( sin( (double) i * 2.0 * SGD_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 * SG_PI + float level = ( sin( (double) i * 2.0 * SGD_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 * SG_PI + float level = ( sin( (double) i * 2.0 * SGD_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 * SG_PI + float level = ( sin( (double) i * 2.0 * SGD_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 * SG_PI + float level = ( sin( (double) i * 2.0 * SGD_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 * SG_PI + float level = ( sin( (double) i * 2.0 * SGD_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 * SG_PI + float level = ( sin( (double) i * 2.0 * SGD_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 * SG_PI / (8000.0 / freq)) ) + float level = ( sin( (double) i * 2.0 * SGD_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 * SG_PI / (8000.0 / freq) ) ) + float level = ( sin( (double) i * 2.0 * SGD_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 * SG_PI / (8000.0 / freq) ) ) + float level = ( sin( (double) i * 2.0 * SGD_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 * SG_PI / (8000.0 / freq) ) ) + float level = ( sin( (double) i * 2.0 * SGD_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 * SG_PI / (8000.0 / freq) ) ) + float level = ( sin( (double) i * 2.0 * SGD_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 * SG_PI / (8000.0 / freq) ) ) + float level = ( sin( (double) i * 2.0 * SGD_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 d2567a13d..fc145b480 100644 --- a/src/Time/light.cxx +++ b/src/Time/light.cxx @@ -167,10 +167,10 @@ void fgLIGHT::UpdateAdjFog( void ) { // first determine the difference between our view angle and local // direction to the sun - rotation = -(sun_rotation + SG_PI) + rotation = -(sun_rotation + SGD_PI) - (f->get_Psi() - globals->get_current_view()->get_view_offset()); if ( globals->get_current_view()->get_reverse_view_offset() ) { - rotation += SG_PI; + rotation += SGD_PI; } while ( rotation < 0 ) { rotation += SG_2PI; diff --git a/src/Time/moonpos.cxx b/src/Time/moonpos.cxx index fd63cd69f..e038c21cd 100644 --- a/src/Time/moonpos.cxx +++ b/src/Time/moonpos.cxx @@ -284,12 +284,12 @@ void fgMoonPosition(time_t ssue, double *lon, double *lat) { ecliptic_to_equatorial( globals->get_ephem()->get_moon()->getLon(), 0.0, &alpha, &delta ); tmp = alpha - (SG_2PI/24)*GST(ssue); - if (tmp < -SG_PI) { + if (tmp < -SGD_PI) { do tmp += SG_2PI; - while (tmp < -SG_PI); - } else if (tmp > SG_PI) { + while (tmp < -SGD_PI); + } else if (tmp > SGD_PI) { do tmp -= SG_2PI; - while (tmp < -SG_PI); + while (tmp < -SGD_PI); } *lon = tmp; @@ -319,12 +319,12 @@ static void fgMoonPositionGST(double gst, double *lon, double *lat) { // tmp = alpha - (SG_2PI/24)*GST(ssue); tmp = alpha - (SG_2PI/24)*gst; - if (tmp < -SG_PI) { + if (tmp < -SGD_PI) { do tmp += SG_2PI; - while (tmp < -SG_PI); - } else if (tmp > SG_PI) { + while (tmp < -SGD_PI); + } else if (tmp > SGD_PI) { do tmp -= SG_2PI; - while (tmp < -SG_PI); + while (tmp < -SGD_PI); } *lon = tmp; diff --git a/src/Time/sunpos.cxx b/src/Time/sunpos.cxx index e693757f1..49a1f8aaf 100644 --- a/src/Time/sunpos.cxx +++ b/src/Time/sunpos.cxx @@ -192,12 +192,12 @@ void fgSunPosition(time_t ssue, double *lon, double *lat) { ecliptic_to_equatorial( globals->get_ephem()->get_sun()->getLon(), 0.0, &alpha, &delta ); tmp = alpha - (SG_2PI/24)*GST(ssue); - if (tmp < -SG_PI) { + if (tmp < -SGD_PI) { do tmp += SG_2PI; - while (tmp < -SG_PI); - } else if (tmp > SG_PI) { + while (tmp < -SGD_PI); + } else if (tmp > SGD_PI) { do tmp -= SG_2PI; - while (tmp < -SG_PI); + while (tmp < -SGD_PI); } *lon = tmp; @@ -227,12 +227,12 @@ static void fgSunPositionGST(double gst, double *lon, double *lat) { // tmp = alpha - (SG_2PI/24)*GST(ssue); tmp = alpha - (SG_2PI/24)*gst; - if (tmp < -SG_PI) { + if (tmp < -SGD_PI) { do tmp += SG_2PI; - while (tmp < -SG_PI); - } else if (tmp > SG_PI) { + while (tmp < -SGD_PI); + } else if (tmp > SGD_PI) { do tmp -= SG_2PI; - while (tmp < -SG_PI); + while (tmp < -SGD_PI); } *lon = tmp;