Skip to content

Commit

Permalink
Merge pull request #1613 from Karry/lane-turn-fix
Browse files Browse the repository at this point in the history
fix lane turns evaluation
  • Loading branch information
Framstag authored Oct 3, 2024
2 parents 8423c49 + efe0a56 commit ef07073
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions libosmscout/src/osmscout/routing/RoutePostprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1839,9 +1839,18 @@ namespace osmscout {

// detect what all allowed turns have common
// keep in mind that laneTurns may have removed directions used by exits, it is benefitial here
uint32_t suggestedTurnBits = TurnToBits(laneTurns[allowedLaneFrom]);
uint32_t suggestedTurnBits;
if (allowedLaneFrom < int(laneTurns.size())) {
suggestedTurnBits = TurnToBits(laneTurns[allowedLaneFrom]);
} else {
suggestedTurnBits = TurnToBits(LaneTurn::Unknown);
}
for (int i = allowedLaneFrom + 1; i <= allowedLaneTo; i++) {
suggestedTurnBits &= TurnToBits(laneTurns[i]);
if (i < int(laneTurns.size())) {
suggestedTurnBits &= TurnToBits(laneTurns[i]);
} else {
suggestedTurnBits &= TurnToBits(LaneTurn::Unknown);
}
}
// evaluate suggested direction from lane turns
Bearing relativeBearing = nextNodeBearing - (prevNodeBearing + Bearing::Radians(M_PI)); // relative to straight direction
Expand Down

0 comments on commit ef07073

Please sign in to comment.