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.

Fun with convex polygons

49 pointsby MetallicCloudabout 13 years ago

4 comments

ahelwerabout 13 years ago
If the polygon is self-intersecting, the area around which the algorithm traverses the edges clockwise will be subtracted from the rest of the area traversed counter-clockwise. While interesting, I have yet to find this fact actually useful.<p>Edit: for more fun with polygons, check out Pick's theorem [1].<p>Since I'm guessing that pretty much everyone on this site has a copy of CLRS, the Selected Topics chapter on Computational Geometry has a good overview of cross product tricks. The convex hull algorithms are also interesting, useful, and very simple to learn.<p>If you're finished with that and are actually still interested, look at the Rotating Calipers method. It's a way of addressing all antipodal pairs of a given polygon, which serves as the basis for a whole whack of algorithms. Example - finding the narrowest rotation of a polygon. Some of you may recognize this as the solution to the last (and easiest) problem at the 2011 ICPC world finals [2].<p>[1] <a href="http://en.wikipedia.org/wiki/Pick%27s_theorem" rel="nofollow">http://en.wikipedia.org/wiki/Pick%27s_theorem</a><p>[2] (PDF) <a href="https://cm.baylor.edu/ICPCWiki/attach/Problem%20Resources/2011WorldFinalProblemSet.pdf" rel="nofollow">https://cm.baylor.edu/ICPCWiki/attach/Problem%20Resources/20...</a>
jacobolusabout 13 years ago
All of these sorts of things start making a lot more obvious intuitive sense when you learn some basic “geometric algebra”. See e.g. <a href="http://news.ycombinator.com/item?id=3284160" rel="nofollow">http://news.ycombinator.com/item?id=3284160</a>
shastaabout 13 years ago
The area method works with non-convex polyons, too. Not sure why he thinks it won't. See <a href="http://en.m.wikipedia.org/wiki/Shoelace_formula" rel="nofollow">http://en.m.wikipedia.org/wiki/Shoelace_formula</a>.
评论 #3774114 未加载
评论 #3774269 未加载
adrianNabout 13 years ago
Computational geometry algorithms are often fairly easy to explain, but implementing them robustly in quite tricky. Not only are there many edge cases, you also need to do your calculations with arbitrary precision (at least sometimes) [1]. You're generally much better off to use some library like CGAL [2] instead of rolling your own.<p>[1] <a href="http://www.mpi-inf.mpg.de/~mehlhorn/ftp/classroomExamplesNonrobustness.pdf" rel="nofollow">http://www.mpi-inf.mpg.de/~mehlhorn/ftp/classroomExamplesNon...</a><p>[2] <a href="http://www.cgal.org/" rel="nofollow">http://www.cgal.org/</a>
评论 #3774955 未加载