}
void Airplane::addFuselage(float* front, float* back, float width,
- float taper, float mid)
+ float taper, float mid,
+ float cx, float cy, float cz, float idrag)
{
Fuselage* f = new Fuselage();
int i;
f->width = width;
f->taper = taper;
f->mid = mid;
+ f->_cx=cx;
+ f->_cy=cy;
+ f->_cz=cz;
+ f->_idrag=idrag;
_fuselages.add(f);
}
Surface* s = new Surface();
s->setPosition(pos);
float sideDrag = len/wid;
- s->setYDrag(sideDrag);
- s->setZDrag(sideDrag);
- s->setTotalDrag(scale*segWgt);
+ s->setYDrag(sideDrag*f->_cy);
+ s->setZDrag(sideDrag*f->_cz);
+ s->setTotalDrag(scale*segWgt*f->_cx);
+ s->setInducedDrag(f->_idrag);
// FIXME: fails for fuselages aligned along the Y axis
float o[9];
void addVStab(Wing* vstab);
void addFuselage(float* front, float* back, float width,
- float taper=1, float mid=0.5);
+ float taper=1, float mid=0.5,
+ float cx=1, float cy=1, float cz=1, float idrag=1);
int addTank(float* pos, float cap, float fuelDensity);
void addGear(Gear* g);
void addHook(Hook* h);
private:
struct Tank { float pos[3]; float cap; float fill;
float density; int handle; };
- struct Fuselage { float front[3], back[3], width, taper, mid; };
+ struct Fuselage { float front[3], back[3], width, taper, mid, _cx, _cy, _cz, _idrag; };
struct GearRec { Gear* gear; Surface* surf; float wgt; };
struct ThrustRec { Thruster* thruster;
int handle; float cg[3]; float mass; };
b[2] = attrf(a, "bz");
float taper = attrf(a, "taper", 1);
float mid = attrf(a, "midpoint", 0.5);
- _airplane.addFuselage(v, b, attrf(a, "width"), taper, mid);
+ float cx = attrf(a, "cx", 1);
+ float cy = attrf(a, "cy", 1);
+ float cz = attrf(a, "cz", 1);
+ float idrag = attrf(a, "idrag", 1);
+ _airplane.addFuselage(v, b, attrf(a, "width"), taper, mid,
+ cx, cy, cz, idrag);
} else if(eq(name, "tank")) {
v[0] = attrf(a, "x");
v[1] = attrf(a, "y");