Separate fuselage drag adjustment from that for landing gear and external weights.
This commit is in prepartion for the following commit, which is a bug fix for Issue 1463 (YASim underestimates off-axis forces on fuselages). Previously the solver would adjust the drag factor for all of an Airplane's non-Wing Surfaces in one pass, with no attempt to distinguish Fuselage Surfaces from the Surfaces for Gear and Weights. This makes it difficult to modify how fuselage drag is calculated while leaving unaffected the drag for landing gear and external weights. Now the solver adjusts the drag for an Airplane's fuselages, landing gear, and external weights in three separate passes. To do this, each Fuselage now has a list of its Surfaces. The fuselage pass simply iterates through the list of Fuselages, running through each Fuselage's list of Surfaces. The Airplane's list of non-Wing Surfaces, "_surfs", is no longer used here, but there may still be uses of it elsewhere.
This commit is contained in:
parent
98c053792e
commit
907209746f
2 changed files with 18 additions and 4 deletions
|
@ -577,6 +577,7 @@ float Airplane::compileFuselage(Fuselage* f)
|
|||
s->setOrientation(o);
|
||||
|
||||
_model.addSurface(s);
|
||||
f->surfs.add(s);
|
||||
_surfs.add(s);
|
||||
}
|
||||
return wgt;
|
||||
|
@ -914,9 +915,21 @@ void Airplane::applyDragFactor(float factor)
|
|||
Wing* w = (Wing*)_vstabs.get(i);
|
||||
w->setDragScale(w->getDragScale() * applied);
|
||||
}
|
||||
for(i=0; i<_surfs.size(); i++) {
|
||||
Surface* s = (Surface*)_surfs.get(i);
|
||||
s->setTotalDrag(s->getTotalDrag() * applied);
|
||||
for(i=0; i<_fuselages.size(); i++) {
|
||||
Fuselage* f = (Fuselage*)_fuselages.get(i);
|
||||
int j;
|
||||
for(j=0; j<f->surfs.size(); j++) {
|
||||
Surface* s = (Surface*)f->surfs.get(j);
|
||||
s->setTotalDrag(s->getTotalDrag() * applied);
|
||||
}
|
||||
}
|
||||
for(i=0; i<_weights.size(); i++) {
|
||||
WeightRec* wr = (WeightRec*)_weights.get(i);
|
||||
wr->surf->setTotalDrag(wr->surf->getTotalDrag() * applied);
|
||||
}
|
||||
for(i=0; i<_gears.size(); i++) {
|
||||
GearRec* gr = (GearRec*)_gears.get(i);
|
||||
gr->surf->setTotalDrag(gr->surf->getTotalDrag() * applied);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,8 @@ 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, _cx, _cy, _cz, _idrag; };
|
||||
struct Fuselage { float front[3], back[3], width, taper, mid, _cx, _cy, _cz, _idrag;
|
||||
Vector surfs; };
|
||||
struct GearRec { Gear* gear; Surface* surf; float wgt; };
|
||||
struct ThrustRec { Thruster* thruster;
|
||||
int handle; float cg[3]; float mass; };
|
||||
|
|
Loading…
Add table
Reference in a new issue