Skip to content

Commit

Permalink
more robust matching
Browse files Browse the repository at this point in the history
  • Loading branch information
felixguendling committed Sep 28, 2024
1 parent bd9108e commit aeb066c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions include/osr/lookup.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,15 @@ struct lookup {
match_t match(location const& query,
bool const reverse,
direction const search_dir,
double const max_match_distance,
double max_match_distance,
bitvec<node_idx_t> const* blocked) const {
auto way_candidates = get_way_candidates<Profile>(
query, reverse, search_dir, max_match_distance, blocked);
if (way_candidates.empty()) {
way_candidates = get_way_candidates<Profile>(
query, reverse, search_dir, max_match_distance * 2U, blocked);
auto i = 0U;
while (way_candidates.empty() && i++ < 4U) {
max_match_distance *= 2U;
way_candidates = get_way_candidates<Profile>(query, reverse, search_dir,
max_match_distance, blocked);
}
return way_candidates;
}
Expand Down
2 changes: 1 addition & 1 deletion src/route.cc
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ best_candidate(ways const& w,
std::optional<path> try_direct(osr::location const& from,
osr::location const& to) {
auto const dist = geo::distance(from.pos_, to.pos_);
return dist < 5.0
return dist < 8.0
? std::optional{path{.cost_ = 60U,
.dist_ = dist,
.segments_ = {path::segment{
Expand Down

0 comments on commit aeb066c

Please sign in to comment.