Skip to content

Commit 0653b89

Browse files
wip
1 parent f7589de commit 0653b89

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

src/route.cc

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -518,17 +518,19 @@ std::optional<path> route_bidirectional(ways const& w,
518518
return *direct;
519519
}
520520

521-
b.reset(max, from, to);
522-
if (b.radius_ == max) {
523-
return std::nullopt;
524-
}
521+
for (auto const accept_bad_max_matching_dist : {false, true}) {
522+
auto const limit_squared_max_matching_distance =
523+
accept_bad_max_matching_dist
524+
? std::numeric_limits<double>::max()
525+
: geo::approx_squared_distance(from.pos_, to.pos_,
526+
b.distance_lon_degrees_) /
527+
kMaxMatchingDistanceSquaredRatio;
525528

526-
auto const limit_squared_max_matching_distance =
527-
geo::approx_squared_distance(from.pos_, to.pos_,
528-
b.distance_lon_degrees_) /
529-
kMaxMatchingDistanceSquaredRatio;
529+
b.reset(max, from, to);
530+
if (b.radius_ == max) {
531+
return std::nullopt;
532+
}
530533

531-
for (auto const accept_bad_max_matching_dist : {false, true}) {
532534
for (auto const [i, start] : utl::enumerate(from_match)) {
533535
if (b.max_reached_1_ && component_seen(w, from_match, i)) {
534536
continue;
@@ -617,10 +619,10 @@ std::optional<path> route_dijkstra(ways const& w,
617619
}
618620

619621
auto const distance_lng_degrees = geo::approx_distance_lng_degrees(from.pos_);
620-
621-
d.reset(max);
622-
auto should_continue = true;
623622
for (auto const accept_bad_max_matching_dist : {false, true}) {
623+
d.reset(max);
624+
auto should_continue = true;
625+
624626
auto const limit_squared_max_matching_distance =
625627
accept_bad_max_matching_dist
626628
? std::numeric_limits<double>::max()
@@ -694,9 +696,9 @@ std::vector<std::optional<path>> route(
694696
auto const distance_lng_degrees = geo::approx_distance_lng_degrees(from.pos_);
695697

696698
d.reset(max);
697-
auto should_continue = true;
698699

699700
for (auto const accept_bad_max_matching_dist : {false, true}) {
701+
auto should_continue = true;
700702
for (auto const [i, start] : utl::enumerate(from_match)) {
701703
if (!should_continue && component_seen(w, from_match, i)) {
702704
continue;

0 commit comments

Comments
 (0)