]> git.mxchange.org Git - flightgear.git/commitdiff
No need to do he calculations twice. FGAIBAse::update() handles them already.
authorehofman <ehofman>
Sat, 12 Jun 2004 11:34:05 +0000 (11:34 +0000)
committerehofman <ehofman>
Sat, 12 Jun 2004 11:34:05 +0000 (11:34 +0000)
src/AIModel/AIBallistic.cxx
src/AIModel/AIShip.cxx
src/AIModel/AIThermal.cxx

index fe53bb4d87c237f253bca16eee37d903eca3fc37..63fceb8653d163473914eff3349e41c7b3ae0a61 100644 (file)
@@ -81,12 +81,6 @@ void FGAIBallistic::Run(double dt) {
 
    double speed_north_deg_sec;
    double speed_east_deg_sec;
-   double ft_per_deg_lon;
-   double ft_per_deg_lat;
-
-   // get size of a degree at this latitude
-   ft_per_deg_lat = 366468.96 - 3717.12 * cos(pos.lat()/SG_RADIANS_TO_DEGREES);
-   ft_per_deg_lon = 365228.16 * cos(pos.lat() / SG_RADIANS_TO_DEGREES);
 
    // the two drag calculations below assume sea-level density, 
    // mass of 0.03 slugs,  drag coeff of 0.295, frontal area of 0.007 ft2 
index c1c11d6cc46eec679bd0b344e2d0f77057aa5edb..32950ba65eb1445be5f6cc28035785aa044bd9fd 100644 (file)
@@ -72,15 +72,9 @@ void FGAIShip::Run(double dt) {
    double turn_circum_ft;
    double speed_north_deg_sec;
    double speed_east_deg_sec;
-   double ft_per_deg_lon;
-   double ft_per_deg_lat;
    double dist_covered_ft;
    double alpha;
 
-   // get size of a degree at this latitude
-   ft_per_deg_lat = 366468.96 - 3717.12 * cos(pos.lat()/SG_RADIANS_TO_DEGREES);
-   ft_per_deg_lon = 365228.16 * cos(pos.lat() / SG_RADIANS_TO_DEGREES);
-
    // adjust speed
    double speed_diff = tgt_speed - speed;
    if (fabs(speed_diff) > 0.1) {
index d6bc36a1afc1f891dbf5c5b642a5b35038a43796..823781b8a67ba0ef3fa036ff558b760a79a3a83f 100644 (file)
@@ -73,15 +73,6 @@ void FGAIThermal::Run(double dt) {
 
    FGAIThermal::dt = dt;
        
-   double ft_per_deg_lon;
-   double ft_per_deg_lat;
-
-   // get size of a degree at this latitude
-   ft_per_deg_lat = 366468.96 - 3717.12 * cos(pos.lat()/SG_RADIANS_TO_DEGREES);
-   ft_per_deg_lon = 365228.16 * cos(pos.lat() / SG_RADIANS_TO_DEGREES);
-
-   // double altitude_ft = altitude * SG_METER_TO_FEET;
-
    //###########################//
    // do calculations for range //
    //###########################//
@@ -94,7 +85,7 @@ void FGAIThermal::Run(double dt) {
    // calculate range to target in feet and nautical miles
    double lat_range = fabs(pos.lat() - user_latitude) * ft_per_deg_lat;
    double lon_range = fabs(pos.lon() - user_longitude) * ft_per_deg_lon;
-   double range_ft = sqrt( lat_range*lat_range + lon_range*lon_range );
+   double range_ft = lat_range*lat_range + lon_range*lon_range;
    range = range_ft / 6076.11549;
 
    // Calculate speed of rising air if within range.