From b9cea7454d65537a11a6ecbd805c683f767dd3bb Mon Sep 17 00:00:00 2001 From: Moritz Kobitzsch 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 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::epsilon()) || (angularDeviation(other.turn.angle, STRAIGHT_ANGLE) / - angularDeviation(turn.turn.angle, STRAIGHT_ANGLE) > + angularDeviation(road.turn.angle, STRAIGHT_ANGLE) > 1.4); };