#include <Scenery/scenery.hxx>
#include <string>
#include <math.h>
-
+#include <simgear/sg_inlines.h>
using std::string;
#include "ridge_lift.hxx"
-static string CreateIndexedPropertyName(string Property, int index)
-{
- std::stringstream str;
- str << index;
- string tmp;
- str >> tmp;
- return Property + "[" + tmp + "]";
-}
-
-static inline double sign(double x) {
- return x == 0 ? 0 : x > 0 ? 1.0 : -1.0;
-}
-
static const double BOUNDARY1_m = 40.0;
const double FGRidgeLift::dist_probe_m[] = { // in meters
slope[3] = (probe_elev_m[4] - probe_elev_m[0]) / -dist_probe_m[4];
for (unsigned i = 0; i < sizeof(slope)/sizeof(slope[0]); i++)
- adj_slope[i] = sin(atan(5.0 * pow ( (fabs(slope[i])),1.7) ) ) *sign(slope[i]);
+ adj_slope[i] = sin(atan(5.0 * pow ( (fabs(slope[i])),1.7) ) ) *SG_SIGN<double>(slope[i]);
//adjustment
adj_slope[0] *= 0.2;
//boundaries
double boundary2_m = 130.0; // in the lift
if (lift_factor < 0.0) { // in the sink
- double highest_probe_temp= max ( probe_elev_m[1], probe_elev_m[2] );
- double highest_probe_downwind_m= max ( highest_probe_temp, probe_elev_m[3] );
+ double highest_probe_temp= std::max ( probe_elev_m[1], probe_elev_m[2] );
+ double highest_probe_downwind_m= std::max ( highest_probe_temp, probe_elev_m[3] );
boundary2_m = highest_probe_downwind_m - probe_elev_m[0];
}
agl_factor = 1.0;
} else {
agl_factor = exp(-(2 + probe_elev_m[0] / 2000) *
- (user_altitude_agl_m - boundary2_m) / max(probe_elev_m[0],200.0));
+ (user_altitude_agl_m - boundary2_m) / std::max(probe_elev_m[0],200.0));
}
double ground_wind_speed_mps = _surface_wind_speed_node->getDoubleValue() * SG_NM_TO_METER / 3600;