Poly2Tri介绍[转]
https://blog.csdn.net/xys206006/article/details/83002326
这是Poly2Tri介绍的翻译博文。
原文链接:http://sites-final.uclouvain.be/mema/Poly2Tri/poly2tri.html
引言
三角化算法一直是** 计算几何(computational geometry)** 方向的研究热点。
前人研究发展如下表所示:
前人对三角化算法总结链接:http://vterrain.org/Implementation/Libs/triangulate.html
- 计算几何领域通常认定三种最常用的算法:
- Recursive Ear Cutting algorithm,由ElGindy, Everett and Toussaint提供[1]
- Sweep Line algorithm,由 Garey等提供[2]
- Incremental Randomized Algorithm,由Sediel[3]和Amato[4]提供
- 三种算法比较:
-
- recursive ear cutting algorithm最容易实现,但是性能最糟,并且难以扩展到存在洞的多边形情况
-
- incremental randomized algorith性能可能是最好的,但是难以实现
-
- sweep line algorithm相对来说,性能中和,使用更为广泛
Sweep Line Algorithm
Mark de Berg, Marc van Kreveld, Mark Overmars, and Otfried Schwarzkopf and J. O’Rourke 等人总结了Sweep Line Algorithm,详见引用[5] [6]
- Sweep Line Algorithm基本策略:
- 将多变形分割成按照y方向单调排序(y-monotone)小多边形,时间复杂度为O(nlog(n))
- 再三角化这些顶点,时间复杂度是线性的
为了将多变形单调化(monotone),需要将多变形顶点分成5种类型:开始顶点(start vertex)、结束顶点(end vertex)、分割顶点(split vertex)、合并顶点(merge vertex)、规则顶点(regular vertex)。原文作者为了容易实现这个算法,又将规则顶点分为规则向下的顶点(regular down)和规则向上的顶点(regular up),如下图1.a所示。作者对此种分法的解释如下:多变形顶点顺时针组织,洞的方向也是顺时针,内部的多变形肯定位于外部多边形规则向上的点的左边,而位于规则向下的点的右边,这样约定,在实现中对一些判断不需要额外的计算和存储。
A polygon can be partitioned to monontone pieces by getting rid of its split or merge vertices (adding diagonals). When a diagonal is inserted, an auxliary diagonal is inserted at the same time on the opposite direction for monotone piece searching purpose (all monotone pieces can be easily constructed by these auxiliary diagonals since each diagonal is always shared by two adjacent monontone pieces), see Figure 1.b. Specificly, for each split vertex vi, a diagonal is inserted to the lowest vertex above it. On the contrary, for each merge vertex, a diagonal is inserted to the highest vertex below it. This lowest/highest vertex is often called helper of directly left edge of vi.
Poly2Tri算法例子
还有更多的例子,可点击原文链接查看
引用
- G. Toussaint, Efficient triangulation of simeple polygons.
- Garey, et al, Triangulating a simple polygon, Information Processing Letters, vol. 7 no. 4, 1978).
- R. Seidel, A simple and fast incremental randomized algorithm for computing trapezoidal decompositions and for triangulating polygons. Comput. Geom. Theory Appl., 1(1):51-64, 1991.
- Nancy M.A., Michael T.G., Edgar, A.R., Linear-time Triangulation of a simple Polygon Made easier Via Randomization, 2000.
- Mark de Berg, Marc van Kreveld, Mark Overmars, and Otfried Schwarzkopf, Computational Geometry: Algorithms and Applications, 2nd Edition
- J. O’Rourke, Computational in C, 2nd Edition.