From: James Turner Date: Mon, 22 Dec 2014 18:47:21 +0000 (+0300) Subject: When the turn angle is large, don’t fly-by. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=dd1b82961822be3cc2f218af348f6fe778f34e50;p=flightgear.git When the turn angle is large, don’t fly-by. This avoids the tan() term in the fly-by computation causing huge turn cuts which will fail to sequence. Convert such turns to fly-over. --- diff --git a/src/Navaids/routePath.cxx b/src/Navaids/routePath.cxx index 0f9700f65..46150b603 100644 --- a/src/Navaids/routePath.cxx +++ b/src/Navaids/routePath.cxx @@ -175,9 +175,15 @@ public: turnAngle = next.legCourseTrue - legCourseTrue; SG_NORMALIZE_RANGE(turnAngle, -180.0, 180.0); turnRadius = radiusM; - double p = copysign(90.0, turnAngle); + if (fabs(turnAngle) > 120.0) { + // flyBy logic blows up for sharp turns - due to the tan() term + // heading towards infinity. By converting to flyOver we do something + // closer to what was requested. + flyOver = true; + } + if (flyOver) { turnEntryPos = pos; turnCenter = SGGeodesy::direct(pos, legCourseTrue + p, turnRadius); @@ -222,10 +228,10 @@ public: next.legCourseTrue = SGGeodesy::courseDeg(turnExitPos, next.pos); turnPathDistanceM = turnRadius * (fabs(turnAngle) * SG_DEGREES_TO_RADIANS); - } + } // of next leg isn't course constrained } else { // next point is dynamic - // no compentsation needed + // no compensation needed turnPathDistanceM = turnRadius * (fabs(turnAngle) * SG_DEGREES_TO_RADIANS); } } else {