locationIndexOnPathTolerance static method

int locationIndexOnPathTolerance(
  1. Point<double> point,
  2. List<Point<double>> poly,
  3. bool geodesic,
  4. double tolerance,
)

Computes whether (and where) a given point lies on or near a polyline, within a specified tolerance. The polyline is not closed -- the closing segment between the first point and the last point is not included.

point our needle

poly our haystack

geodesic the polyline is composed of great circle segments if geodesic is true, and of Rhumb segments otherwise

tolerance tolerance (in meters)

Returns -1 if point does not lie on or near the polyline.

0 if point is between poly[0] and poly[1] (inclusive),

1 if between poly[1] and poly[2],

poly.size()-2 if between poly[poly.size() - 2] and poly[poly.size() - 1]

Implementation

static int locationIndexOnPathTolerance(Point<double> point,
        List<Point<double>> poly, bool geodesic, double tolerance) =>
    locationIndexOnEdgeOrPath(point, poly, false, geodesic, tolerance);