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 -
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;
// 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 :-)
// constructor
FGAutopilot::FGAutopilot():
-TargetClimbRate(1000 * FEET_TO_METER)
+TargetClimbRate(1000 * SG_FEET_TO_METER)
{
}
// 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;
}
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) ) {
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
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) ) {
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
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) ) {
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 );
}
}
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
// 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; }
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;
// 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;
} 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
}
// 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;
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;
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: ( "
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 );
}
}
}
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 ) {
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 );
// 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 ) {
// 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 );
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;
}
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 );
// 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;
}
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;
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);
}
// 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
// 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 ) {
// 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 ) {
{
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;
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;
}
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;
}
// << " 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;
}
{
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;
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 {
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 {
{
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 {
sgSetVec3( temp,
get_Latitude(),
get_Longitude(),
- get_Altitude() * FEET_TO_METER);
+ get_Altitude() * SG_FEET_TO_METER);
current_balloon.setPosition( temp );
//set Euler angles (?)
//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
//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] );
// 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(): "
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);
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());
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
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
// 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();
// 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 );
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;
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 );
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
// 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 );
}
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();
FGBFI::getAGL ()
{
return current_aircraft.fdm_state->get_Altitude()
- - (scenery.cur_elev * METER_TO_FEET);
+ - (scenery.cur_elev * SG_METER_TO_FEET);
}
double
FGBFI::getAPAltitude ()
{
- return current_autopilot->get_TargetAltitude() * METER_TO_FEET;
+ return current_autopilot->get_TargetAltitude() * SG_METER_TO_FEET;
}
void
FGBFI::setAPAltitude (double altitude)
{
- current_autopilot->set_TargetAltitude( altitude * FEET_TO_METER );
+ current_autopilot->set_TargetAltitude( altitude * SG_FEET_TO_METER );
}
double
FGBFI::getAPClimb ()
{
- return current_autopilot->get_TargetClimbRate() * METER_TO_FEET;
+ return current_autopilot->get_TargetClimbRate() * SG_METER_TO_FEET;
}
void
FGBFI::setAPClimb (double rate)
{
- current_autopilot->set_TargetClimbRate( rate * FEET_TO_METER );
+ current_autopilot->set_TargetClimbRate( rate * SG_FEET_TO_METER );
}
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;
"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;
}
"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
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.
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() );
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() );
// *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)
"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
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.
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() );
// 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)
{
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
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
// 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));
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() );
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 );
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") );
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(),
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 "
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
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
/* 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"),
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 ) {
// 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
// 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;
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)));
// 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)));
} 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);
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;
// 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);
// 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);
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;
}
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;
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 ...
} 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
// << 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;
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;
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() );
begin = end + 1;
if ( alt_units != "F" ) {
- altitude *= METER_TO_FEET;
+ altitude *= SG_METER_TO_FEET;
}
cur_fdm_state->set_Altitude( altitude );
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() );
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 );
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() );
begin = end + 1;
if ( alt_units != "F" ) {
- altitude *= METER_TO_FEET;
+ altitude *= SG_METER_TO_FEET;
}
cur_fdm_state->set_Altitude( altitude );
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;
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 );