MCPcopy Create free account
hub / github.com/comaps/comaps / CorrectGoStraight

Function CorrectGoStraight

libs/routing/car_directions.cpp:360–372  ·  view source on GitHub ↗

! * \brief Corrects |turn.m_turn| if |turn.m_turn == CarDirection::GoStraight|. * If the other way is not sharp enough, turn.m_turn is set to |turnToSet|. */

Source from the content-addressed store, hash-verified

358 * If the other way is not sharp enough, turn.m_turn is set to |turnToSet|.
359 */
360void CorrectGoStraight(TurnCandidate const & notRouteCandidate, double const routeAngle, CarDirection const & turnToSet,
361 TurnItem & turn)
362{
363 if (turn.m_turn != CarDirection::GoStraight)
364 return;
365
366 // Correct turn if alternative cadidate's angle is not sharp enough compared to the route.
367 if (abs(notRouteCandidate.m_angle) < abs(routeAngle) + kMinAbsAngleDiffForStraightRoute)
368 {
369 LOG(LDEBUG, ("Turn: ", turn.m_index, " GoStraight correction."));
370 turn.m_turn = turnToSet;
371 }
372}
373
374// If the route goes along the rightmost or the leftmost way among available ones:
375// 1. RightmostDirection or LeftmostDirection is selected

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected