From 9958937fd1c1f9dd60126a56e1c4f25ceefaf70e Mon Sep 17 00:00:00 2001 From: Patrick Niklaus Date: Mon, 29 Jun 2015 22:01:06 +0200 Subject: [PATCH] At least check 4*LEAF_SIZE edges before returning none. --- data_structures/static_rtree.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/data_structures/static_rtree.hpp b/data_structures/static_rtree.hpp index fa5607198..8c05cf521 100644 --- a/data_structures/static_rtree.hpp +++ b/data_structures/static_rtree.hpp @@ -646,7 +646,8 @@ class StaticRTree const FixedPointCoordinate &input_coordinate, std::vector &result_phantom_node_vector, const unsigned max_number_of_phantom_nodes, - const float max_distance = 1100) + const float max_distance = 1100, + const unsigned max_checked_elements = 4 * LEAF_NODE_SIZE) { unsigned inspected_elements = 0; unsigned number_of_elements_from_big_cc = 0; @@ -663,7 +664,7 @@ class StaticRTree while (!traversal_queue.empty()) { const IncrementalQueryCandidate current_query_node = traversal_queue.top(); - if (current_query_node.min_dist > max_distance) + if (current_query_node.min_dist > max_distance && inspected_elements > max_checked_elements) { break; }