From 45289ce3404941cdaccf1dfb00a7f0ad9037b5b3 Mon Sep 17 00:00:00 2001 From: Moritz Kobitzsch <moritz@mapbox.com> Date: Fri, 18 Mar 2016 16:19:55 +0100 Subject: [PATCH] fix division by zero --- src/extractor/guidance/turn_analysis.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/extractor/guidance/turn_analysis.cpp b/src/extractor/guidance/turn_analysis.cpp index 30db27fe7c6..594e180bc1d 100644 --- a/src/extractor/guidance/turn_analysis.cpp +++ b/src/extractor/guidance/turn_analysis.cpp @@ -794,12 +794,13 @@ TurnAnalysis::handleThreeWayTurn(const EdgeID via_edge, std::vector<ConnectedRoad> intersection) const { BOOST_ASSERT(intersection[0].turn.angle < 0.001); - const auto isObviousOfTwo = [](const ConnectedRoad turn, const ConnectedRoad other) + const auto isObviousOfTwo = [](const ConnectedRoad road, const ConnectedRoad other) { - return (angularDeviation(turn.turn.angle, STRAIGHT_ANGLE) < NARROW_TURN_ANGLE && + return (angularDeviation(road.turn.angle, STRAIGHT_ANGLE) < NARROW_TURN_ANGLE && angularDeviation(other.turn.angle, STRAIGHT_ANGLE) > 85) || + (angularDeviation(road.turn.angle,STRAIGHT_ANGLE) < std::numeric_limits<double>::epsilon()) || (angularDeviation(other.turn.angle, STRAIGHT_ANGLE) / - angularDeviation(turn.turn.angle, STRAIGHT_ANGLE) > + angularDeviation(road.turn.angle, STRAIGHT_ANGLE) > 1.4); };