Author: Christian Mayer
Date started: 28.05.99
- ---------- Copyright (C) 1999 Christian Mayer (vader@t-online.de) ----------
+ -------- Copyright (C) 1999 Christian Mayer (fgfs@christianmayer.de) --------
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
28.05.1999 Christian Mayer Created
16.06.1999 Durk Talsma Portability for Linux
20.06.1999 Christian Mayer added lots of consts
-10.10.1999 Christian Mayer added mutable for gcc 2.95 portability
11.10.1999 Christian Mayer changed set<> to map<> on Bernie Bright's
suggestion
+19.10.1999 Christian Mayer change to use PLIB's sg instead of Point[2/3]D
+ and lots of wee code cleaning
+21.12.1999 Christian Mayer Added a fix for compatibility to gcc 2.8 which
+ suggested by Oliver Delise
*****************************************************************************/
/****************************************************************************/
/****************************************************************************/
/* INCLUDES */
/****************************************************************************/
-#include <Math/point3d.hxx>
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <simgear/compiler.h>
+
+#ifdef HAVE_WINDOWS_H
+# include <windows.h>
+#endif
+
+#include <plib/sg.h>
+
#include "FGWeatherDefs.h"
-//for the case that mutable isn't supported:
-#include "Include/compiler.h"
-
/****************************************************************************/
/* DEFINES */
/****************************************************************************/
class FGTurbulenceItem;
FGTurbulenceItem operator-(const FGTurbulenceItem& arg);
+#if ( __GNU_C__ == 2 && __GNU_MAJOR__ < 9 )
+# define const_sgVec3 const sgVec3
+#else
+# define const_sgVec3 const sgVec3&
+#endif
+
/****************************************************************************/
/* CLASS DECLARATION */
/****************************************************************************/
class FGTurbulenceItem
{
private:
- mutable Point3D value;
- WeatherPrecition alt;
+ sgVec3 value;
protected:
public:
- FGTurbulenceItem(const WeatherPrecition& a, const Point3D& v) {alt = a; value = v;}
- FGTurbulenceItem(const Point3D& v) {alt = 0.0; value = v;}
- FGTurbulenceItem() {alt = 0.0; value = Point3D(0.0);}
+ FGTurbulenceItem(const_sgVec3 v) { sgCopyVec3(value, v);}
+ FGTurbulenceItem() { sgZeroVec3(value); }
- Point3D getValue() const { return value; };
- WeatherPrecition getAlt() const { return alt; };
+ void getValue(sgVec3 ret) const { sgCopyVec3(ret, value); };
+ const sgVec3* getValue(void) const { return &value; };
- FGTurbulenceItem& operator*= (const WeatherPrecition& arg);
+ WeatherPrecision x(void) const { return value[0]; };
+ WeatherPrecision y(void) const { return value[1]; };
+ WeatherPrecision z(void) const { return value[2]; };
+
+ void x(const WeatherPrecision x) { value[0] = x; };
+ void y(const WeatherPrecision y) { value[1] = y; };
+ void z(const WeatherPrecision z) { value[2] = z; };
+
+ FGTurbulenceItem& operator*= (const WeatherPrecision arg);
FGTurbulenceItem& operator+= (const FGTurbulenceItem& arg);
FGTurbulenceItem& operator-= (const FGTurbulenceItem& arg);
- friend bool operator<(const FGTurbulenceItem& arg1, const FGTurbulenceItem& arg2 );
friend FGTurbulenceItem operator-(const FGTurbulenceItem& arg);
-
};
-inline FGTurbulenceItem& FGTurbulenceItem::operator*= (const WeatherPrecition& arg)
+inline FGTurbulenceItem& FGTurbulenceItem::operator*= (const WeatherPrecision arg)
{
- value *= arg;
+ sgScaleVec3(value, arg);
return *this;
}
inline FGTurbulenceItem& FGTurbulenceItem::operator+= (const FGTurbulenceItem& arg)
{
- value += arg.value;
+ sgAddVec3(value, *arg.getValue());
return *this;
}
inline FGTurbulenceItem& FGTurbulenceItem::operator-= (const FGTurbulenceItem& arg)
{
- value -= arg.value;
+ sgSubVec3(value, *arg.getValue());
return *this;
}
inline FGTurbulenceItem operator-(const FGTurbulenceItem& arg)
{
- return FGTurbulenceItem(arg.alt, -arg.value);
+ sgVec3 temp;
+
+ sgNegateVec3(temp, *arg.getValue());
+
+ return FGTurbulenceItem(temp);
}
/****************************************************************************/