1
0
Fork 0

YASim: add method to Wing and clarify member name.

This commit is contained in:
Henning Stahlke 2017-05-05 16:25:16 +02:00
parent c28f63132f
commit ea8bfba98a
2 changed files with 20 additions and 5 deletions

View file

@ -11,7 +11,7 @@ Wing::Wing(Version *ver, bool mirror, float* base, float chord,
_chord(chord),
_length(length),
_taper(taper),
_sweep(sweep),
_sweepAngleCenterLine(sweep),
_dihedral(dihedral),
_twist(twist)
{
@ -129,7 +129,7 @@ void Wing::calculateWingCoordinateSystem() {
// (tail incidence is varied by the solver)
// Generating a unit vector pointing out the left wing.
float left[3];
left[0] = -Math::tan(_sweep);
left[0] = -Math::tan(_sweepAngleCenterLine);
left[1] = Math::cos(_dihedral);
left[2] = Math::sin(_dihedral);
Math::unit3(left, left);
@ -175,9 +175,21 @@ void Wing::calculateMAC()
const float commonFactor = _chord*(0.5+_taper)/(3*_chord*(1+_taper));
_mac = _chord-(2*_chord*(1-_taper)*commonFactor);
_macRootDistance = _netSpan*commonFactor;
_macX = _base[0]-Math::tan(_sweep) * _macRootDistance + _mac/2;
_macX = _base[0]-Math::tan(_sweepAngleCenterLine) * _macRootDistance + _mac/2;
}
float Wing::calculateSweepAngleLeadingEdge()
{
if (_length == 0) {
return 0;
}
return Math::atan(
(sin(_sweepAngleCenterLine)+(1-_taper)*_chord/(2*_length)) /
cos(_sweepAngleCenterLine)
);
}
void Wing::compile()
{
// Have we already been compiled?

View file

@ -31,7 +31,7 @@ public:
// fraction of chord at wing tip, 0..1
float getTaper() const { return _taper; };
// radians
float getSweep() const { return _sweep; };
float getSweep() const { return _sweepAngleCenterLine; };
// radians, positive is "up"
void setDihedral(float dihedral) { _dihedral = dihedral; }
float getDihedral() const { return _dihedral; };
@ -96,6 +96,7 @@ private:
void calculateTip();
void calculateSpan();
void calculateMAC();
float calculateSweepAngleLeadingEdge();
void addSurface(Surface* s, float weight, float twist);
struct SurfRec { Surface * surface; float weight; };
@ -110,9 +111,11 @@ private:
bool _mirror {false};
float _base[3] {0,0,0};
float _chord {0};
// length is distance from base to tip, not wing span
float _length {0};
float _taper {1};
float _sweep {0};
// sweep of center line, not leading edge!
float _sweepAngleCenterLine {0};
float _dihedral {0};
// calculated from above