The minimum perimeter convex hull of a subset of a point set

前端 未结 4 1449
不思量自难忘°
不思量自难忘° 2021-02-07 09:06

Given n points on the plane. No 3 are collinear.

Given the number k.

Find the subset of k points, such that the convex hull of the k points has minimum perimeter

4条回答
  •  执笔经年
    2021-02-07 09:41

    In the planar case, you can use an algorithm known as the Jarvis march, which has worst case complexity O(n^2). In this algorithm, you start building a hull at an arbitrary point and then check which point needs to be added next. Pseudocode taken from wikipedia:

    jarvis(S)
       pointOnHull = leftmost point in S
       i = 0
       repeat
          P[i] = pointOnHull
          endpoint = S[0]         // initial endpoint for a candidate edge on the hull
          for j from 1 to |S|-1
             if (S[j] is on left of line from P[i] to endpoint)
                endpoint = S[j]   // found greater left turn, update endpoint
          i = i+1
          pointOnHull = endpoint
       until endpoint == P[0]      // wrapped around to first hull point
    

    As far as I understand it, convex hulls are unique to each set of points, so there is no need to find a minimum. You just find one, and it will be the smallest one by definition.

    Edit

    The posted solution solves for the convex hull with the fewest number of points. Any hull with more points will have a longer perimeter, and I misunderstood the question to seeking a minimum perimeter, instead of a minimum perimeter for a set with K points.

    This new problem is probably NP as suspected, and most similar to the longest path problem. Unfortunately, I lack the ingenuity to provide a worthwhile reduction.

提交回复
热议问题