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