JSBSim Flight Dynamics Model  1.1.11 (13 Feb 2022)
An Open Source Flight Dynamics and Control Software Library in C++
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
11  Software Foundation; either version 2 of the License, or (at your option) any
12  later 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
20  with this program; if not, write to the Free Software Foundation, Inc., 59
21  Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 
23  Further information about the GNU Lesser General Public License can also be
24  found on 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 namespace JSBSim {
42 
43 class FGLocation;
44 class FGColumnVector3;
45 
46 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
47 CLASS DOCUMENTATION
48 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
49 
58 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
59 CLASS DECLARATION
60 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
61 
63 {
64 public:
65 
66  FGGroundCallback() : time(0.0) {}
67  virtual ~FGGroundCallback() {}
68 
79  virtual double GetAGLevel(double t, const FGLocation& location,
80  FGLocation& contact,
81  FGColumnVector3& normal, FGColumnVector3& v,
82  FGColumnVector3& w) const = 0;
83 
93  virtual double GetAGLevel(const FGLocation& location, FGLocation& contact,
94  FGColumnVector3& normal, FGColumnVector3& v,
95  FGColumnVector3& w) const
96  { return GetAGLevel(time, location, contact, normal, v, w); }
97 
102  virtual void SetTerrainElevation(double h) {}
103 
108  virtual void SetEllipse(double semimajor, double semiminor) {}
109 
115  void SetTime(double _time) { time = _time; }
116 
117 protected:
118  double time;
119 };
120 
121 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
122 // The default sphere earth implementation:
123 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
124 
126 {
127 public:
128  explicit FGDefaultGroundCallback(double semiMajor, double semiMinor) :
129  a(semiMajor), b(semiMinor) {}
130 
131  double GetAGLevel(double t, const FGLocation& location,
132  FGLocation& contact,
133  FGColumnVector3& normal, FGColumnVector3& v,
134  FGColumnVector3& w) const override;
135 
136  void SetTerrainElevation(double h) override
137  { mTerrainElevation = h; }
138 
139  void SetEllipse(double semimajor, double semiminor) override
140  { a = semimajor; b = semiminor; }
141 
142 private:
143  double a, b;
144  double mTerrainElevation = 0.0;
145 };
146 
147 }
148 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
149 #endif
JSBSim::FGGroundCallback::SetEllipse
virtual void SetEllipse(double semimajor, double semiminor)
Set the planet semimajor and semiminor axes.
Definition: FGGroundCallback.h:108
JSBSim::FGColumnVector3
This class implements a 3 element column vector.
Definition: FGColumnVector3.h:63
JSBSim::FGLocation
FGLocation holds an arbitrary location in the Earth centered Earth fixed reference frame (ECEF).
Definition: FGLocation.h:151
JSBSim::FGDefaultGroundCallback::GetAGLevel
double GetAGLevel(double t, const FGLocation &location, FGLocation &contact, FGColumnVector3 &normal, FGColumnVector3 &v, FGColumnVector3 &w) const override
Compute the altitude above ground.
Definition: FGGroundCallback.cpp:41
JSBSim::FGGroundCallback::SetTerrainElevation
virtual void SetTerrainElevation(double h)
Set the terrain elevation.
Definition: FGGroundCallback.h:102
JSBSim::FGGroundCallback::GetAGLevel
virtual double GetAGLevel(double t, const FGLocation &location, FGLocation &contact, FGColumnVector3 &normal, FGColumnVector3 &v, FGColumnVector3 &w) const =0
Compute the altitude above ground.
JSBSim::FGGroundCallback
This class provides callback slots to get ground specific data.
Definition: FGGroundCallback.h:62
JSBSim::FGDefaultGroundCallback::SetEllipse
void SetEllipse(double semimajor, double semiminor) override
Set the planet semimajor and semiminor axes.
Definition: FGGroundCallback.h:139
JSBSim::FGGroundCallback::SetTime
void SetTime(double _time)
Set the simulation time.
Definition: FGGroundCallback.h:115
JSBSim::FGGroundCallback::GetAGLevel
virtual double GetAGLevel(const FGLocation &location, FGLocation &contact, FGColumnVector3 &normal, FGColumnVector3 &v, FGColumnVector3 &w) const
Compute the altitude above ground.
Definition: FGGroundCallback.h:93
JSBSim::FGDefaultGroundCallback
Definition: FGGroundCallback.h:125
JSBSim::FGDefaultGroundCallback::SetTerrainElevation
void SetTerrainElevation(double h) override
Set the terrain elevation.
Definition: FGGroundCallback.h:136