YASim Wing: remove unnecessary local variable "root" (use _base);
calculate _tip in directly in one command clarify signature of Wing::interp()
This commit is contained in:
parent
583ea27dd6
commit
80462d23c5
2 changed files with 8 additions and 9 deletions
|
@ -195,7 +195,9 @@ void Wing::compile()
|
||||||
last = bounds[i];
|
last = bounds[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// prepare wing coordinate system, ignoring incidence and twist for now
|
||||||
|
// (tail incidence is varied by the solver)
|
||||||
|
|
||||||
// Generating a unit vector pointing out the left wing.
|
// Generating a unit vector pointing out the left wing.
|
||||||
float left[3];
|
float left[3];
|
||||||
left[0] = -Math::tan(_sweep);
|
left[0] = -Math::tan(_sweep);
|
||||||
|
@ -204,11 +206,8 @@ void Wing::compile()
|
||||||
Math::unit3(left, left);
|
Math::unit3(left, left);
|
||||||
|
|
||||||
// Calculate coordinates for the root and tip of the wing
|
// Calculate coordinates for the root and tip of the wing
|
||||||
float root[3];
|
Math::mul3(_length, left, _tip);
|
||||||
Math::set3(_base, root);
|
Math::add3(_base, _tip, _tip);
|
||||||
Math::set3(left, _tip);
|
|
||||||
Math::mul3(_length, _tip, _tip);
|
|
||||||
Math::add3(root, _tip, _tip);
|
|
||||||
_meanChord = _chord*(_taper+1)*0.5f;
|
_meanChord = _chord*(_taper+1)*0.5f;
|
||||||
// wingspan in y-direction (not for vstab)
|
// wingspan in y-direction (not for vstab)
|
||||||
_wingspan = Math::abs(2*_tip[1]);
|
_wingspan = Math::abs(2*_tip[1]);
|
||||||
|
@ -269,7 +268,7 @@ void Wing::compile()
|
||||||
for(j=0; j<nSegs; j++) {
|
for(j=0; j<nSegs; j++) {
|
||||||
float frac = start + (j+0.5f) * (end-start)/nSegs;
|
float frac = start + (j+0.5f) * (end-start)/nSegs;
|
||||||
float pos[3];
|
float pos[3];
|
||||||
interp(root, _tip, frac, pos);
|
interp(_base, _tip, frac, pos);
|
||||||
|
|
||||||
float chord = _chord * (1 - (1-_taper)*frac);
|
float chord = _chord * (1 - (1-_taper)*frac);
|
||||||
|
|
||||||
|
@ -370,7 +369,7 @@ Surface* Wing::newSurface(float* pos, float* orient, float chord,
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Wing::interp(float* v1, float* v2, float frac, float* out)
|
void Wing::interp(const float* v1, const float* v2, const float frac, float* out)
|
||||||
{
|
{
|
||||||
out[0] = v1[0] + frac*(v2[0]-v1[0]);
|
out[0] = v1[0] + frac*(v2[0]-v1[0]);
|
||||||
out[1] = v1[1] + frac*(v2[1]-v1[1]);
|
out[1] = v1[1] + frac*(v2[1]-v1[1]);
|
||||||
|
|
|
@ -90,7 +90,7 @@ public:
|
||||||
float getLiftRatio() { return _liftRatio; }
|
float getLiftRatio() { return _liftRatio; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void interp(float* v1, float* v2, float frac, float* out);
|
void interp(const float* v1, const float* v2, const float frac, float* out);
|
||||||
Surface* newSurface(float* pos, float* orient, float chord,
|
Surface* newSurface(float* pos, float* orient, float chord,
|
||||||
bool flap0, bool flap1, bool slat, bool spoiler);
|
bool flap0, bool flap1, bool slat, bool spoiler);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue