]> git.mxchange.org Git - flightgear.git/blob - src/FDM/YASim/Wing.hpp
Moved JSBSim.hxx to src/FDM/JSBSim/
[flightgear.git] / src / FDM / YASim / Wing.hpp
1 #ifndef _WING_HPP
2 #define _WING_HPP
3
4 #include "Vector.hpp"
5
6 namespace yasim {
7
8 class Surface;
9
10 // FIXME: need to handle "inverted" controls for mirrored wings.
11 class Wing {
12 public:
13     Wing();
14     ~Wing();
15
16     // Do we mirror ourselves about the XZ plane?
17     void setMirror(bool mirror);
18
19     // Wing geometry:
20     void setBase(float* base);        // in local coordinates
21     void setLength(float length);     // dist. ALONG wing (not span!)     
22     void setChord(float chord);       // at base, measured along X axis
23     void setTaper(float taper);       // fraction, 0-1
24     void setSweep(float sweep);       // radians
25     void setDihedral(float dihedral); // radians, positive is "up"
26
27     void setStall(float aoa);
28     void setStallWidth(float angle);
29     void setStallPeak(float fraction);
30     void setCamber(float camber);
31     void setIncidence(float incidence);
32     
33     void setFlap0(float start, float end, float lift, float drag);
34     void setFlap1(float start, float end, float lift, float drag);
35     void setSpoiler(float start, float end, float lift, float drag);
36     void setSlat(float start, float end, float aoa, float drag);
37
38     // Set the control axes for the sub-surfaces
39     void setFlap0(float lval, float rval);
40     void setFlap1(float lval, float rval);
41     void setSpoiler(float lval, float rval);
42     void setSlat(float val);
43
44     // Compile the thing into a bunch of Surface objects
45     void compile();
46
47     void getTip(float* tip);
48
49     bool isMirrored();
50
51     // Ground effect information
52     float getGroundEffect(float* posOut);
53     
54     // Query the list of Surface objects
55     int numSurfaces();
56     Surface* getSurface(int n);
57     float getSurfaceWeight(int n);
58
59     // The overall drag coefficient for the wing as a whole.  Units are
60     // arbitrary.
61     void setDragScale(float scale);
62     float getDragScale();
63
64     // The ratio of force along the Z (lift) direction of each wing
65     // segment to that along the X (drag) direction.
66     void setLiftRatio(float ratio);
67     float getLiftRatio();
68
69 private:
70     void interp(float* v1, float* v2, float frac, float* out);
71     Surface* newSurface(float* pos, float* orient, float chord,
72                         bool flap0, bool flap1, bool slat, bool spoiler);
73
74     struct SurfRec { Surface * surface; float weight; };
75
76     Vector _surfs;
77     Vector _flap0Surfs;
78     Vector _flap1Surfs;
79     Vector _slatSurfs;
80     Vector _spoilerSurfs;
81
82     bool _mirror;
83
84     float _base[3];
85     float _length;
86     float _chord;
87     float _taper;
88     float _sweep;
89     float _dihedral;
90
91     float _stall;
92     float _stallWidth;
93     float _stallPeak;
94     float _camber;
95     float _incidence;
96
97     float _dragScale;
98     float _liftRatio;
99
100     float _flap0Start;
101     float _flap0End;
102     float _flap0Lift;
103     float _flap0Drag;
104
105     float _flap1Start;
106     float _flap1End;
107     float _flap1Lift;
108     float _flap1Drag;
109
110     float _spoilerStart;
111     float _spoilerEnd;
112     float _spoilerLift;
113     float _spoilerDrag;
114
115     float _slatStart;
116     float _slatEnd;
117     float _slatAoA;
118     float _slatDrag;
119 };
120
121 }; // namespace yasim
122 #endif // _WING_HPP