1
0
Fork 0

SG_ namespace.

This commit is contained in:
curt 2001-03-24 04:56:46 +00:00
parent 17c96ae69e
commit 5ea9c04c64
26 changed files with 178 additions and 178 deletions

View file

@ -294,7 +294,7 @@ void NewAltitudeInit(void)
float alt = cur_fdm_state->get_Altitude();
if ( fgGetString("/sim/startup/units") == "meters") {
alt *= FEET_TO_METER;
alt *= SG_FEET_TO_METER;
}
int len = 260/2 -
@ -596,7 +596,7 @@ void TgtAptDialog_OK (puObject *)
string alt_str = tmp.substr( pos + 1 );
alt = atof( alt_str.c_str() );
if ( fgGetString("/sim/startup/units") == "feet" ) {
alt *= FEET_TO_METER;
alt *= SG_FEET_TO_METER;
}
} else {
TgtAptId = tmp;

View file

@ -51,8 +51,8 @@ FGAutopilot *current_autopilot;
// Climb speed constants
const double min_climb = 70.0; // kts
const double best_climb = 75.0; // kts
// const double ideal_climb_rate = 500.0 * FEET_TO_METER; // fpm -> mpm
// const double ideal_decent_rate = 1000.0 * FEET_TO_METER; // fpm -> mpm
// const double ideal_climb_rate = 500.0 * SG_FEET_TO_METER; // fpm -> mpm
// const double ideal_decent_rate = 1000.0 * SG_FEET_TO_METER; // fpm -> mpm
/// These statics will eventually go into the class
/// they are just here while I am experimenting -- NHV :-)
@ -71,7 +71,7 @@ extern char *coord_format_lon(float);
// constructor
FGAutopilot::FGAutopilot():
TargetClimbRate(1000 * FEET_TO_METER)
TargetClimbRate(1000 * SG_FEET_TO_METER)
{
}
@ -113,7 +113,7 @@ static inline double get_ground_speed() {
// starts in ft/s so we convert to kts
double ft_s = cur_fdm_state->get_V_ground_speed()
* fgGetInt("/sim/speed-up"); // FIXME: inefficient
double kts = ft_s * FEET_TO_METER * 3600 * METER_TO_NM;
double kts = ft_s * SG_FEET_TO_METER * 3600 * SG_METER_TO_NM;
return kts;
}
@ -141,7 +141,7 @@ void FGAutopilot::MakeTargetWPStr( double distance ) {
if ( size > 0 ) {
SGWayPoint wp1 = globals->get_route()->get_waypoint( 0 );
accum += distance;
double eta = accum * METER_TO_NM / get_ground_speed();
double eta = accum * SG_METER_TO_NM / get_ground_speed();
if ( eta >= 100.0 ) { eta = 99.999; }
int major, minor;
if ( eta < (1.0/6.0) ) {
@ -152,8 +152,8 @@ void FGAutopilot::MakeTargetWPStr( double distance ) {
minor = (int)((eta - (int)eta) * 60.0);
sprintf( TargetWP1Str, "%s %.2f NM ETA %d:%02d",
wp1.get_id().c_str(),
accum*METER_TO_NM, major, minor );
// cout << "distance = " << distance*METER_TO_NM
accum*SG_METER_TO_NM, major, minor );
// cout << "distance = " << distance*SG_METER_TO_NM
// << " gndsp = " << get_ground_speed()
// << " time = " << eta
// << " major = " << major
@ -166,7 +166,7 @@ void FGAutopilot::MakeTargetWPStr( double distance ) {
SGWayPoint wp2 = globals->get_route()->get_waypoint( 1 );
accum += wp2.get_distance();
double eta = accum * METER_TO_NM / get_ground_speed();
double eta = accum * SG_METER_TO_NM / get_ground_speed();
if ( eta >= 100.0 ) { eta = 99.999; }
int major, minor;
if ( eta < (1.0/6.0) ) {
@ -177,7 +177,7 @@ void FGAutopilot::MakeTargetWPStr( double distance ) {
minor = (int)((eta - (int)eta) * 60.0);
sprintf( TargetWP2Str, "%s %.2f NM ETA %d:%02d",
wp2.get_id().c_str(),
accum*METER_TO_NM, major, minor );
accum*SG_METER_TO_NM, major, minor );
}
// next route
@ -188,7 +188,7 @@ void FGAutopilot::MakeTargetWPStr( double distance ) {
SGWayPoint wpn = globals->get_route()->get_waypoint( size - 1 );
double eta = accum * METER_TO_NM / get_ground_speed();
double eta = accum * SG_METER_TO_NM / get_ground_speed();
if ( eta >= 100.0 ) { eta = 99.999; }
int major, minor;
if ( eta < (1.0/6.0) ) {
@ -199,7 +199,7 @@ void FGAutopilot::MakeTargetWPStr( double distance ) {
minor = (int)((eta - (int)eta) * 60.0);
sprintf( TargetWP3Str, "%s %.2f NM ETA %d:%02d",
wpn.get_id().c_str(),
accum*METER_TO_NM, major, minor );
accum*SG_METER_TO_NM, major, minor );
}
}
@ -352,7 +352,7 @@ int FGAutopilot::run() {
double lat = FGBFI::getLatitude();
double lon = FGBFI::getLongitude();
double alt = FGBFI::getAltitude() * FEET_TO_METER;
double alt = FGBFI::getAltitude() * SG_FEET_TO_METER;
#ifdef FG_FORCE_AUTO_DISENGAGE
// see if somebody else has changed them
@ -425,7 +425,7 @@ int FGAutopilot::run() {
// determine the heading adjustment needed.
double adjustment =
current_radiostack->get_nav1_heading_needle_deflection()
* (current_radiostack->get_nav1_loc_dist() * METER_TO_NM);
* (current_radiostack->get_nav1_loc_dist() * SG_METER_TO_NM);
if ( adjustment < -30.0 ) { adjustment = -30.0; }
if ( adjustment > 30.0 ) { adjustment = 30.0; }
@ -587,14 +587,14 @@ int FGAutopilot::run() {
if ( altitude_mode == FG_ALTITUDE_LOCK ) {
// normal altitude hold
// cout << "TargetAltitude = " << TargetAltitude
// << "Altitude = " << FGBFI::getAltitude() * FEET_TO_METER
// << "Altitude = " << FGBFI::getAltitude() * SG_FEET_TO_METER
// << endl;
climb_rate =
( TargetAltitude - FGSteam::get_ALT_ft() * FEET_TO_METER ) * 8.0;
( TargetAltitude - FGSteam::get_ALT_ft() * SG_FEET_TO_METER ) * 8.0;
} else if ( altitude_mode == FG_ALTITUDE_GS1 ) {
double x = current_radiostack->get_nav1_gs_dist();
double y = (FGBFI::getAltitude()
- current_radiostack->get_nav1_elev()) * FEET_TO_METER;
- current_radiostack->get_nav1_elev()) * SG_FEET_TO_METER;
double current_angle = atan2( y, x ) * SGD_RADIANS_TO_DEGREES;
// cout << "current angle = " << current_angle << endl;
@ -611,7 +611,7 @@ int FGAutopilot::run() {
// convert to meter/min
// cout << "raw ground speed = " << cur_fdm_state->get_V_ground_speed() << endl;
double horiz_vel = cur_fdm_state->get_V_ground_speed()
* FEET_TO_METER * 60.0;
* SG_FEET_TO_METER * 60.0;
// cout << "Horizontal vel = " << horiz_vel << endl;
climb_rate = -sin( des_angle * SGD_DEGREES_TO_RADIANS ) * horiz_vel;
// cout << "climb_rate = " << climb_rate << endl;
@ -620,7 +620,7 @@ int FGAutopilot::run() {
} else if ( altitude_mode == FG_ALTITUDE_TERRAIN ) {
// brain dead ground hugging with no look ahead
climb_rate =
( TargetAGL - FGBFI::getAGL()*FEET_TO_METER ) * 16.0;
( TargetAGL - FGBFI::getAGL()*SG_FEET_TO_METER ) * 16.0;
// cout << "target agl = " << TargetAGL
// << " current agl = " << fgAPget_agl()
// << " target climb rate = " << climb_rate
@ -658,10 +658,10 @@ int FGAutopilot::run() {
}
// cout << "Target climb rate = " << TargetClimbRate << endl;
// cout << "given our speed, modified desired climb rate = "
// << climb_rate * METER_TO_FEET
// << climb_rate * SG_METER_TO_FEET
// << " fpm" << endl;
error = FGBFI::getVerticalSpeed() * FEET_TO_METER - climb_rate;
error = FGBFI::getVerticalSpeed() * SG_FEET_TO_METER - climb_rate;
// cout << "climb rate = " << FGBFI::getVerticalSpeed()
// << " vsi rate = " << FGSteam::get_VSI_fps() << endl;
@ -798,7 +798,7 @@ void FGAutopilot::set_HeadingMode( fgAutoHeadingMode mode ) {
waypoint = globals->get_route()->get_first();
waypoint.CourseAndDistance( FGBFI::getLongitude(),
FGBFI::getLatitude(),
FGBFI::getLatitude() * FEET_TO_METER,
FGBFI::getLatitude() * SG_FEET_TO_METER,
&course, &distance );
TargetHeading = course;
TargetDistance = distance;
@ -810,7 +810,7 @@ void FGAutopilot::set_HeadingMode( fgAutoHeadingMode mode ) {
TargetAltitude = waypoint.get_target_alt();
altitude_mode = FG_ALTITUDE_LOCK;
set_AltitudeEnabled( true );
MakeTargetAltitudeStr( TargetAltitude * METER_TO_FEET );
MakeTargetAltitudeStr( TargetAltitude * SG_METER_TO_FEET );
}
FG_LOG( FG_COCKPIT, FG_INFO, " set_HeadingMode: ( "
@ -835,25 +835,25 @@ void FGAutopilot::set_AltitudeMode( fgAutoAltitudeMode mode ) {
alt_error_accum = 0.0;
if ( altitude_mode == FG_ALTITUDE_LOCK ) {
if ( TargetAltitude < FGBFI::getAGL() * FEET_TO_METER ) {
// TargetAltitude = FGBFI::getAltitude() * FEET_TO_METER;
if ( TargetAltitude < FGBFI::getAGL() * SG_FEET_TO_METER ) {
// TargetAltitude = FGBFI::getAltitude() * SG_FEET_TO_METER;
}
if ( fgGetString("/sim/startup/units") == "feet" ) {
MakeTargetAltitudeStr( TargetAltitude * METER_TO_FEET );
MakeTargetAltitudeStr( TargetAltitude * SG_METER_TO_FEET );
} else {
MakeTargetAltitudeStr( TargetAltitude * METER_TO_FEET );
MakeTargetAltitudeStr( TargetAltitude * SG_METER_TO_FEET );
}
} else if ( altitude_mode == FG_ALTITUDE_GS1 ) {
climb_error_accum = 0.0;
} else if ( altitude_mode == FG_ALTITUDE_TERRAIN ) {
TargetAGL = FGBFI::getAGL() * FEET_TO_METER;
TargetAGL = FGBFI::getAGL() * SG_FEET_TO_METER;
if ( fgGetString("/sim/startup/units") == "feet" ) {
MakeTargetAltitudeStr( TargetAGL * METER_TO_FEET );
MakeTargetAltitudeStr( TargetAGL * SG_METER_TO_FEET );
} else {
MakeTargetAltitudeStr( TargetAGL * METER_TO_FEET );
MakeTargetAltitudeStr( TargetAGL * SG_METER_TO_FEET );
}
}
@ -888,12 +888,12 @@ double fgAPget_heading( void ) {
}
static inline double fgAPget_altitude( void ) {
return( cur_fdm_state->get_Altitude() * FEET_TO_METER );
return( cur_fdm_state->get_Altitude() * SG_FEET_TO_METER );
}
static inline double fgAPget_climb( void ) {
// return in meters per minute
return( cur_fdm_state->get_Climb_Rate() * FEET_TO_METER * 60 );
return( cur_fdm_state->get_Climb_Rate() * SG_FEET_TO_METER * 60 );
}
static inline double get_sideslip( void ) {
@ -903,7 +903,7 @@ static inline double get_sideslip( void ) {
static inline double fgAPget_agl( void ) {
double agl;
agl = cur_fdm_state->get_Altitude() * FEET_TO_METER
agl = cur_fdm_state->get_Altitude() * SG_FEET_TO_METER
- scenery.cur_elev;
return( agl );
@ -917,7 +917,7 @@ void FGAutopilot::AltitudeSet( double new_altitude ) {
// cout << "new altitude = " << new_altitude << endl;
if ( fgGetString("/sim/startup/units") == "feet" ) {
target_alt = new_altitude * FEET_TO_METER;
target_alt = new_altitude * SG_FEET_TO_METER;
}
if( target_alt < scenery.cur_elev ) {
@ -930,7 +930,7 @@ void FGAutopilot::AltitudeSet( double new_altitude ) {
// cout << "TargetAltitude = " << TargetAltitude << endl;
if ( fgGetString("/sim/startup/units") == "feet" ) {
target_alt *= METER_TO_FEET;
target_alt *= SG_METER_TO_FEET;
}
// ApAltitudeDialogInput->setValue((float)target_alt);
MakeTargetAltitudeStr( target_alt );
@ -944,8 +944,8 @@ void FGAutopilot::AltitudeAdjust( double inc )
double target_alt, target_agl;
if ( fgGetString("/sim/startup/units") == "feet" ) {
target_alt = TargetAltitude * METER_TO_FEET;
target_agl = TargetAGL * METER_TO_FEET;
target_alt = TargetAltitude * SG_METER_TO_FEET;
target_agl = TargetAGL * SG_METER_TO_FEET;
} else {
target_alt = TargetAltitude;
target_agl = TargetAGL;
@ -968,17 +968,17 @@ void FGAutopilot::AltitudeAdjust( double inc )
}
if ( fgGetString("/sim/startup/units") == "feet" ) {
target_alt *= FEET_TO_METER;
target_agl *= FEET_TO_METER;
target_alt *= SG_FEET_TO_METER;
target_agl *= SG_FEET_TO_METER;
}
TargetAltitude = target_alt;
TargetAGL = target_agl;
if ( fgGetString("/sim/startup/units") == "feet" )
target_alt *= METER_TO_FEET;
target_alt *= SG_METER_TO_FEET;
if ( fgGetString("/sim/startup/units") == "feet" )
target_agl *= METER_TO_FEET;
target_agl *= SG_METER_TO_FEET;
if ( altitude_mode == FG_ALTITUDE_LOCK ) {
MakeTargetAltitudeStr( target_alt );

View file

@ -195,14 +195,14 @@ float get_altitude( void )
// double rough_elev;
// current_aircraft.fdm_state
// rough_elev = mesh_altitude(f->get_Longitude() * RAD_TO_ARCSEC,
// f->get_Latitude() * RAD_TO_ARCSEC);
// rough_elev = mesh_altitude(f->get_Longitude() * SG_RAD_TO_ARCSEC,
// f->get_Latitude() * SG_RAD_TO_ARCSEC);
float altitude;
if ( fgGetString("/sim/startup/units") == "feet" ) {
altitude = current_aircraft.fdm_state->get_Altitude();
} else {
altitude = (current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER);
altitude = (current_aircraft.fdm_state->get_Altitude() * SG_FEET_TO_METER);
}
return altitude;
}
@ -213,9 +213,9 @@ float get_agl( void )
if ( fgGetString("/sim/startup/units") == "feet" ) {
agl = (current_aircraft.fdm_state->get_Altitude()
- scenery.cur_elev * METER_TO_FEET);
- scenery.cur_elev * SG_METER_TO_FEET);
} else {
agl = (current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER
agl = (current_aircraft.fdm_state->get_Altitude() * SG_FEET_TO_METER
- scenery.cur_elev);
}
return agl;
@ -266,7 +266,7 @@ float get_climb_rate( void )
if ( fgGetString("/sim/startup/units") == "feet" ) {
climb_rate = current_aircraft.fdm_state->get_Climb_Rate() * 60.0;
} else {
climb_rate = current_aircraft.fdm_state->get_Climb_Rate() * FEET_TO_METER * 60.0;
climb_rate = current_aircraft.fdm_state->get_Climb_Rate() * SG_FEET_TO_METER * 60.0;
}
return (climb_rate);
}

View file

@ -57,7 +57,7 @@ static double kludgeRange ( double stationElev, double aircraftElev,
// Assume that the nominal range (usually
// 50nm) applies at a 5,000 ft difference.
// Just a wild guess!
double factor = ((aircraftElev*METER_TO_FEET) - stationElev) / 5000.0;
double factor = ((aircraftElev*SG_METER_TO_FEET) - stationElev) / 5000.0;
double range = fabs(nominalRange * factor);
// Clamp the range to keep it sane; for
@ -249,8 +249,8 @@ double FGRadioStack::adjustNavRange( double stationElev, double aircraftElev,
// to model diminishing returns at too-high altitudes.
// altitude difference
double alt = ( aircraftElev * METER_TO_FEET - stationElev );
// cout << "aircraft elev = " << aircraftElev * METER_TO_FEET
double alt = ( aircraftElev * SG_METER_TO_FEET - stationElev );
// cout << "aircraft elev = " << aircraftElev * SG_METER_TO_FEET
// << " station elev = " << stationElev << endl;
if ( nominalRange < 25.0 + SG_EPSILON ) {
@ -277,7 +277,7 @@ double FGRadioStack::adjustILSRange( double stationElev, double aircraftElev,
// assumptions we model the standard service volume, plus
// altitude difference
// double alt = ( aircraftElev * METER_TO_FEET - stationElev );
// double alt = ( aircraftElev * SG_METER_TO_FEET - stationElev );
double offset = fabs( offsetDegrees );
if ( offset < 10 ) {
@ -298,7 +298,7 @@ FGRadioStack::update()
{
double lon = longitudeVal->getDoubleValue() * SGD_DEGREES_TO_RADIANS;
double lat = latitudeVal->getDoubleValue() * SGD_DEGREES_TO_RADIANS;
double elev = altitudeVal->getDoubleValue() * FEET_TO_METER;
double elev = altitudeVal->getDoubleValue() * SG_FEET_TO_METER;
need_update = false;
@ -340,19 +340,19 @@ FGRadioStack::update()
while ( offset > 180.0 ) { offset -= 360.0; }
// cout << "ils offset = " << offset << endl;
nav1_effective_range = adjustILSRange(nav1_elev, elev, offset,
nav1_loc_dist * METER_TO_NM );
nav1_loc_dist * SG_METER_TO_NM );
} else {
nav1_effective_range = adjustNavRange(nav1_elev, elev, nav1_range);
}
// cout << "nav1 range = " << nav1_effective_range
// << " (" << nav1_range << ")" << endl;
if ( nav1_loc_dist < nav1_effective_range * NM_TO_METER ) {
if ( nav1_loc_dist < nav1_effective_range * SG_NM_TO_METER ) {
nav1_inrange = true;
} else if ( nav1_loc_dist < 2 * nav1_effective_range * NM_TO_METER ) {
} else if ( nav1_loc_dist < 2 * nav1_effective_range * SG_NM_TO_METER ) {
nav1_inrange = sg_random() <
( 2 * nav1_effective_range * NM_TO_METER - nav1_loc_dist ) /
(nav1_effective_range * NM_TO_METER);
( 2 * nav1_effective_range * SG_NM_TO_METER - nav1_loc_dist ) /
(nav1_effective_range * SG_NM_TO_METER);
} else {
nav1_inrange = false;
}
@ -433,19 +433,19 @@ FGRadioStack::update()
while ( offset > 180.0 ) { offset -= 360.0; }
// cout << "ils offset = " << offset << endl;
nav2_effective_range = adjustILSRange(nav2_elev, elev, offset,
nav2_loc_dist * METER_TO_NM );
nav2_loc_dist * SG_METER_TO_NM );
} else {
nav2_effective_range = adjustNavRange(nav2_elev, elev, nav2_range);
}
// cout << "nav2 range = " << nav2_effective_range
// << " (" << nav2_range << ")" << endl;
if ( nav2_loc_dist < nav2_effective_range * NM_TO_METER ) {
if ( nav2_loc_dist < nav2_effective_range * SG_NM_TO_METER ) {
nav2_inrange = true;
} else if ( nav2_loc_dist < 2 * nav2_effective_range * NM_TO_METER ) {
} else if ( nav2_loc_dist < 2 * nav2_effective_range * SG_NM_TO_METER ) {
nav2_inrange = sg_random() <
( 2 * nav2_effective_range * NM_TO_METER - nav2_loc_dist ) /
(nav2_effective_range * NM_TO_METER);
( 2 * nav2_effective_range * SG_NM_TO_METER - nav2_loc_dist ) /
(nav2_effective_range * SG_NM_TO_METER);
} else {
nav2_inrange = false;
}
@ -508,12 +508,12 @@ FGRadioStack::update()
// << " dist = " << nav2_dist << endl;
adf_effective_range = kludgeRange(adf_elev, elev, adf_range);
if ( adf_dist < adf_effective_range * NM_TO_METER ) {
if ( adf_dist < adf_effective_range * SG_NM_TO_METER ) {
adf_inrange = true;
} else if ( adf_dist < 2 * adf_effective_range * NM_TO_METER ) {
} else if ( adf_dist < 2 * adf_effective_range * SG_NM_TO_METER ) {
adf_inrange = sg_random() <
( 2 * adf_effective_range * NM_TO_METER - adf_dist ) /
(adf_effective_range * NM_TO_METER);
( 2 * adf_effective_range * SG_NM_TO_METER - adf_dist ) /
(adf_effective_range * SG_NM_TO_METER);
} else {
adf_inrange = false;
}
@ -552,7 +552,7 @@ void FGRadioStack::search()
{
double lon = longitudeVal->getDoubleValue() * SGD_DEGREES_TO_RADIANS;
double lat = latitudeVal->getDoubleValue() * SGD_DEGREES_TO_RADIANS;
double elev = altitudeVal->getDoubleValue() * FEET_TO_METER;
double elev = altitudeVal->getDoubleValue() * SG_FEET_TO_METER;
// nav1
FGILS ils;
@ -938,7 +938,7 @@ double FGRadioStack::get_nav2_heading_needle_deflection() const {
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 y = (FGBFI::getAltitude() - nav1_elev) * SG_FEET_TO_METER;
double angle = atan2( y, x ) * SGD_RADIANS_TO_DEGREES;
return (nav1_target_gs - angle) * 5.0;
} else {
@ -952,7 +952,7 @@ double FGRadioStack::get_nav1_gs_needle_deflection() const {
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 y = (FGBFI::getAltitude() - nav2_elev) * SG_FEET_TO_METER;
double angle = atan2( y, x ) * SGD_RADIANS_TO_DEGREES;
return (nav2_target_gs - angle) * 5.0;
} else {

View file

@ -418,7 +418,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;
* SG_FEET_TO_METER;
double angle = atan2( y, x ) * SGD_RADIANS_TO_DEGREES;
return (current_radiostack->get_nav1_target_gs() - angle) * 5.0;
} else {

View file

@ -85,7 +85,7 @@ void FGBalloonSim::init() {
sgSetVec3( temp,
get_Latitude(),
get_Longitude(),
get_Altitude() * FEET_TO_METER);
get_Altitude() * SG_FEET_TO_METER);
current_balloon.setPosition( temp );
//set Euler angles (?)
@ -121,7 +121,7 @@ bool FGBalloonSim::update( int multiloop ) {
//not more implemented yet
// Inform BalloonSim of the local terrain altitude
current_balloon.setGroundLevel ( get_Runway_altitude() * FEET_TO_METER);
current_balloon.setGroundLevel ( get_Runway_altitude() * SG_FEET_TO_METER);
// old -- FGInterface_2_JSBsim() not needed except for Init()
// translate FG to JSBsim structure
@ -186,7 +186,7 @@ bool FGBalloonSim::copy_from_BalloonSim() {
//temp[1]: longitude
//temp[2]: altitude (meters)
_updatePosition( temp[0], temp[1], temp[2] * METER_TO_FEET );
_updatePosition( temp[0], temp[1], temp[2] * SG_METER_TO_FEET );
current_balloon.getHPR( temp );
set_Euler_Angles( temp[0], temp[1], temp[2] );

View file

@ -169,15 +169,15 @@ void FGJSBsim::init() {
// for debug only
/* FG_LOG( FG_FLIGHT, FG_DEBUG, " FGJSBSim::get_Altitude(): " << get_Altitude() );
FG_LOG( FG_FLIGHT, FG_DEBUG, " FGJSBSim::get_Sea_level_radius(): " << get_Sea_level_radius() );
FG_LOG( FG_FLIGHT, FG_DEBUG, " scenery.cur_radius*METER_TO_FEET: "
<< scenery.cur_radius*METER_TO_FEET );
FG_LOG( FG_FLIGHT, FG_DEBUG, " scenery.cur_radius*SG_METER_TO_FEET: "
<< scenery.cur_radius*SG_METER_TO_FEET );
FG_LOG( FG_FLIGHT, FG_DEBUG, " Calculated Terrain ASL: " << endl
<< " " << "scenery.cur_radius*METER_TO_FEET -get_Sea_level_radius()= "
<< scenery.cur_radius*METER_TO_FEET - get_Sea_level_radius() );
<< " " << "scenery.cur_radius*SG_METER_TO_FEET -get_Sea_level_radius()= "
<< scenery.cur_radius*SG_METER_TO_FEET - get_Sea_level_radius() );
FG_LOG( FG_FLIGHT, FG_DEBUG, " Calculated Aircraft AGL: " << endl
<< " " << "get_Altitude() + get_Sea_level_radius() - scenery.cur_radius*METER_TO_FEET= "
<< get_Altitude() + get_Sea_level_radius()- scenery.cur_radius*METER_TO_FEET );
<< " " << "get_Altitude() + get_Sea_level_radius() - scenery.cur_radius*SG_METER_TO_FEET= "
<< get_Altitude() + get_Sea_level_radius()- scenery.cur_radius*SG_METER_TO_FEET );
FG_LOG( FG_FLIGHT, FG_DEBUG, " fgGetDouble("/position/altitude"): "
<< fgGetDouble("/position/altitude") );
FG_LOG( FG_FLIGHT, FG_DEBUG, " FGBFI::getAltitude(): "
@ -206,7 +206,7 @@ bool FGJSBsim::update( int multiloop ) {
if(needTrim && fgGetBool("/sim/startup/trim")) {
//fgic->SetSeaLevelRadiusFtIC( get_Sea_level_radius() );
//fgic->SetTerrainAltitudeFtIC( scenery.cur_elev * METER_TO_FEET );
//fgic->SetTerrainAltitudeFtIC( scenery.cur_elev * SG_METER_TO_FEET );
FGTrim *fgtrim;
if(fgic->GetVcalibratedKtsIC() < 10 ) {
fgic->SetVcalibratedKtsIC(0.0);
@ -285,7 +285,7 @@ bool FGJSBsim::copy_to_JSBsim() {
fdmex->GetFCS()->SetCBrake( controls.get_brake( 2 ) );
fdmex->GetPosition()->SetSeaLevelRadius( get_Sea_level_radius() );
fdmex->GetPosition()->SetRunwayRadius( scenery.cur_elev*METER_TO_FEET
fdmex->GetPosition()->SetRunwayRadius( scenery.cur_elev*SG_METER_TO_FEET
+ get_Sea_level_radius() );
fdmex->GetAtmosphere()->SetExTemperature(get_Static_temperature());
@ -421,8 +421,8 @@ void FGJSBsim::set_Latitude(double lat) {
snap_shot();
sgGeodToGeoc( lat, get_Altitude() , &sea_level_radius_meters, &lat_geoc);
_set_Sea_level_radius( sea_level_radius_meters * METER_TO_FEET );
fgic->SetSeaLevelRadiusFtIC( sea_level_radius_meters * METER_TO_FEET );
_set_Sea_level_radius( sea_level_radius_meters * SG_METER_TO_FEET );
fgic->SetSeaLevelRadiusFtIC( sea_level_radius_meters * SG_METER_TO_FEET );
fgic->SetLatitudeRadIC( lat_geoc );
fdmex->RunIC(fgic); //loop JSBSim once
copy_from_JSBsim(); //update the bus
@ -447,8 +447,8 @@ void FGJSBsim::set_Altitude(double alt) {
snap_shot();
sgGeodToGeoc( get_Latitude(), alt , &sea_level_radius_meters, &lat_geoc);
_set_Sea_level_radius( sea_level_radius_meters * METER_TO_FEET );
fgic->SetSeaLevelRadiusFtIC( sea_level_radius_meters * METER_TO_FEET );
_set_Sea_level_radius( sea_level_radius_meters * SG_METER_TO_FEET );
fgic->SetSeaLevelRadiusFtIC( sea_level_radius_meters * SG_METER_TO_FEET );
fgic->SetLatitudeRadIC( lat_geoc );
fgic->SetAltitudeFtIC(alt);
fdmex->RunIC(fgic); //loop JSBSim once

View file

@ -197,7 +197,7 @@ bool FGLaRCsim::update( int multiloop ) {
// Inform LaRCsim of the local terrain altitude
// Runway_altitude = get_Runway_altitude();
Runway_altitude = scenery.cur_elev * METER_TO_FEET;
Runway_altitude = scenery.cur_elev * SG_METER_TO_FEET;
// Weather
/* V_north_airmass = get_V_north_airmass();

View file

@ -56,7 +56,7 @@ bool FGMagicCarpet::update( int multiloop ) {
// speed and distance traveled
double speed = controls.get_throttle( 0 ) * 2000; // meters/sec
double dist = speed * time_step;
double kts = speed * METER_TO_NM * 3600.0;
double kts = speed * SG_METER_TO_NM * 3600.0;
_set_V_equiv_kts( kts );
_set_V_calibrated_kts( kts );
_set_V_ground_speed( kts );
@ -99,7 +99,7 @@ bool FGMagicCarpet::update( int multiloop ) {
sl_radius + get_Altitude() + climb );
// cout << "sea level radius (ft) = " << sl_radius << endl;
// cout << "(setto) sea level radius (ft) = " << get_Sea_level_radius() << endl;
_set_Sea_level_radius( sl_radius * METER_TO_FEET);
_set_Sea_level_radius( sl_radius * SG_METER_TO_FEET);
_set_Altitude( get_Altitude() + climb );
return true;

View file

@ -272,25 +272,25 @@ bool FGInterface::update( int multi_loop ) {
void FGInterface::_updatePosition( double lat_geoc, double lon, double alt ) {
double lat_geod, tmp_alt, sl_radius1, sl_radius2, tmp_lat_geoc;
sgGeocToGeod( lat_geoc, ( get_Sea_level_radius() + alt ) * FEET_TO_METER,
sgGeocToGeod( lat_geoc, ( get_Sea_level_radius() + alt ) * SG_FEET_TO_METER,
&lat_geod, &tmp_alt, &sl_radius1 );
sgGeodToGeoc( lat_geod, alt * FEET_TO_METER, &sl_radius2, &tmp_lat_geoc );
sgGeodToGeoc( lat_geod, alt * SG_FEET_TO_METER, &sl_radius2, &tmp_lat_geoc );
FG_LOG( FG_FLIGHT, FG_DEBUG, "lon = " << lon
<< " lat_geod = " << lat_geod
<< " lat_geoc = " << lat_geoc
<< " alt = " << alt
<< " tmp_alt = " << tmp_alt * METER_TO_FEET
<< " sl_radius1 = " << sl_radius1 * METER_TO_FEET
<< " sl_radius2 = " << sl_radius2 * METER_TO_FEET
<< " tmp_alt = " << tmp_alt * SG_METER_TO_FEET
<< " sl_radius1 = " << sl_radius1 * SG_METER_TO_FEET
<< " sl_radius2 = " << sl_radius2 * SG_METER_TO_FEET
<< " Equator = " << SG_EQUATORIAL_RADIUS_FT );
_set_Geocentric_Position( lat_geoc, lon,
sl_radius2 * METER_TO_FEET + alt );
sl_radius2 * SG_METER_TO_FEET + alt );
_set_Geodetic_Position( lat_geod, lon, alt );
_set_Sea_level_radius( sl_radius2 * METER_TO_FEET );
_set_Sea_level_radius( sl_radius2 * SG_METER_TO_FEET );
_set_Runway_altitude( scenery.cur_elev*METERS_TO_FEET );
_set_sin_lat_geocentric( lat_geoc );
@ -360,9 +360,9 @@ void fgFDMForceAltitude(const string &model, double alt_meters) {
sgGeodToGeoc( base_fdm_state.get_Latitude(), alt_meters,
&sea_level_radius_meters, &lat_geoc);
base_fdm_state.set_Altitude( alt_meters * METER_TO_FEET );
base_fdm_state.set_Altitude( alt_meters * SG_METER_TO_FEET );
base_fdm_state.set_Sea_level_radius( sea_level_radius_meters *
METER_TO_FEET );
SG_METER_TO_FEET );
// additional work needed for some flight models
@ -375,9 +375,9 @@ void fgFDMForceAltitude(const string &model, double alt_meters) {
// Set the local ground elevation
void fgFDMSetGroundElevation(const string &model, double ground_meters) {
FG_LOG( FG_FLIGHT,FG_INFO, "fgFDMSetGroundElevation: "
<< ground_meters*METER_TO_FEET );
base_fdm_state.set_Runway_altitude( ground_meters * METER_TO_FEET );
cur_fdm_state->set_Runway_altitude( ground_meters * METER_TO_FEET );
<< ground_meters*SG_METER_TO_FEET );
base_fdm_state.set_Runway_altitude( ground_meters * SG_METER_TO_FEET );
cur_fdm_state->set_Runway_altitude( ground_meters * SG_METER_TO_FEET );
}

View file

@ -327,7 +327,7 @@ FGBFI::setDateString (string date_string)
mktime(&new_time) - mktime(current_time) + globals->get_warp();
double lon = current_aircraft.fdm_state->get_Longitude();
double lat = current_aircraft.fdm_state->get_Latitude();
// double alt = current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER;
// double alt = current_aircraft.fdm_state->get_Altitude() * SG_FEET_TO_METER;
globals->set_warp(warp);
st->update(lon, lat, warp);
fgUpdateSkyAndLightingParams();
@ -414,7 +414,7 @@ double
FGBFI::getAGL ()
{
return current_aircraft.fdm_state->get_Altitude()
- (scenery.cur_elev * METER_TO_FEET);
- (scenery.cur_elev * SG_METER_TO_FEET);
}
@ -1033,7 +1033,7 @@ FGBFI::setAPAltitudeLock (bool lock)
double
FGBFI::getAPAltitude ()
{
return current_autopilot->get_TargetAltitude() * METER_TO_FEET;
return current_autopilot->get_TargetAltitude() * SG_METER_TO_FEET;
}
@ -1043,7 +1043,7 @@ FGBFI::getAPAltitude ()
void
FGBFI::setAPAltitude (double altitude)
{
current_autopilot->set_TargetAltitude( altitude * FEET_TO_METER );
current_autopilot->set_TargetAltitude( altitude * SG_FEET_TO_METER );
}
@ -1053,7 +1053,7 @@ FGBFI::setAPAltitude (double altitude)
double
FGBFI::getAPClimb ()
{
return current_autopilot->get_TargetClimbRate() * METER_TO_FEET;
return current_autopilot->get_TargetClimbRate() * SG_METER_TO_FEET;
}
@ -1063,7 +1063,7 @@ FGBFI::getAPClimb ()
void
FGBFI::setAPClimb (double rate)
{
current_autopilot->set_TargetClimbRate( rate * FEET_TO_METER );
current_autopilot->set_TargetClimbRate( rate * SG_FEET_TO_METER );
}

View file

@ -370,17 +370,17 @@ bool fgSetPosFromAirportIDandHdg( const string& id, double tgt_hdg ) {
FG_LOG( FG_GENERAL, FG_INFO,
"runway = " << found_r.lon << ", " << found_r.lat
<< " length = " << found_r.length * FEET_TO_METER * 0.5
<< " length = " << found_r.length * SG_FEET_TO_METER * 0.5
<< " heading = " << azimuth );
geo_direct_wgs_84 ( 0, found_r.lat, found_r.lon,
azimuth, found_r.length * FEET_TO_METER * 0.5 - 5.0,
azimuth, found_r.length * SG_FEET_TO_METER * 0.5 - 5.0,
&lat2, &lon2, &az2 );
if ( fabs( fgGetDouble("/sim/startup/offset-distance") ) > SG_EPSILON ) {
double olat, olon;
double odist = fgGetDouble("/sim/startup/offset-distance");
odist *= NM_TO_METER;
odist *= SG_NM_TO_METER;
double oaz = azimuth;
if ( fabs(fgGetDouble("/sim/startup/offset-azimuth")) > SG_EPSILON ) {
oaz = fgGetDouble("/sim/startup/offset-azimuth") + 180;
@ -440,7 +440,7 @@ bool fgInitPosition( void ) {
"Initial position is: ("
<< (f->get_Longitude() * SGD_RADIANS_TO_DEGREES) << ", "
<< (f->get_Latitude() * SGD_RADIANS_TO_DEGREES) << ", "
<< (f->get_Altitude() * FEET_TO_METER) << ")" );
<< (f->get_Altitude() * SG_FEET_TO_METER) << ")" );
return true;
}
@ -622,7 +622,7 @@ bool fgInitSubsystems( void ) {
"Updated position (after elevation adj): ("
<< (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) << ")" );
<< (cur_fdm_state->get_Altitude() * SG_FEET_TO_METER) << ")" );
// We need to calculate a few sea_level_radius here so we can pass
// the correct value to the view class
@ -632,7 +632,7 @@ bool fgInitSubsystems( void ) {
cur_fdm_state->get_Altitude(),
&sea_level_radius_meters, &lat_geoc);
cur_fdm_state->set_Sea_level_radius( sea_level_radius_meters *
METER_TO_FEET );
SG_METER_TO_FEET );
// The following section sets up the flight model EOM parameters
// and should really be read in from one or more files.
@ -669,9 +669,9 @@ bool fgInitSubsystems( void ) {
pilot_view->set_geod_view_pos( cur_fdm_state->get_Longitude(),
cur_fdm_state->get_Lat_geocentric(),
cur_fdm_state->get_Altitude() *
FEET_TO_METER );
SG_FEET_TO_METER );
pilot_view->set_sea_level_radius( cur_fdm_state->get_Sea_level_radius() *
FEET_TO_METER );
SG_FEET_TO_METER );
pilot_view->set_rph( cur_fdm_state->get_Phi(),
cur_fdm_state->get_Theta(),
cur_fdm_state->get_Psi() );
@ -711,7 +711,7 @@ bool fgInitSubsystems( void ) {
sgVec3 position;
sgSetVec3( position, current_aircraft.fdm_state->get_Latitude(),
current_aircraft.fdm_state->get_Longitude(),
current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER );
current_aircraft.fdm_state->get_Altitude() * SG_FEET_TO_METER );
FGLocalWeatherDatabase::theFGLocalWeatherDatabase =
new FGLocalWeatherDatabase( position,
globals->get_fg_root() );
@ -783,7 +783,7 @@ bool fgInitSubsystems( void ) {
// *ABCD* I'm just sticking this here for now, it should probably
// move eventually
scenery.cur_elev = cur_fdm_state->get_Runway_altitude() * FEET_TO_METER;
scenery.cur_elev = cur_fdm_state->get_Runway_altitude() * SG_FEET_TO_METER;
if ( cur_fdm_state->get_Altitude() <
cur_fdm_state->get_Runway_altitude() + 3.758099)
@ -796,7 +796,7 @@ bool fgInitSubsystems( void ) {
"Updated position (after elevation adj): ("
<< (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) << ")" );
<< (cur_fdm_state->get_Altitude() * SG_FEET_TO_METER) << ")" );
// *ABCD* end of thing that I just stuck in that I should probably
// move
@ -896,7 +896,7 @@ void fgReInitSubsystems( void )
sgGeodToGeoc( cur_fdm_state->get_Latitude(), cur_fdm_state->get_Altitude(),
&sea_level_radius_meters, &lat_geoc);
cur_fdm_state->set_Sea_level_radius( sea_level_radius_meters *
METER_TO_FEET );
SG_METER_TO_FEET );
// The following section sets up the flight model EOM parameters
// and should really be read in from one or more files.
@ -920,9 +920,9 @@ void fgReInitSubsystems( void )
pilot_view->set_geod_view_pos( cur_fdm_state->get_Longitude(),
cur_fdm_state->get_Lat_geocentric(),
cur_fdm_state->get_Altitude() *
FEET_TO_METER );
SG_FEET_TO_METER );
pilot_view->set_sea_level_radius( cur_fdm_state->get_Sea_level_radius() *
FEET_TO_METER );
SG_FEET_TO_METER );
pilot_view->set_rph( cur_fdm_state->get_Phi(),
cur_fdm_state->get_Theta(),
cur_fdm_state->get_Psi() );
@ -937,7 +937,7 @@ void fgReInitSubsystems( void )
// cur_fdm_state->bind();
// cur_fdm_state->init( 1.0 / fgGetInt("/sim/model-hz") );
scenery.cur_elev = cur_fdm_state->get_Runway_altitude() * FEET_TO_METER;
scenery.cur_elev = cur_fdm_state->get_Runway_altitude() * SG_FEET_TO_METER;
if ( cur_fdm_state->get_Altitude() <
cur_fdm_state->get_Runway_altitude() + 3.758099)

View file

@ -148,7 +148,7 @@ void GLUTkey(unsigned char k, int x, int y) {
{
double alt = cur_fdm_state->get_Altitude() + 1000;
fgFDMForceAltitude( fgGetString("/sim/flight-model"),
alt * FEET_TO_METER );
alt * SG_FEET_TO_METER );
}
return;
case 49: // numeric keypad 1
@ -359,7 +359,7 @@ void GLUTkey(unsigned char k, int x, int y) {
FG_LOG( FG_INPUT, FG_INFO,
"Lon = " << f->get_Longitude() * SGD_RADIANS_TO_DEGREES
<< " Lat = " << f->get_Latitude() * SGD_RADIANS_TO_DEGREES
<< " Altitude = " << f->get_Altitude() * FEET_TO_METER
<< " Altitude = " << f->get_Altitude() * SG_FEET_TO_METER
);
FG_LOG( FG_INPUT, FG_INFO,
"Heading = " << f->get_Psi() * SGD_RADIANS_TO_DEGREES

View file

@ -335,7 +335,7 @@ void fgRenderFrame( void ) {
// now work without seg faulting the system.
// printf("Ground = %.2f Altitude = %.2f\n", scenery.cur_elev,
// FG_Altitude * FEET_TO_METER);
// FG_Altitude * SG_FEET_TO_METER);
// this is just a temporary hack, to make me understand Pui
// timerText -> setLabel (ctime (&t->cur_time));
@ -352,10 +352,10 @@ void fgRenderFrame( void ) {
pilot_view->set_geod_view_pos( cur_fdm_state->get_Longitude(),
cur_fdm_state->get_Lat_geocentric(),
cur_fdm_state->get_Altitude() *
FEET_TO_METER );
SG_FEET_TO_METER );
pilot_view->set_sea_level_radius( cur_fdm_state->
get_Sea_level_radius() *
FEET_TO_METER );
SG_FEET_TO_METER );
pilot_view->set_rph( cur_fdm_state->get_Phi(),
cur_fdm_state->get_Theta(),
cur_fdm_state->get_Psi() );
@ -380,10 +380,10 @@ void fgRenderFrame( void ) {
chase_view->set_geod_view_pos( cur_fdm_state->get_Longitude(),
cur_fdm_state->get_Lat_geocentric(),
cur_fdm_state->get_Altitude() *
FEET_TO_METER );
SG_FEET_TO_METER );
chase_view->set_sea_level_radius( cur_fdm_state->
get_Sea_level_radius() *
FEET_TO_METER );
SG_FEET_TO_METER );
chase_view->set_pilot_offset( npo[0], npo[1], npo[2] );
chase_view->set_view_forward( pilot_view->get_view_pos() );
chase_view->set_view_up( wup );
@ -476,7 +476,7 @@ void fgRenderFrame( void ) {
thesky->set_visibility( current_weather.get_visibility() );
#endif
thesky->modify_vis( cur_fdm_state->get_Altitude() * FEET_TO_METER,
thesky->modify_vis( cur_fdm_state->get_Altitude() * SG_FEET_TO_METER,
( global_multi_loop *
fgGetInt("/sim/speed-up") ) /
(double)fgGetInt("/sim/model-hz") );
@ -543,7 +543,7 @@ void fgRenderFrame( void ) {
globals->get_current_view()->get_world_up(),
cur_fdm_state->get_Longitude(),
cur_fdm_state->get_Latitude(),
cur_fdm_state->get_Altitude() * FEET_TO_METER,
cur_fdm_state->get_Altitude() * SG_FEET_TO_METER,
cur_light_params.sun_rotation,
globals->get_time_params()->getGst(),
globals->get_ephem()->getSunRightAscension(),
@ -587,7 +587,7 @@ void fgRenderFrame( void ) {
float fov = globals->get_current_view()->get_fov();
ssgSetFOV(fov, fov * globals->get_current_view()->get_win_ratio());
double agl = current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER
double agl = current_aircraft.fdm_state->get_Altitude() * SG_FEET_TO_METER
- scenery.cur_elev;
// FG_LOG( FG_ALL, FG_INFO, "visibility is "
@ -697,7 +697,7 @@ void fgRenderFrame( void ) {
if ( fgGetBool("/sim/rendering/skyblend") ) {
// draw the sky cloud layers
thesky->postDraw( cur_fdm_state->get_Altitude() * FEET_TO_METER );
thesky->postDraw( cur_fdm_state->get_Altitude() * SG_FEET_TO_METER );
}
// display HUD && Panel
@ -857,7 +857,7 @@ void fgInitTimeDepCalcs( void ) {
static const double alt_adjust_ft = 3.758099;
static const double alt_adjust_m = alt_adjust_ft * FEET_TO_METER;
static const double alt_adjust_m = alt_adjust_ft * SG_FEET_TO_METER;
// What should we do when we have nothing else to do? Let's get ready
@ -909,15 +909,15 @@ static void fgMainLoop( void ) {
/* printf("Before - ground = %.2f runway = %.2f alt = %.2f\n",
scenery.cur_elev,
cur_fdm_state->get_Runway_altitude() * FEET_TO_METER,
cur_fdm_state->get_Altitude() * FEET_TO_METER); */
cur_fdm_state->get_Runway_altitude() * SG_FEET_TO_METER,
cur_fdm_state->get_Altitude() * SG_FEET_TO_METER); */
if ( scenery.cur_elev > -9990 ) {
if ( cur_fdm_state->get_Altitude() * FEET_TO_METER <
if ( cur_fdm_state->get_Altitude() * SG_FEET_TO_METER <
(scenery.cur_elev + alt_adjust_m - 3.0) ) {
// now set aircraft altitude above ground
printf("(*) Current Altitude = %.2f < %.2f forcing to %.2f\n",
cur_fdm_state->get_Altitude() * FEET_TO_METER,
cur_fdm_state->get_Altitude() * SG_FEET_TO_METER,
scenery.cur_elev + alt_adjust_m - 3.0,
scenery.cur_elev + alt_adjust_m );
fgFDMForceAltitude( fgGetString("/sim/flight-model"),
@ -925,15 +925,15 @@ static void fgMainLoop( void ) {
FG_LOG( FG_ALL, FG_DEBUG,
"<*> resetting altitude to "
<< cur_fdm_state->get_Altitude() * FEET_TO_METER
<< cur_fdm_state->get_Altitude() * SG_FEET_TO_METER
<< " meters" );
}
}
/* printf("Adjustment - ground = %.2f runway = %.2f alt = %.2f\n",
scenery.cur_elev,
cur_fdm_state->get_Runway_altitude() * FEET_TO_METER,
cur_fdm_state->get_Altitude() * FEET_TO_METER); */
cur_fdm_state->get_Runway_altitude() * SG_FEET_TO_METER,
cur_fdm_state->get_Altitude() * SG_FEET_TO_METER); */
// update "time"
if ( globals->get_warp_delta() != 0 ) {
@ -951,7 +951,7 @@ static void fgMainLoop( void ) {
// update magvar model
globals->get_mag()->update( cur_fdm_state->get_Longitude(),
cur_fdm_state->get_Latitude(),
cur_fdm_state->get_Altitude()* FEET_TO_METER,
cur_fdm_state->get_Altitude()* SG_FEET_TO_METER,
globals->get_time_params()->getJD() );
// Get elapsed time (in usec) for this past frame

View file

@ -470,7 +470,7 @@ parse_wp( const string& arg ) {
// cout << "id str = " << id << " alt str = " << alt_str << endl;
alt = atof( alt_str.c_str() );
if ( fgGetString("/sim/startup/units") == "feet" ) {
alt *= FEET_TO_METER;
alt *= SG_FEET_TO_METER;
}
} else {
id = arg;
@ -586,49 +586,49 @@ parse_option (const string& arg)
fgSetDouble("/position/altitude", atof(arg.substr(11)));
else
fgSetDouble("/position/altitude",
atof(arg.substr(11)) * METER_TO_FEET);
atof(arg.substr(11)) * SG_METER_TO_FEET);
} else if ( arg.find( "--uBody=" ) == 0 ) {
fgSetString("/sim/startup/speed-set", "UVW");
if ( fgGetString("/sim/startup/units") == "feet" )
fgSetDouble("/velocities/uBody", atof(arg.substr(8)));
else
fgSetDouble("/velocities/uBody",
atof(arg.substr(8)) * METER_TO_FEET);
atof(arg.substr(8)) * SG_METER_TO_FEET);
} else if ( arg.find( "--vBody=" ) == 0 ) {
fgSetString("/sim/startup/speed-set", "UVW");
if ( fgGetString("/sim/startup/units") == "feet" )
fgSetDouble("/velocities/vBody", atof(arg.substr(8)));
else
fgSetDouble("/velocities/vBody",
atof(arg.substr(8)) * METER_TO_FEET);
atof(arg.substr(8)) * SG_METER_TO_FEET);
} else if ( arg.find( "--wBody=" ) == 0 ) {
fgSetString("/sim/startup/speed-set", "UVW");
if ( fgGetString("/sim/startup/units") == "feet" )
fgSetDouble("/velocities/wBody", atof(arg.substr(8)));
else
fgSetDouble("/velocities/wBody",
atof(arg.substr(8)) * METER_TO_FEET);
atof(arg.substr(8)) * SG_METER_TO_FEET);
} else if ( arg.find( "--vNorth=" ) == 0 ) {
fgSetString("/sim/startup/speed-set", "NED");
if ( fgGetString("/sim/startup/units") == "feet" )
fgSetDouble("/velocities/speed-north", atof(arg.substr(9)));
else
fgSetDouble("/velocities/speed-north",
atof(arg.substr(9)) * METER_TO_FEET);
atof(arg.substr(9)) * SG_METER_TO_FEET);
} else if ( arg.find( "--vEast=" ) == 0 ) {
fgSetString("/sim/startup/speed-set", "NED");
if ( fgGetString("/sim/startup/units") == "feet" )
fgSetDouble("/velocities/speed-east", atof(arg.substr(8)));
else
fgSetDouble("/velocities/speed-east",
atof(arg.substr(8)) * METER_TO_FEET);
atof(arg.substr(8)) * SG_METER_TO_FEET);
} else if ( arg.find( "--vDown=" ) == 0 ) {
fgSetString("/sim/startup/speed-set", "NED");
if ( fgGetString("/sim/startup/units") == "feet" )
fgSetDouble("/velocities/speed-down", atof(arg.substr(8)));
else
fgSetDouble("/velocities/speed-down",
atof(arg.substr(8)) * METER_TO_FEET);
atof(arg.substr(8)) * SG_METER_TO_FEET);
} else if ( arg.find( "--vc=" ) == 0) {
fgSetString("/sim/startup/speed-set", "knots");
fgSetDouble("/velocities/airspeed", atof(arg.substr(5)));
@ -677,7 +677,7 @@ parse_option (const string& arg)
// FIXME: check units
if ( fgGetString("/sim/startup/units") == "feet" )
fgSetDouble("/environment/clouds/altitude",
atof(arg.substr(13)) * FEET_TO_METER);
atof(arg.substr(13)) * SG_FEET_TO_METER);
else
fgSetDouble("/environment/clouds/altitude",
atof(arg.substr(13)));
@ -837,7 +837,7 @@ parse_option (const string& arg)
} else if ( arg.find( "--visibility=" ) == 0 ) {
fgSetDouble("/environment/visibility", atof(arg.substr(13)));
} else if ( arg.find( "--visibility-miles=" ) == 0 ) {
double visibility = atof(arg.substr(19)) * 5280.0 * FEET_TO_METER;
double visibility = atof(arg.substr(19)) * 5280.0 * SG_FEET_TO_METER;
fgSetDouble("/environment/visibility", visibility);
} else if ( arg.find( "--wind=" ) == 0 ) {
string val = arg.substr(7);
@ -851,7 +851,7 @@ parse_option (const string& arg)
FG_LOG(FG_GENERAL, FG_INFO, "WIND: " << dir << '@' <<
speed << " knots" << endl);
// convert to fps
speed *= NM_TO_METER * METER_TO_FEET * (1.0/3600);
speed *= SG_NM_TO_METER * SG_METER_TO_FEET * (1.0/3600);
dir += 180;
if (dir >= 360)
dir -= 360;

View file

@ -116,10 +116,10 @@ void FGViewerLookAt::update() {
// calculate view position in current FG view coordinate system
// p.lon & p.lat are already defined earlier, p.radius was set to
// the sea level radius, so now we add in our altitude.
if ( geod_view_pos[2] > (scenery.cur_elev + 0.5 * METER_TO_FEET) ) {
if ( geod_view_pos[2] > (scenery.cur_elev + 0.5 * SG_METER_TO_FEET) ) {
p.setz( p.radius() + geod_view_pos[2] );
} else {
p.setz( p.radius() + scenery.cur_elev + 0.5 * METER_TO_FEET );
p.setz( p.radius() + scenery.cur_elev + 0.5 * SG_METER_TO_FEET );
}
tmp = sgPolarToCart3d(p);

View file

@ -168,10 +168,10 @@ void FGViewerRPH::update() {
// calculate view position in current FG view coordinate system
// p.lon & p.lat are already defined earlier, p.radius was set to
// the sea level radius, so now we add in our altitude.
if ( geod_view_pos[2] > (scenery.cur_elev + 0.5 * METER_TO_FEET) ) {
if ( geod_view_pos[2] > (scenery.cur_elev + 0.5 * SG_METER_TO_FEET) ) {
p.setz( p.radius() + geod_view_pos[2] );
} else {
p.setz( p.radius() + scenery.cur_elev + 0.5 * METER_TO_FEET );
p.setz( p.radius() + scenery.cur_elev + 0.5 * SG_METER_TO_FEET );
}
tmp = sgPolarToCart3d(p);

View file

@ -148,16 +148,16 @@ bool FGILSList::query( double lon, double lat, double elev, double freq,
d = aircraft.distance3Dsquared( station );
// cout << " distance = " << d << " ("
// << FG_ILS_DEFAULT_RANGE * NM_TO_METER
// * FG_ILS_DEFAULT_RANGE * NM_TO_METER
// << FG_ILS_DEFAULT_RANGE * SG_NM_TO_METER
// * FG_ILS_DEFAULT_RANGE * SG_NM_TO_METER
// << ")" << endl;
// cout << " dist = " << s << endl;
// match up to twice the published range so we can model
// reduced signal strength
if ( d < (2* FG_ILS_DEFAULT_RANGE * NM_TO_METER
* 2 * FG_ILS_DEFAULT_RANGE * NM_TO_METER) ) {
if ( d < (2* FG_ILS_DEFAULT_RANGE * SG_NM_TO_METER
* 2 * FG_ILS_DEFAULT_RANGE * SG_NM_TO_METER) ) {
*ils = *current;
return true;
}

View file

@ -174,8 +174,8 @@ FGBeacon::fgMkrBeacType FGMarkerBeacons::query( double lon, double lat,
double d = aircraft.distance3Dsquared( station ); // meters^2
// cout << " distance = " << d << " ("
// << FG_ILS_DEFAULT_RANGE * NM_TO_METER
// * FG_ILS_DEFAULT_RANGE * NM_TO_METER
// << FG_ILS_DEFAULT_RANGE * SG_NM_TO_METER
// * FG_ILS_DEFAULT_RANGE * SG_NM_TO_METER
// << ")" << endl;
// cout << " range = " << sqrt(d) << endl;
@ -184,9 +184,9 @@ FGBeacon::fgMkrBeacType FGMarkerBeacons::query( double lon, double lat,
min_dist = d;
}
// cout << "elev = " << elev * METER_TO_FEET
// cout << "elev = " << elev * SG_METER_TO_FEET
// << " current->get_elev() = " << current->get_elev() << endl;
double delev = elev * METER_TO_FEET - current->get_elev();
double delev = elev * SG_METER_TO_FEET - current->get_elev();
// max range is the area under r = 2.4 * alt or r^2 = 4000^2 - alt^2
// whichever is smaller. The intersection point is 1538 ...
@ -198,7 +198,7 @@ FGBeacon::fgMkrBeacType FGMarkerBeacons::query( double lon, double lat,
} else {
maxrange2 = 0.0;
}
maxrange2 *= FEET_TO_METER * FEET_TO_METER; // convert to meter^2
maxrange2 *= SG_FEET_TO_METER * SG_FEET_TO_METER; // convert to meter^2
// cout << "delev = " << delev << " maxrange = " << maxrange << endl;
// match up to twice the published range so we can model

View file

@ -130,7 +130,7 @@ operator >> ( istream& in, FGNav& n )
// << n.elev << " JD = "
// << julian_date << endl;
n.magvar = sgGetMagVar(n.lon * SGD_DEGREES_TO_RADIANS, n.lat * SGD_DEGREES_TO_RADIANS,
n.elev * FEET_TO_METER,
n.elev * SG_FEET_TO_METER,
julian_date) * SGD_RADIANS_TO_DEGREES;
// cout << "Default variation at " << n.lon << ',' << n.lat
// << " is " << var << endl;

View file

@ -129,12 +129,12 @@ bool FGNavList::query( double lon, double lat, double elev, double freq,
d = aircraft.distance3Dsquared( station );
// cout << " dist = " << sqrt(d)
// << " range = " << current->get_range() * NM_TO_METER << endl;
// << " range = " << current->get_range() * SG_NM_TO_METER << endl;
// match up to twice the published range so we can model
// reduced signal strength
if ( d < (2 * current->get_range() * NM_TO_METER
* 2 * current->get_range() * NM_TO_METER ) ) {
if ( d < (2 * current->get_range() * SG_NM_TO_METER
* 2 * current->get_range() * SG_NM_TO_METER ) ) {
// cout << "matched = " << current->get_ident() << endl;
*n = *current;
return true;

View file

@ -107,7 +107,7 @@ bool FGAtlas::gen_message() {
char altitude_m[10];
sprintf( altitude_m, "%02d",
(int)(cur_fdm_state->get_Altitude() * FEET_TO_METER) );
(int)(cur_fdm_state->get_Altitude() * SG_FEET_TO_METER) );
char altitude_ft[10];
sprintf( altitude_ft, "%02d", (int)cur_fdm_state->get_Altitude() );
@ -444,7 +444,7 @@ bool FGAtlas::parse_message() {
begin = end + 1;
if ( alt_units != "F" ) {
altitude *= METER_TO_FEET;
altitude *= SG_METER_TO_FEET;
}
cur_fdm_state->set_Altitude( altitude );

View file

@ -105,7 +105,7 @@ bool FGGarmin::gen_message() {
char altitude_m[10];
sprintf( altitude_m, "%02d",
(int)(cur_fdm_state->get_Altitude() * FEET_TO_METER) );
(int)(cur_fdm_state->get_Altitude() * SG_FEET_TO_METER) );
char altitude_ft[10];
sprintf( altitude_ft, "%02d", (int)cur_fdm_state->get_Altitude() );
@ -325,7 +325,7 @@ bool FGGarmin::parse_message() {
begin = end + 1;
if ( alt_units != "F" && alt_units != "f" ) {
altitude *= METER_TO_FEET;
altitude *= SG_METER_TO_FEET;
}
cur_fdm_state->set_Altitude( altitude );

View file

@ -106,7 +106,7 @@ bool FGNMEA::gen_message() {
char altitude_m[10];
sprintf( altitude_m, "%02d",
(int)(cur_fdm_state->get_Altitude() * FEET_TO_METER) );
(int)(cur_fdm_state->get_Altitude() * SG_FEET_TO_METER) );
char altitude_ft[10];
sprintf( altitude_ft, "%02d", (int)cur_fdm_state->get_Altitude() );
@ -428,7 +428,7 @@ bool FGNMEA::parse_message() {
begin = end + 1;
if ( alt_units != "F" ) {
altitude *= METER_TO_FEET;
altitude *= SG_METER_TO_FEET;
}
cur_fdm_state->set_Altitude( altitude );

View file

@ -195,7 +195,7 @@ void FGTileEntry::prep_ssg_node( const Point3D& p, float vis) {
double agl;
if ( current_aircraft.fdm_state ) {
agl = current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER
agl = current_aircraft.fdm_state->get_Altitude() * SG_FEET_TO_METER
- scenery.cur_elev;
} else {
agl = 0.0;

View file

@ -259,7 +259,7 @@ void fgUpdateWeatherDatabase(void)
sgSetVec3(position,
current_aircraft.fdm_state->get_Latitude(),
current_aircraft.fdm_state->get_Longitude(),
current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER);
current_aircraft.fdm_state->get_Altitude() * SG_FEET_TO_METER);
WeatherDatabase->update( position );