From c34fff5e7a06b662f6f5694cbb88ef5ec48c3ee3 Mon Sep 17 00:00:00 2001 From: Patrick Niklaus Date: Sun, 3 Apr 2016 11:41:46 +0200 Subject: [PATCH] Filter segments correctly by bounding box --- include/util/static_rtree.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/util/static_rtree.hpp b/include/util/static_rtree.hpp index 6fe64d04153..6924d9430cf 100644 --- a/include/util/static_rtree.hpp +++ b/include/util/static_rtree.hpp @@ -351,6 +351,8 @@ class StaticRTree { const auto ¤t_edge = current_leaf_node.objects[i]; + // we don't need to project the coordinates here, + // because we use the unprojected rectangle to test against const Rectangle bbox{std::min((*m_coordinate_list)[current_edge.u].lon, (*m_coordinate_list)[current_edge.v].lon), std::max((*m_coordinate_list)[current_edge.u].lon, @@ -360,6 +362,7 @@ class StaticRTree std::max((*m_coordinate_list)[current_edge.u].lat, (*m_coordinate_list)[current_edge.v].lat)}; + // use the _unprojected_ input rectangle here if (bbox.Intersects(search_rectangle)) { results.push_back(current_edge); @@ -376,7 +379,7 @@ class StaticRTree const auto &child_tree_node = m_search_tree[child_id]; const auto &child_rectangle = child_tree_node.minimum_bounding_rectangle; - if (child_rectangle.Intersects(search_rectangle)) + if (child_rectangle.Intersects(projected_rectangle)) { traversal_queue.push(m_search_tree[child_id]); }