From 09585e00a5575eafbbd0aced16e2c20271af8547 Mon Sep 17 00:00:00 2001 From: Michael Krasnyk Date: Thu, 7 Dec 2017 00:41:20 +0100 Subject: [PATCH] Make distance_between_roads symmetrical --- src/extractor/guidance/mergable_road_detector.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/extractor/guidance/mergable_road_detector.cpp b/src/extractor/guidance/mergable_road_detector.cpp index 95349704fec..e6fc778bbef 100644 --- a/src/extractor/guidance/mergable_road_detector.cpp +++ b/src/extractor/guidance/mergable_road_detector.cpp @@ -454,10 +454,16 @@ bool MergableRoadDetector::HaveSameDirection(const NodeID intersection_node, return false; // compare reference distance: - const auto distance_between_roads = util::coordinate_calculation::findClosestDistance( + const auto distance_mid_left_to_right = util::coordinate_calculation::findClosestDistance( coordinates_to_the_left[coordinates_to_the_left.size() / 2], coordinates_to_the_right.begin(), coordinates_to_the_right.end()); + const auto distance_mid_right_to_left = util::coordinate_calculation::findClosestDistance( + coordinates_to_the_right[coordinates_to_the_right.size() / 2], + coordinates_to_the_left.begin(), + coordinates_to_the_left.end()); + const auto distance_between_roads = + std::min(distance_mid_left_to_right, distance_mid_right_to_left); const auto lane_count_lhs = std::max( 1, node_based_graph.GetEdgeData(lhs.eid).flags.road_classification.GetNumberOfLanes());