From a0aee5d8666c654dbe9b9076c2b8ab39ac9ed8a6 Mon Sep 17 00:00:00 2001 From: curt Date: Tue, 12 Oct 1999 03:30:24 +0000 Subject: [PATCH] Updates by Christian Mayer. --- src/WeatherCM/FGLocalWeatherDatabase.cpp | 26 ++++++++++++++++++++++++ src/WeatherCM/FGLocalWeatherDatabase.h | 7 ++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/WeatherCM/FGLocalWeatherDatabase.cpp b/src/WeatherCM/FGLocalWeatherDatabase.cpp index aa2c02290..761c5e25c 100644 --- a/src/WeatherCM/FGLocalWeatherDatabase.cpp +++ b/src/WeatherCM/FGLocalWeatherDatabase.cpp @@ -201,6 +201,17 @@ FGPhysicalProperty FGLocalWeatherDatabase::get(const Point3D& p) const return global->get(p); } +FGPhysicalProperty FGLocalWeatherDatabase::get(const sgVec3& p) const +{ + Point3D temp(p[0], p[1], p[2]); + + unsigned int a = AreaWith(temp); + if (a != 0) + return WeatherAreas[a-1].get(temp.elev()); + else //point is outside => ask GlobalWeatherDatabase + return global->get(temp); +} + WeatherPrecition FGLocalWeatherDatabase::getAirDensity(const Point3D& p) const { FGPhysicalProperty dummy; @@ -215,6 +226,21 @@ WeatherPrecition FGLocalWeatherDatabase::getAirDensity(const Point3D& p) const (dummy.Temperature*FG_WEATHER_DEFAULT_AIRPRESSURE); } +WeatherPrecition FGLocalWeatherDatabase::getAirDensity(const sgVec3& p) const +{ + Point3D temp(p[0], p[1], p[2]); + + FGPhysicalProperty dummy; + unsigned int a = AreaWith(temp); + if (a != 0) + dummy = WeatherAreas[a-1].get(temp.elev()); + else //point is outside => ask GlobalWeatherDatabase + dummy = global->get(temp); + + return + (dummy.AirPressure*FG_WEATHER_DEFAULT_AIRDENSITY*FG_WEATHER_DEFAULT_TEMPERATURE) / + (dummy.Temperature*FG_WEATHER_DEFAULT_AIRPRESSURE); +} /****************************************************************************/ /* Add a weather feature at the point p and surrounding area */ diff --git a/src/WeatherCM/FGLocalWeatherDatabase.h b/src/WeatherCM/FGLocalWeatherDatabase.h index 38ffa6625..5be548257 100644 --- a/src/WeatherCM/FGLocalWeatherDatabase.h +++ b/src/WeatherCM/FGLocalWeatherDatabase.h @@ -53,12 +53,14 @@ HISTORY #include #include +#include +#include "sg.h" + #include "FGPhysicalProperties.h" #include "FGGlobalWeatherDatabase.h" #include "FGMicroWeather.h" #include "FGWeatherFeature.h" #include "FGWeatherDefs.h" -#include /****************************************************************************/ /* DEFINES */ @@ -138,7 +140,10 @@ public: /* Get the physical properties on the specified point p */ /************************************************************************/ FGPhysicalProperty get(const Point3D& p) const; + FGPhysicalProperty get(const sgVec3& p) const; + WeatherPrecition getAirDensity(const Point3D& p) const; + WeatherPrecition getAirDensity(const sgVec3& p) const; /************************************************************************/ /* Add a weather feature at the point p and surrounding area */ -- 2.39.5