4 #include "ControlMap.hpp"
19 void iterate(float dt);
20 void consumeFuel(float dt);
22 ControlMap* getControlMap();
25 void setPilotPos(float* pos);
26 void getPilotPos(float* out);
28 void getPilotAccel(float* out);
30 void setWeight(float weight);
32 void setWing(Wing* wing);
33 void setTail(Wing* tail);
34 void addVStab(Wing* vstab);
36 void addFuselage(float* front, float* back, float width,
37 float taper=1, float mid=0.5);
38 int addTank(float* pos, float cap, float fuelDensity);
39 void addGear(Gear* g);
40 void addThruster(Thruster* t, float mass, float* cg);
41 void addBallast(float* pos, float mass);
43 int addWeight(float* pos, float size);
44 void setWeight(int handle, float mass);
46 void setApproach(float speed, float altitude);
47 void setApproach(float speed, float altitude, float aoa);
48 void setCruise(float speed, float altitude);
50 void setElevatorControl(int control);
51 void addApproachControl(int control, float val);
52 void addCruiseControl(int control, float val);
58 void setFuelFraction(float frac); // 0-1, total amount of fuel
59 float getFuel(int tank); // in kg!
60 float getFuelDensity(int tank); // kg/m^3
61 float getTankCapacity(int tank);
63 void compile(); // generate point masses & such, then solve
65 void stabilizeThrust();
67 // Solution output values
68 int getSolutionIterations();
69 float getDragCoefficient();
72 float getTailIncidence();
73 float getApproachElevator() { return _approachElevator.val; }
74 char* getFailureMsg();
77 struct Tank { float pos[3]; float cap; float fill;
78 float density; int handle; };
79 struct Fuselage { float front[3], back[3], width, taper, mid; };
80 struct GearRec { Gear* gear; Surface* surf; float wgt; };
81 struct ThrustRec { Thruster* thruster;
82 int handle; float cg[3]; float mass; };
83 struct Control { int control; float val; };
84 struct WeightRec { int handle; Surface* surf; };
88 void setupState(float aoa, float speed, State* s);
91 float compileWing(Wing* w);
92 float compileFuselage(Fuselage* f);
93 void compileGear(GearRec* gr);
94 void applyDragFactor(float factor);
95 void applyLiftRatio(float factor);
96 float clamp(float val, float min, float max);
97 void addContactPoint(float* pos);
98 void compileContactPoints();
99 float normFactor(float f);
100 void updateGearState();
103 ControlMap _controls;
118 Vector _contacts; // non-gear ground contact points
120 Vector _surfs; // NON-wing Surfaces
122 Vector _cruiseControls;
129 Vector _approachControls;
130 State _approachState;
133 float _approachSpeed;
135 float _approachWeight;
137 int _solutionIterations;
141 float _tailIncidence;
142 Control _approachElevator;
146 }; // namespace yasim
147 #endif // _AIRPLANE_HPP