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

Function GetPrevInSegmentRoutePoint

libs/routing/turns_generator.cpp:191–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189}
190
191bool GetPrevInSegmentRoutePoint(IRoutingResult const & result, RoutePointIndex const & index,
192 RoutePointIndex & nextIndex)
193{
194 if (index.m_pathIndex == 0)
195 return false;
196
197 auto const & segments = result.GetSegments();
198 if (segments[index.m_segmentIndex].m_path.size() >= 3 &&
199 index.m_pathIndex < segments[index.m_segmentIndex].m_path.size() - 1)
200 {
201 double const oneSegmentTurnAngle = CalcPathTurnAngle(segments[index.m_segmentIndex], index.m_pathIndex);
202 CarDirection const oneSegmentDirection = IntermediateDirection(oneSegmentTurnAngle);
203 if (!IsGoStraightOrSlightTurn(oneSegmentDirection))
204 return false; // Too sharp turn angle.
205 }
206
207 nextIndex = {index.m_segmentIndex, index.m_pathIndex - 1};
208 return true;
209}
210
211bool GetNextRoutePointIndex(IRoutingResult const & result, RoutePointIndex const & index, NumMwmIds const & numMwmIds,
212 bool const forward, RoutePointIndex & nextIndex)

Callers 1

GetNextRoutePointIndexFunction · 0.85

Calls 4

CalcPathTurnAngleFunction · 0.85
IntermediateDirectionFunction · 0.85
IsGoStraightOrSlightTurnFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected