Template Function lanelet::geometry::findNearest(PrimitiveLayer<PrimT>&, const BasicPoint2d&, unsigned)
Defined in File LaneletMap.h
Function Documentation
-
template<typename PrimT>
std::vector<std::pair<double, PrimT>> lanelet::geometry::findNearest(PrimitiveLayer<PrimT> &map, const BasicPoint2d &pt, unsigned count) returns the nearest n primitives to a point.
Other than than LaneletLayer::nearest, this returns the actually closest primitives, not only the closest bounding boxes. This comes at a slightly higher cost, because more primitives from the R-Tree need to be checked.
See also
findWithin2d, findWithin3d
Example:
std::vector<std::pair<double, Lanelet>> closeLanelets = findNearest(laneletMap.laneletLayer, BasicPoint2d(1,0), 5);
- Returns:
vector of the n closest primitives together with their distance in 2D space in ascending order.