X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FAIModel%2FAIThermal.cxx;h=172d1e68aff1d55f23e334f60035ac52b8ba41bf;hb=bb2d1f55e9912d3b9b81b6d5e12900f77eef4365;hp=da9987fb8b65524929e9897b9775cba1cb66de5f;hpb=7e3531ef5cae0c0e9ac325de8712f3b67a3e5e5f;p=flightgear.git diff --git a/src/AIModel/AIThermal.cxx b/src/AIModel/AIThermal.cxx index da9987fb8..172d1e68a 100644 --- a/src/AIModel/AIThermal.cxx +++ b/src/AIModel/AIThermal.cxx @@ -1,6 +1,6 @@ // FGAIThermal - FGAIBase-derived class creates an AI thermal // -// Original by Written by David Culp +// Copyright (C) 2004  David P. Culp - davidculp2@comcast.net // // An attempt to refine the thermal shape and behaviour by WooT 2009 // @@ -120,27 +120,23 @@ void FGAIThermal::update(double dt) { double FGAIThermal::get_strength_fac(double alt_frac) { double PI = 4.0 * atan(1.0); -double fac; +double fac = 0.0; if ( alt_frac <=0.0 ) { // do submarines get thermals ? fac = 0.0; - return fac; } else if ( ( alt_frac>0.0 ) && (alt_frac<=0.1) ) { // ground layer fac = ( 0.1*( pow( (10.0*alt_frac),10.0) ) ); - return fac; } else if ( ( alt_frac>0.1 ) && (alt_frac<=1.0) ) { // main body of the thermal fac = 0.4175 - 0.5825* ( cos ( PI* (1.0-sqrt(alt_frac) ) +PI) ) ; - return fac; } else if ( ( alt_frac >1.0 ) && (alt_frac < 1.1 ) ) { //above the ceiling, but not above the cloud fac = (0.5 * ( 1.0 + cos ( PI*( (-2.0*alt_frac)*5.0 ) ) ) ); - return fac; } else if ( alt_frac >= 1.1 ) { //above the cloud fac = 0.0; - return fac; } +return fac; } @@ -233,7 +229,7 @@ double user_altitude = manager->get_user_altitude(); // MSL dt_count += dt; if (dt_count >= 10.0 ) { //double alt; - if (globals->get_scenery()->get_elevation_m(SGGeod::fromGeodM(pos, 20000), alt, 0)){ + if (getGroundElevationM(SGGeod::fromGeodM(pos, 20000), alt, 0)) { ground_elev_ft = alt * SG_METER_TO_FEET; do_agl_calc = 0; altitude_agl_ft = height - ground_elev_ft ; @@ -255,12 +251,7 @@ double Vup; // environment variables // ********************* -// the windspeed at the user alt in KT -double windspeed; - // the wind heading at the user alt -double wind_heading; -double wind_heading_deg; double wind_heading_rad; // the "ambient" sink outside thermals