1
0
Fork 0

YASIM: method name clarification (and indention)

This commit is contained in:
Henning Stahlke 2017-11-19 16:11:57 +01:00
parent 0e6552cddf
commit fb6f965db7
4 changed files with 33 additions and 28 deletions

View file

@ -787,13 +787,13 @@ void Airplane::applyDragFactor(float factor)
float applied = Math::pow(factor, SOLVE_TWEAK); float applied = Math::pow(factor, SOLVE_TWEAK);
_dragFactor *= applied; _dragFactor *= applied;
if(_wing) if(_wing)
_wing->setDragScale(_wing->getDragScale() * applied); _wing->multiplyDragCoefficient(applied);
if(_tail) if(_tail)
_tail->setDragScale(_tail->getDragScale() * applied); _tail->multiplyDragCoefficient(applied);
int i; int i;
for(i=0; i<_vstabs.size(); i++) { for(i=0; i<_vstabs.size(); i++) {
Wing* w = (Wing*)_vstabs.get(i); Wing* w = (Wing*)_vstabs.get(i);
w->setDragScale(w->getDragScale() * applied); w->multiplyDragCoefficient(applied);
} }
for(i=0; i<_fuselages.size(); i++) { for(i=0; i<_fuselages.size(); i++) {
Fuselage* f = (Fuselage*)_fuselages.get(i); Fuselage* f = (Fuselage*)_fuselages.get(i);

View file

@ -853,7 +853,7 @@ Wing* FGFDM::parseWing(XMLAttributes* a, const char* type, Version * version)
w->setInducedDrag(0.7*attrf(a, "idrag", 1)); w->setInducedDrag(0.7*attrf(a, "idrag", 1));
float effect = attrf(a, "effectiveness", 1); float effect = attrf(a, "effectiveness", 1);
w->setDragScale(w->getDragScale()*effect); w->multiplyDragCoefficient(effect);
_currObj = w; _currObj = w;
return w; return w;

View file

@ -253,7 +253,7 @@ void Wing::addSurface(Surface* s, float weight, float twist)
_surfs.add(sr); _surfs.add(sr);
} }
void Wing::setDragScale(float scale) void Wing::setDragCoefficient(float scale)
{ {
_dragScale = scale; _dragScale = scale;
for(int i=0; i<_surfs.size(); i++) { for(int i=0; i<_surfs.size(); i++) {
@ -262,6 +262,11 @@ void Wing::setDragScale(float scale)
} }
} }
void Wing::multiplyDragCoefficient(float factor)
{
setDragCoefficient(_dragScale * factor);
}
void Wing::setLiftRatio(float ratio) void Wing::setLiftRatio(float ratio)
{ {
_liftRatio = ratio; _liftRatio = ratio;

View file

@ -90,8 +90,8 @@ public:
// The overall drag coefficient for the wing as a whole. Units are // The overall drag coefficient for the wing as a whole. Units are
// arbitrary. // arbitrary.
void setDragScale(float scale); void setDragCoefficient(float scale);
float getDragScale() const { return _dragScale; } void multiplyDragCoefficient(float factor);
// The ratio of force along the Z (lift) direction of each wing // The ratio of force along the Z (lift) direction of each wing
// segment to that along the X (drag) direction. // segment to that along the X (drag) direction.