Polarith AI
1.8

◆ GetNearestEdge() [1/2]

static int GetNearestEdge ( IList< Vector3 >  polygon,
Vector3  point,
float  maxDistance = Mathf.Infinity,
int  startEdgeIndex = 0 
)
static

Computes the edge of the given polygon which is nearest to the given point .

The edges are obtained by the collection of points called polygon . It is assumed that the path points are sorted.

Parameters
polygonSorted list of polygon points.
pointPoint relative to the path
maxDistanceHeuristic maximum distance a point must have to an edge for being considered as solution immediately (optional).
startEdgeIndexDetermines the edge index where to start the algorithm (optional).
Returns
Index of the edge nearest to the given point .
Imprint