]> git.mxchange.org Git - flightgear.git/commitdiff
Updates by Christian Mayer.
authorcurt <curt>
Tue, 12 Oct 1999 03:30:24 +0000 (03:30 +0000)
committercurt <curt>
Tue, 12 Oct 1999 03:30:24 +0000 (03:30 +0000)
src/WeatherCM/FGLocalWeatherDatabase.cpp
src/WeatherCM/FGLocalWeatherDatabase.h

index aa2c0229066a6bf3b80deb7f0051c7de4162ccf0..761c5e25cc80f5d510dd1d03a375c3e1362081a1 100644 (file)
@@ -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               */
index 38ffa6625e4d3f94fda5c3ea340f1718edfe3aa1..5be5482572c7e42a203fdbe4f1ae7e6ea4893e7f 100644 (file)
@@ -53,12 +53,14 @@ HISTORY
 #include <GL/glut.h>
 #include <XGL/xgl.h>
 
+#include <vector>
+#include "sg.h"
+
 #include "FGPhysicalProperties.h"
 #include "FGGlobalWeatherDatabase.h"
 #include "FGMicroWeather.h"
 #include "FGWeatherFeature.h"
 #include "FGWeatherDefs.h"
-#include <vector>
 
 /****************************************************************************/
 /* 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           */