]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/input_output/FGGroundCallback.h
std namespace fix
[flightgear.git] / src / FDM / JSBSim / input_output / FGGroundCallback.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3  Header:       FGGroundCallback.h
4  Author:       Mathias Froehlich
5  Date started: 05/21/04
6
7  ------ Copyright (C) 2004 Mathias Froehlich (Mathias.Froehlich@web.de) -------
8
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU Lesser 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 Lesser General Public License for more
17  details.
18
19  You should have received a copy of the GNU Lesser 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 Lesser General Public License can also be found on
24  the world wide web at http://www.gnu.org.
25
26 HISTORY
27 -------------------------------------------------------------------------------
28 05/21/00   MF   Created
29
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31 SENTRY
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
33
34 #ifndef FGGROUNDCALLBACK_H
35 #define FGGROUNDCALLBACK_H
36
37 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38 INCLUDES
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
40
41 #include "math/FGColumnVector3.h"
42 #include "math/FGLocation.h"
43
44 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
45 DEFINITIONS
46 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
47
48 #define ID_GROUNDCALLBACK "$Id: FGGroundCallback.h,v 1.12 2011/10/14 22:46:49 bcoconni Exp $"
49
50 namespace JSBSim {
51
52 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
53 CLASS DOCUMENTATION
54 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
55
56 /** This class provides callback slots to get ground specific data.
57
58     The default implementation returns values for a
59     ball formed earth with an adjustable terrain elevation.
60
61     @author Mathias Froehlich
62     @version $Id: FGGroundCallback.h,v 1.12 2011/10/14 22:46:49 bcoconni Exp $
63 */
64
65 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66 CLASS DECLARATION
67 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
68
69 class FGGroundCallback : public FGJSBBase
70 {
71 public:
72
73   FGGroundCallback() {}
74   virtual ~FGGroundCallback() {}
75
76   /** Compute the altitude above sealevel
77       @param l location
78    */
79   virtual double GetAltitude(const FGLocation& l) const = 0;
80
81   /** Compute the altitude above ground.
82       The altitude depends on time t and location l.
83       @param t simulation time
84       @param l location
85       @param contact Contact point location below the location l
86       @param normal Normal vector at the contact point
87       @param v Linear velocity at the contact point
88       @param w Angular velocity at the contact point
89       @return altitude above ground
90    */
91   virtual double GetAGLevel(double t, const FGLocation& location,
92                             FGLocation& contact,
93                             FGColumnVector3& normal, FGColumnVector3& v,
94                             FGColumnVector3& w) const = 0;
95
96   /** Compute the local terrain radius
97       @param t simulation time
98       @param location location
99    */
100   virtual double GetTerrainGeoCentRadius(double t, const FGLocation& location) const = 0;
101
102   /** Return the sea level radius
103       @param t simulation time
104       @param location location
105    */
106   virtual double GetSeaLevelRadius(const FGLocation& location) const = 0;
107
108   /** Set the local terrain radius.
109       Only needs to be implemented if JSBSim should be allowed
110       to modify the local terrain radius (see the default implementation)
111    */
112   virtual void SetTerrainGeoCentRadius(double radius)  { }
113
114   /** Set the sea level radius.
115       Only needs to be implemented if JSBSim should be allowed
116       to modify the sea level radius (see the default implementation)
117    */
118   virtual void SetSeaLevelRadius(double radius) {  }
119
120 };
121
122 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
123 // The default sphere earth implementation:
124 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
125
126 class FGDefaultGroundCallback : public FGGroundCallback
127 {
128 public:
129
130    FGDefaultGroundCallback(double referenceRadius = 20925650.0);
131
132    double GetAltitude(const FGLocation& l) const;
133
134    double GetAGLevel(double t, const FGLocation& location,
135                      FGLocation& contact,
136                      FGColumnVector3& normal, FGColumnVector3& v,
137                      FGColumnVector3& w) const;
138
139    void SetTerrainGeoCentRadius(double radius)  {  mTerrainLevelRadius = radius;}
140    double GetTerrainGeoCentRadius(double t, const FGLocation& location) const
141    { return mTerrainLevelRadius; }
142
143    void SetSeaLevelRadius(double radius) { mSeaLevelRadius = radius;   }
144    double GetSeaLevelRadius(const FGLocation& location) const
145    {return mSeaLevelRadius; }
146
147 private:
148
149    double mSeaLevelRadius;
150    double mTerrainLevelRadius;
151 };
152
153
154 }
155 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
156 #endif