4 #include "ControlMap.hpp"
19 void iterate(float dt);
21 ControlMap* getControlMap();
24 void setPilotPos(float* pos);
25 void getPilotPos(float* out);
27 void getPilotAccel(float* out);
29 void setWeight(float weight);
31 void setWing(Wing* wing);
32 void setTail(Wing* tail);
33 void addVStab(Wing* vstab);
35 void addFuselage(float* front, float* back, float width,
36 float taper=1, float mid=0.5);
37 int addTank(float* pos, float cap, float fuelDensity);
38 void addGear(Gear* g);
39 void addThruster(Thruster* t, float mass, float* cg);
40 void addBallast(float* pos, float mass);
42 int addWeight(float* pos, float size);
43 void setWeight(int handle, float mass);
45 void setApproach(float speed, float altitude);
46 void setApproach(float speed, float altitude, float aoa);
47 void setCruise(float speed, float altitude);
49 void addApproachControl(int control, float val);
50 void addCruiseControl(int control, float val);
56 void setFuelFraction(float frac); // 0-1, total amount of fuel
57 float getFuel(int tank); // in kg!
58 float getFuelDensity(int tank); // kg/m^3
60 void compile(); // generate point masses & such, then solve
62 void stabilizeThrust();
64 // Solution output values
65 int getSolutionIterations();
66 float getDragCoefficient();
69 float getTailIncidence();
70 char* getFailureMsg();
73 struct Tank { float pos[3]; float cap; float fill;
74 float density; int handle; };
75 struct Fuselage { float front[3], back[3], width, taper, mid; };
76 struct GearRec { Gear* gear; Surface* surf; float wgt; };
77 struct ThrustRec { Thruster* thruster;
78 int handle; float cg[3]; float mass; };
79 struct Control { int control; float val; };
80 struct WeightRec { int handle; Surface* surf; };
84 void setupState(float aoa, float speed, State* s);
87 float compileWing(Wing* w);
88 float compileFuselage(Fuselage* f);
89 void compileGear(GearRec* gr);
90 void applyDragFactor(float factor);
91 void applyLiftRatio(float factor);
92 float clamp(float val, float min, float max);
93 void addContactPoint(float* pos);
94 void compileContactPoints();
95 float normFactor(float f);
96 void updateGearState();
114 Vector _contacts; // non-gear ground contact points
116 Vector _surfs; // NON-wing Surfaces
118 Vector _cruiseControls;
125 Vector _approachControls;
126 State _approachState;
129 float _approachSpeed;
131 float _approachWeight;
133 int _solutionIterations;
137 float _tailIncidence;
141 }; // namespace yasim
142 #endif // _AIRPLANE_HPP