From c43e514e8776d9537317af6d64e17332bde9b0c3 Mon Sep 17 00:00:00 2001 From: ehofman Date: Sat, 12 Jun 2004 11:34:05 +0000 Subject: [PATCH] No need to do he calculations twice. FGAIBAse::update() handles them already. --- src/AIModel/AIBallistic.cxx | 6 ------ src/AIModel/AIShip.cxx | 6 ------ src/AIModel/AIThermal.cxx | 11 +---------- 3 files changed, 1 insertion(+), 22 deletions(-) diff --git a/src/AIModel/AIBallistic.cxx b/src/AIModel/AIBallistic.cxx index fe53bb4d8..63fceb865 100644 --- a/src/AIModel/AIBallistic.cxx +++ b/src/AIModel/AIBallistic.cxx @@ -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 diff --git a/src/AIModel/AIShip.cxx b/src/AIModel/AIShip.cxx index c1c11d6cc..32950ba65 100644 --- a/src/AIModel/AIShip.cxx +++ b/src/AIModel/AIShip.cxx @@ -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) { diff --git a/src/AIModel/AIThermal.cxx b/src/AIModel/AIThermal.cxx index d6bc36a1a..823781b8a 100644 --- a/src/AIModel/AIThermal.cxx +++ b/src/AIModel/AIThermal.cxx @@ -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.