]> git.mxchange.org Git - flightgear.git/blob - src/FDM/YASim/Wing.hpp
Bugfix: no automatic runway selection with --parkpos=
[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 setTwist(float angle);
31     void setCamber(float camber);
32     void setIncidence(float incidence);
33     void setInducedDrag(float drag) { _inducedDrag = drag; }
34     
35     void setFlap0(float start, float end, float lift, float drag);
36     void setFlap1(float start, float end, float lift, float drag);
37     void setSpoiler(float start, float end, float lift, float drag);
38     void setSlat(float start, float end, float aoa, float drag);
39
40     // Set the control axes for the sub-surfaces
41     void setFlap0(float lval, float rval);
42     void setFlap1(float lval, float rval);
43     void setSpoiler(float lval, float rval);
44     void setSlat(float val);
45     void setFlap0Effectiveness(float lval);
46     void setFlap1Effectiveness(float lval);
47
48     // Compile the thing into a bunch of Surface objects
49     void compile();
50
51     void getTip(float* tip);
52
53     bool isMirrored();
54
55     // Ground effect information
56     float getGroundEffect(float* posOut);
57     
58     // Query the list of Surface objects
59     int numSurfaces();
60     Surface* getSurface(int n);
61     float getSurfaceWeight(int n);
62
63     // The overall drag coefficient for the wing as a whole.  Units are
64     // arbitrary.
65     void setDragScale(float scale);
66     float getDragScale();
67
68     // The ratio of force along the Z (lift) direction of each wing
69     // segment to that along the X (drag) direction.
70     void setLiftRatio(float ratio);
71     float getLiftRatio();
72
73 private:
74     void interp(float* v1, float* v2, float frac, float* out);
75     Surface* newSurface(float* pos, float* orient, float chord,
76                         bool flap0, bool flap1, bool slat, bool spoiler);
77
78     struct SurfRec { Surface * surface; float weight; };
79
80     Vector _surfs;
81     Vector _flap0Surfs;
82     Vector _flap1Surfs;
83     Vector _slatSurfs;
84     Vector _spoilerSurfs;
85
86     bool _mirror;
87
88     float _base[3];
89     float _length;
90     float _chord;
91     float _taper;
92     float _sweep;
93     float _dihedral;
94
95     float _stall;
96     float _stallWidth;
97     float _stallPeak;
98     float _twist;
99     float _camber;
100     float _incidence;
101     float _inducedDrag;
102
103     float _dragScale;
104     float _liftRatio;
105
106     float _flap0Start;
107     float _flap0End;
108     float _flap0Lift;
109     float _flap0Drag;
110
111     float _flap1Start;
112     float _flap1End;
113     float _flap1Lift;
114     float _flap1Drag;
115
116     float _spoilerStart;
117     float _spoilerEnd;
118     float _spoilerLift;
119     float _spoilerDrag;
120
121     float _slatStart;
122     float _slatEnd;
123     float _slatAoA;
124     float _slatDrag;
125 };
126
127 }; // namespace yasim
128 #endif // _WING_HPP