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

Method FindClosestCodirectionalEdge

libs/routing/index_router.cpp:1237–1264  ·  view source on GitHub ↗

static

Source from the content-addressed store, hash-verified

1235
1236// static
1237bool IndexRouter::PointsOnEdgesSnapping::FindClosestCodirectionalEdge(m2::PointD const & point,
1238 m2::PointD const & direction,
1239 vector<EdgeProjectionT> const & candidates,
1240 Edge & closestCodirectionalEdge)
1241{
1242 double constexpr kInvalidDist = numeric_limits<double>::max();
1243 double squareDistToClosestCodirectionalEdgeM = kInvalidDist;
1244
1245 IndexRouter::BestEdgeComparator bestEdgeComparator(point, direction);
1246 if (!bestEdgeComparator.IsDirectionValid())
1247 return false;
1248
1249 for (auto const & c : candidates)
1250 {
1251 auto const & edge = c.first;
1252 if (!bestEdgeComparator.IsAlmostCodirectional(edge))
1253 continue;
1254
1255 double const distM = bestEdgeComparator.GetSquaredDist(edge);
1256 if (distM >= squareDistToClosestCodirectionalEdgeM)
1257 continue;
1258
1259 closestCodirectionalEdge = edge;
1260 squareDistToClosestCodirectionalEdgeM = distM;
1261 }
1262
1263 return squareDistToClosestCodirectionalEdgeM != kInvalidDist;
1264}
1265
1266bool IndexRouter::PointsOnEdgesSnapping::FindBestSegments(m2::PointD const & checkpoint, m2::PointD const & direction,
1267 bool isOutgoing, vector<Segment> & bestSegments,

Callers

nothing calls this directly

Calls 3

IsDirectionValidMethod · 0.80
IsAlmostCodirectionalMethod · 0.80
GetSquaredDistMethod · 0.80

Tested by

no test coverage detected