At least check 4*LEAF_SIZE edges before returning none.

This commit is contained in:
Patrick Niklaus 2015-06-29 22:01:06 +02:00
parent f19c57200d
commit 9958937fd1

View File

@ -646,7 +646,8 @@ class StaticRTree
const FixedPointCoordinate &input_coordinate, const FixedPointCoordinate &input_coordinate,
std::vector<PhantomNode> &result_phantom_node_vector, std::vector<PhantomNode> &result_phantom_node_vector,
const unsigned max_number_of_phantom_nodes, 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 inspected_elements = 0;
unsigned number_of_elements_from_big_cc = 0; unsigned number_of_elements_from_big_cc = 0;
@ -663,7 +664,7 @@ class StaticRTree
while (!traversal_queue.empty()) while (!traversal_queue.empty())
{ {
const IncrementalQueryCandidate current_query_node = traversal_queue.top(); 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; break;
} }