打破一个矩形随机形的多边形 [英] Break a rectangle into randomly shaped polygons
问题描述
正如标题所说,我需要打破一个矩形随机形的多边形。
Just like the title says, I need to break a rectangle into randomly shaped polygons.
例如,7个多边形:
+--------+--------+
|\ | 2 |
| \ 1 |''--..__|
| ------| 5 |
| 3 / \________|
| / /\ 6 |
|__/ 4 / \______|
| / 7 |
+-----+-----------+
我不知道是否有一个算法已经在那里了,但我似乎无法让我的头,围绕这一点。
I don't know if there's an algorithm already out there for this, but I can't seem to get my head around this.
我并不特别在意你回答的是什么语言,但我会实施的Java / Swing的。
I don't particularly care what language you answer in, but I'll be implementing in Java/Swing.
推荐答案
您可能下降的矩形一串随机点,并计算Voronoi图。
You may drop a bunch of random points on the rectangle, and calculate the Voronoi Diagram.
<一个href="http://read.pudn.com/downloads154/source$c$c/graph/683326/delaunay/DelaunayAp.java__.htm">Here是一个Java / Swing实现。
我做了一些样品(但使用Mathematica ,而不是上面的实现)
I did some samples (but using Mathematica, not the above implementation)
心连心!
这篇关于打破一个矩形随机形的多边形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!