Function nearestPointOnPolygon

  • Parameters

    • polygon: [number, number][]

      an array of points (which are arrays of numbers)

    • point: [number, number]

      the point to test nearness to

    Returns any

    a point edge index matches vertices such that edge(N) = [vert(N), vert(N + 1)]

    Description

    given a polygon and a point, in 2D, find a point on the boundary of the polygon that is closest to the provided point.