Bug: If you querry a point that lies between two BBs that have a gap, one BB will be pruned, even if it could contain a nearer match.
| 276 | // Bug: If you querry a point that lies between two BBs that have a gap, |
| 277 | // one BB will be pruned, even if it could contain a nearer match. |
| 278 | BOOST_AUTO_TEST_CASE(regression_test) |
| 279 | { |
| 280 | using Coord = std::pair<FloatLongitude, FloatLatitude>; |
| 281 | using Edge = std::tuple<unsigned, unsigned, bool>; |
| 282 | GraphFixture fixture( |
| 283 | { |
| 284 | Coord{FloatLongitude{0.0}, FloatLatitude{40.0}}, // |
| 285 | Coord{FloatLongitude{5.0}, FloatLatitude{35.0}}, // |
| 286 | Coord{FloatLongitude{5.0}, FloatLatitude{5.0}}, // |
| 287 | Coord{FloatLongitude{10.0}, FloatLatitude{0.0}}, // |
| 288 | Coord{FloatLongitude{10.0}, FloatLatitude{20.0}}, // |
| 289 | Coord{FloatLongitude{5.0}, FloatLatitude{20.0}}, // |
| 290 | Coord{FloatLongitude{100.0}, FloatLatitude{40.0}}, // |
| 291 | Coord{FloatLongitude{105.0}, FloatLatitude{35.0}}, // |
| 292 | Coord{FloatLongitude{105.0}, FloatLatitude{5.0}}, // |
| 293 | Coord{FloatLongitude{110.0}, FloatLatitude{0.0}}, // |
| 294 | }, |
| 295 | {Edge(0, 1, true), Edge(2, 3, true), Edge(4, 5, true), Edge(6, 7, true), Edge(8, 9, true)}); |
| 296 | |
| 297 | TemporaryFile tmp; |
| 298 | auto rtree = make_rtree<MiniStaticRTree>(tmp.path, fixture); |
| 299 | LinearSearchNN<TestData> lsnn(fixture.coords, fixture.edges); |
| 300 | |
| 301 | // query a node just right of the center of the gap |
| 302 | Coordinate input(FloatLongitude{55.1}, FloatLatitude{20.0}); |
| 303 | auto result_rtree = rtree.Nearest(input, 1); |
| 304 | auto result_ls = lsnn.Nearest(input, 1); |
| 305 | |
| 306 | BOOST_CHECK(result_rtree.size() == 1); |
| 307 | BOOST_CHECK(result_ls.size() == 1); |
| 308 | |
| 309 | BOOST_CHECK_EQUAL(result_ls.front().u, result_rtree.front().data.u); |
| 310 | BOOST_CHECK_EQUAL(result_ls.front().v, result_rtree.front().data.v); |
| 311 | } |
| 312 | |
| 313 | // Bug: If you querry a point with a narrow radius, no result should be returned |
| 314 | BOOST_AUTO_TEST_CASE(radius_regression_test) |