Skip to content

Commit

Permalink
Filter segments correctly by bounding box
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMarex committed Apr 3, 2016
1 parent da3b7c8 commit c34fff5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion include/util/static_rtree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@ class StaticRTree
{
const auto &current_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,
Expand All @@ -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);
Expand All @@ -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]);
}
Expand Down

0 comments on commit c34fff5

Please sign in to comment.