@@ -518,17 +518,19 @@ std::optional<path> route_bidirectional(ways const& w,
518
518
return *direct;
519
519
}
520
520
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 ;
525
528
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
+ }
530
533
531
- for (auto const accept_bad_max_matching_dist : {false , true }) {
532
534
for (auto const [i, start] : utl::enumerate (from_match)) {
533
535
if (b.max_reached_1_ && component_seen (w, from_match, i)) {
534
536
continue ;
@@ -617,10 +619,10 @@ std::optional<path> route_dijkstra(ways const& w,
617
619
}
618
620
619
621
auto const distance_lng_degrees = geo::approx_distance_lng_degrees (from.pos_ );
620
-
621
- d.reset (max);
622
- auto should_continue = true ;
623
622
for (auto const accept_bad_max_matching_dist : {false , true }) {
623
+ d.reset (max);
624
+ auto should_continue = true ;
625
+
624
626
auto const limit_squared_max_matching_distance =
625
627
accept_bad_max_matching_dist
626
628
? std::numeric_limits<double >::max ()
@@ -694,9 +696,9 @@ std::vector<std::optional<path>> route(
694
696
auto const distance_lng_degrees = geo::approx_distance_lng_degrees (from.pos_ );
695
697
696
698
d.reset (max);
697
- auto should_continue = true ;
698
699
699
700
for (auto const accept_bad_max_matching_dist : {false , true }) {
701
+ auto should_continue = true ;
700
702
for (auto const [i, start] : utl::enumerate (from_match)) {
701
703
if (!should_continue && component_seen (w, from_match, i)) {
702
704
continue ;
0 commit comments