tripkit-android / com.skedgo.tripkit.common.util / PolyUtil / locationIndexOnEdgeOrPath
locationIndexOnEdgeOrPath
open static fun locationIndexOnEdgeOrPath(point:
TripKitLatLng
!, poly:
MutableList
<
TripKitLatLng
!>!, closed:
Boolean
, geodesic:
Boolean
, toleranceEarth:
Double
):
Int
Computes whether (and where) a given point lies on or near a polyline, within a specified tolerance. If closed, the closing segment between the last and first points of the polyline is not considered.
Parameters
point
- TripKitLatLng!: our needle
poly
- MutableList<TripKitLatLng!>!: our haystack
closed
- Boolean: whether the polyline should be considered closed by a segment connecting the last point back to the first one
geodesic
- Boolean: the polyline is composed of great circle segments if geodesic is true, and of Rhumb segments otherwise
toleranceEarth
- Double: tolerance (in meters)
Return Int: -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]