1
0
Fork 0

Patch from Maik adds user-settable scaling constants for per-axis fuselage drag and induced drag.

This commit is contained in:
andy 2006-12-18 21:22:20 +00:00
parent 462dd6900c
commit ef7e7f90dd
3 changed files with 19 additions and 7 deletions

View file

@ -279,7 +279,8 @@ void Airplane::addVStab(Wing* vstab)
}
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;
@ -290,6 +291,10 @@ void Airplane::addFuselage(float* front, float* back, float width,
f->width = width;
f->taper = taper;
f->mid = mid;
f->_cx=cx;
f->_cy=cy;
f->_cz=cz;
f->_idrag=idrag;
_fuselages.add(f);
}
@ -519,9 +524,10 @@ float Airplane::compileFuselage(Fuselage* 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];

View file

@ -37,7 +37,8 @@ public:
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);
@ -92,7 +93,7 @@ public:
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; };

View file

@ -316,7 +316,12 @@ void FGFDM::startElement(const char* name, const XMLAttributes &atts)
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");