TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Finding a minimum polygon of a set of points

34 pointsby adamesqueabout 10 years ago

6 comments

chaoxuabout 10 years ago
The problem seems to be: find the smallest regular k-gon that covers all the points. (now, assume the total number of points is n, and k = O(n))<p>One can transform the problem to the following, and solve it in around O(n^7) time. <a href="http:&#x2F;&#x2F;dl.acm.org&#x2F;citation.cfm?id=73853" rel="nofollow">http:&#x2F;&#x2F;dl.acm.org&#x2F;citation.cfm?id=73853</a><p>There probably exist faster algorithm for this special case using smarter parametric search...
jbattleabout 10 years ago
The animation on wiki seems broken, but the gift wrapping algorithm is easy to understand and implement and gives good results (though different from what is presented here)...<p><a href="http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Gift_wrapping_algorithm" rel="nofollow">http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Gift_wrapping_algorithm</a>
评论 #9331246 未加载
TheLoneWolflingabout 10 years ago
I&#x27;m probably missing something, because I don&#x27;t see what&#x27;s so difficult about this.<p>You can do this as a &quot;rolling&quot; algorithm. Start with three points, defining a triangle. Then repeatedly add the next point.<p>To add a point, first check if it&#x27;s inside the (convex) polygon found so far. If it is, you&#x27;re done. Just continue to the next point to add.<p>If it isn&#x27;t, you walk along both directions along the (convex) polygon until you hit the first point that doesn&#x27;t violate the convexity constraint. (Just compare slopes of the lines between the next point and the target point, and the target point and the point to be added). Then just splice it in in place of the chunk removed.<p>Now, this isn&#x27;t particularly fast - O(n^3) I think, but it&#x27;s still faster than spinning up a LP solver.<p>(Again, I&#x27;m probably missing something.)
评论 #9330720 未加载
nilknabout 10 years ago
As far as I can tell, this is actually finding the smallest regular n-gon which contains n points.
stevenfabout 10 years ago
A simple, fast solution to this type of problem involves applying Welzl&#x27;s algorithm for an expected O(n polylog n) solution.
评论 #9331028 未加载
评论 #9330880 未加载
mattdeslabout 10 years ago
Related: <a href="https:&#x2F;&#x2F;github.com&#x2F;mikolalysenko&#x2F;alpha-shape" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mikolalysenko&#x2F;alpha-shape</a>
评论 #9331813 未加载