]> git.mxchange.org Git - flightgear.git/blob - src/WeatherCM/FGTurbulenceItem.h
Updates by Christian Mayer.
[flightgear.git] / src / WeatherCM / FGTurbulenceItem.h
1 /*****************************************************************************
2
3  Header:       FGTurbulenceItem.h       
4  Author:       Christian Mayer
5  Date started: 28.05.99
6
7  -------- Copyright (C) 1999 Christian Mayer (fgfs@christianmayer.de) --------
8
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU General Public License as published by the Free Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  version.
13
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
17  details.
18
19  You should have received a copy of the GNU General Public License along with
20  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21  Place - Suite 330, Boston, MA  02111-1307, USA.
22
23  Further information about the GNU General Public License can also be found on
24  the world wide web at http://www.gnu.org.
25
26 FUNCTIONAL DESCRIPTION
27 ------------------------------------------------------------------------------
28 turbulence item that gets stored in the micro weather class
29
30 HISTORY
31 ------------------------------------------------------------------------------
32 28.05.1999 Christian Mayer      Created
33 16.06.1999 Durk Talsma          Portability for Linux
34 20.06.1999 Christian Mayer      added lots of consts
35 11.10.1999 Christian Mayer      changed set<> to map<> on Bernie Bright's 
36                                 suggestion
37 19.10.1999 Christian Mayer      change to use PLIB's sg instead of Point[2/3]D
38                                 and lots of wee code cleaning
39 *****************************************************************************/
40
41 /****************************************************************************/
42 /* SENTRY                                                                   */
43 /****************************************************************************/
44 #ifndef FGTurbulenceItem_H
45 #define FGTurbulenceItem_H
46
47 /****************************************************************************/
48 /* INCLUDES                                                                 */
49 /****************************************************************************/
50 #include "sg.h"
51
52 #include "FGWeatherDefs.h"
53
54 /****************************************************************************/
55 /* DEFINES                                                                  */
56 /****************************************************************************/
57 class FGTurbulenceItem;
58 FGTurbulenceItem operator-(const FGTurbulenceItem& arg);
59
60 /****************************************************************************/
61 /* CLASS DECLARATION                                                        */
62 /****************************************************************************/
63 class FGTurbulenceItem
64 {
65 private:
66     sgVec3 value;
67
68 protected:
69 public:
70     FGTurbulenceItem(const sgVec3& v)   { sgCopyVec3(value, v);}
71     FGTurbulenceItem()                  { sgZeroVec3(value);   }
72
73     void          getValue(sgVec3 ret) const { sgCopyVec3(ret, value); };
74     const sgVec3* getValue(void)       const { return &value; };
75
76     WeatherPrecision x(void) const { return value[0]; };
77     WeatherPrecision y(void) const { return value[1]; };
78     WeatherPrecision z(void) const { return value[2]; };
79
80     FGTurbulenceItem& operator*= (const WeatherPrecision  arg);
81     FGTurbulenceItem& operator+= (const FGTurbulenceItem& arg);
82     FGTurbulenceItem& operator-= (const FGTurbulenceItem& arg);
83
84     friend FGTurbulenceItem operator-(const FGTurbulenceItem& arg);
85 };
86
87 inline FGTurbulenceItem& FGTurbulenceItem::operator*= (const WeatherPrecision arg)
88 {
89   sgScaleVec3(value, arg);
90   return *this;
91 }
92
93 inline FGTurbulenceItem& FGTurbulenceItem::operator+= (const FGTurbulenceItem& arg)
94 {
95   sgAddVec3(value, *arg.getValue());
96   return *this;
97 }
98
99 inline FGTurbulenceItem& FGTurbulenceItem::operator-= (const FGTurbulenceItem& arg)
100 {
101   sgSubVec3(value, *arg.getValue());
102   return *this;
103 }
104
105 inline FGTurbulenceItem operator-(const FGTurbulenceItem& arg)
106 {
107     sgVec3 temp;
108
109     sgNegateVec3(temp, *arg.getValue());
110
111     return FGTurbulenceItem(temp);
112 }
113
114 /****************************************************************************/
115 #endif /*FGTurbulenceItem_H*/
116
117
118
119