Skip to content

Commit

Permalink
Don't bounds check by default in static rtree; fixes #1988
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-j-h authored and Moritz Kobitzsch committed Feb 19, 2016
1 parent 89971a4 commit b3685c8
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions include/util/static_rtree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,14 @@ class StaticRTree
EdgeDataT const &current_element = input_data_vector[element_counter];

// Get Hilbert-Value for centroid in mercartor projection
BOOST_ASSERT(current_element.u < coordinate_list.size());
BOOST_ASSERT(current_element.v < coordinate_list.size());

FixedPointCoordinate current_centroid = EdgeDataT::Centroid(
FixedPointCoordinate(coordinate_list.at(current_element.u).lat,
coordinate_list.at(current_element.u).lon),
FixedPointCoordinate(coordinate_list.at(current_element.v).lat,
coordinate_list.at(current_element.v).lon));
FixedPointCoordinate(coordinate_list[current_element.u].lat,
coordinate_list[current_element.u].lon),
FixedPointCoordinate(coordinate_list[current_element.v].lat,
coordinate_list[current_element.v].lon));
current_centroid.lat =
COORDINATE_PRECISION * coordinate_calculation::mercator::latToY(
current_centroid.lat / COORDINATE_PRECISION);
Expand Down Expand Up @@ -467,19 +470,22 @@ class StaticRTree
{
for (uint32_t i = 0; i < element_count; ++i)
{
BOOST_ASSERT(objects[i].u < coordinate_list.size());
BOOST_ASSERT(objects[i].v < coordinate_list.size());

rectangle.min_lon =
std::min(rectangle.min_lon, std::min(coordinate_list.at(objects[i].u).lon,
coordinate_list.at(objects[i].v).lon));
std::min(rectangle.min_lon, std::min(coordinate_list[objects[i].u].lon,
coordinate_list[objects[i].v].lon));
rectangle.max_lon =
std::max(rectangle.max_lon, std::max(coordinate_list.at(objects[i].u).lon,
coordinate_list.at(objects[i].v).lon));
std::max(rectangle.max_lon, std::max(coordinate_list[objects[i].u].lon,
coordinate_list[objects[i].v].lon));

rectangle.min_lat =
std::min(rectangle.min_lat, std::min(coordinate_list.at(objects[i].u).lat,
coordinate_list.at(objects[i].v).lat));
std::min(rectangle.min_lat, std::min(coordinate_list[objects[i].u].lat,
coordinate_list[objects[i].v].lat));
rectangle.max_lat =
std::max(rectangle.max_lat, std::max(coordinate_list.at(objects[i].u).lat,
coordinate_list.at(objects[i].v).lat));
std::max(rectangle.max_lat, std::max(coordinate_list[objects[i].u].lat,
coordinate_list[objects[i].v].lat));
}
BOOST_ASSERT(rectangle.min_lat != std::numeric_limits<int>::min());
BOOST_ASSERT(rectangle.min_lon != std::numeric_limits<int>::min());
Expand Down

0 comments on commit b3685c8

Please sign in to comment.