From dd1b82961822be3cc2f218af348f6fe778f34e50 Mon Sep 17 00:00:00 2001 From: James Turner Date: Mon, 22 Dec 2014 21:47:21 +0300 Subject: [PATCH] =?utf8?q?When=20the=20turn=20angle=20is=20large,=20don?= =?utf8?q?=E2=80=99t=20fly-by.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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. --- src/Navaids/routePath.cxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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 { -- 2.39.5