1
0
Fork 0

Fixes from Maik Justus:

+ The wing compilation step was accidentally omitting regions that lie
  between the tips and the first/last control object.  That's a real
  problem for wings that contain no controls, and a significant issue
  for those that contain only a few.  I'm stunned that this went
  undetected for so long.
+ The Surface::flapLift() function was oddly returning 1.0 Newtons as
  a minimum, instead of zero.
This commit is contained in:
andy 2006-08-07 16:49:26 +00:00
parent eb38d1f92b
commit 16b11e311c
2 changed files with 11 additions and 8 deletions

View file

@ -300,11 +300,11 @@ float Surface::flapLift(float alpha)
if(alpha < _stalls[0]) if(alpha < _stalls[0])
return flapLift; return flapLift;
else if(alpha > _stalls[0] + _widths[0]) else if(alpha > _stalls[0] + _widths[0])
return 1; return 0;
float frac = (alpha - _stalls[0]) / _widths[0]; float frac = (alpha - _stalls[0]) / _widths[0];
frac = frac*frac*(3-2*frac); frac = frac*frac*(3-2*frac);
return flapLift * (1-frac) + frac; return flapLift * (1-frac);
} }
float Surface::controlDrag(float lift, float drag) float Surface::controlDrag(float lift, float drag)

View file

@ -235,22 +235,25 @@ void Wing::compile()
// Have we already been compiled? // Have we already been compiled?
if(_surfs.size() != 0) return; if(_surfs.size() != 0) return;
// Assemble the start/end coordinates into an array, sort them, // Assemble the start/end coordinates of all control surfaces
// and the wing itself into an array, sort them,
// and remove duplicates. This gives us the boundaries of our // and remove duplicates. This gives us the boundaries of our
// segments. // segments.
float bounds[8]; float bounds[10];
bounds[0] = _flap0Start; bounds[1] = _flap0End; bounds[0] = _flap0Start; bounds[1] = _flap0End;
bounds[2] = _flap1Start; bounds[3] = _flap1End; bounds[2] = _flap1Start; bounds[3] = _flap1End;
bounds[4] = _spoilerStart; bounds[5] = _spoilerEnd; bounds[4] = _spoilerStart; bounds[5] = _spoilerEnd;
bounds[6] = _slatStart; bounds[7] = _slatEnd; bounds[6] = _slatStart; bounds[7] = _slatEnd;
//and don't forget the root and the tip of the wing itself
bounds[8] = 0; bounds[9] = 1;
// Sort in increasing order // Sort in increasing order
int i; int i;
for(i=0; i<8; i++) { for(i=0; i<10; i++) {
int minIdx = i; int minIdx = i;
float minVal = bounds[i]; float minVal = bounds[i];
int j; int j;
for(j=i+1; j<8; j++) { for(j=i+1; j<10; j++) {
if(bounds[j] < minVal) { if(bounds[j] < minVal) {
minIdx = j; minIdx = j;
minVal = bounds[j]; minVal = bounds[j];
@ -263,7 +266,7 @@ void Wing::compile()
// Uniqify // Uniqify
float last = bounds[0]; float last = bounds[0];
int nbounds = 1; int nbounds = 1;
for(i=1; i<8; i++) { for(i=1; i<10; i++) {
if(bounds[i] != last) if(bounds[i] != last)
bounds[nbounds++] = bounds[i]; bounds[nbounds++] = bounds[i];
last = bounds[i]; last = bounds[i];