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