1
0
Fork 0

Fix for issue 1394 (YASim's geometry for non-cylindrical fuselages is wrong)

Correct handling of fuselage's "midpoint" XML attribute so that the midpoint's
location matches the point assumed by all aircraft developers and YASim docs.
This means the fuselage won't be generated "back-to-front".
Also correct the variation of diameter for tapered fuselages so that both ends
of the fuselage narrow from the midpoint to the endpoints.
Before this, one end was narrowing from the endpoint to the midpoint, the
opposite of what was expected.
These changes affect both weight distribution and the distribution of lateral
aerodynamic forces.
This commit is contained in:
Colin Douglas Howell 2014-05-05 21:21:23 -07:00 committed by Torsten Dreyer
parent 19aedd4523
commit 4d1aebad79
2 changed files with 18 additions and 2 deletions

View file

@ -530,8 +530,15 @@ float Airplane::compileFuselage(Fuselage* f)
float scale = 1;
if(frac < f->mid)
scale = f->taper+(1-f->taper) * (frac / f->mid);
else
scale = f->taper+(1-f->taper) * (frac - f->mid) / (1 - f->mid);
else {
if( isVersionOrNewer( YASIM_VERSION_32 ) ) {
// Correct calculation of width for fuselage taper.
scale = 1 - (1-f->taper) * (frac - f->mid) / (1 - f->mid);
} else {
// Original, incorrect calculation of width for fuselage taper.
scale = f->taper+(1-f->taper) * (frac - f->mid) / (1 - f->mid);
}
}
// Where are we?
float pos[3];

View file

@ -436,6 +436,15 @@ void FGFDM::startElement(const char* name, const XMLAttributes &atts)
b[2] = attrf(a, "bz");
float taper = attrf(a, "taper", 1);
float mid = attrf(a, "midpoint", 0.5);
if (_airplane.isVersionOrNewer(Version::YASIM_VERSION_32)) {
// A fuselage's "midpoint" XML attribute is defined from the
// fuselage's front end, but the Fuselage object's internal
// "mid" attribute is actually defined from the rear end.
// Thus YASim's original interpretation of "midpoint" was wrong.
// Complement the "midpoint" value to ensure the fuselage
// points the right way.
mid = 1 - mid;
}
float cx = attrf(a, "cx", 1);
float cy = attrf(a, "cy", 1);
float cz = attrf(a, "cz", 1);