计算机应用 ›› 2012, Vol. 32 ›› Issue (11): 3164-3167.DOI: 10.3724/SP.J.1087.2012.03164

• 图形图像处理 • 上一篇    下一篇

用最小回路求两个简单多边形的交、并、差集

赵军,刘荣珍   

  1. 兰州交通大学 机电工程学院, 兰州 730070
  • 收稿日期:2012-05-23 修回日期:2012-07-21 发布日期:2012-11-12 出版日期:2012-11-01
  • 通讯作者: 赵军
  • 作者简介:赵军 (1975-),男,甘肃古浪人,副教授,博士,主要研究方向:计算机视觉、模式识别;刘荣珍(1968-),女,山西河津人,教授,主要研究方向:图学理论、计算机图形学。
  • 基金资助:
    国家自然科学基金资助项目(11102124);甘肃省自然科学基金项目资助项目(1107RJZA216)

Resolving intersection, union and difference of two simple polygons based on minimum circle

ZHAO Jun,LIU Rong-zhen   

  1. School of Mechatronic Engineering, Lanzhou Jiaotong University, Lanzhou Gansu 730070,China
  • Received:2012-05-23 Revised:2012-07-21 Online:2012-11-12 Published:2012-11-01
  • Contact: ZHAO Jun
  • Supported by:
    ;the Science Foundation of Gansu

摘要: 针对求两个简单多边形交、并、差集问题,提出一种基于最小回路的新算法。首先,将初始多边形P和Q初始化为逆时针方向,并将两个多边形交点处的关联边排序。然后,从各个交点出发利用最小转角法搜索最小回路,并根据这些最小回路中包含P和Q边的方向性对它们进行分类。最终,不同类别的最小回路将对应P和Q的交、并、差集。算法的时间复杂度为O((n+m+k)logd),其中n、m 分别是P和Q的顶点数,k是两多边形的交点数,d为将多边形分割的单调链数。算法几何意义明显,对于多边形布尔运算中的重合顶点、重合边等奇异情形,具有较好的适应性。

关键词: 多边形, 顶点, 最小回路, 布尔运算

Abstract: A new algorithm for Boolean operation of two simple polygons based on minimum circle was presented. Polygon P and Q were initialized to counterclockwise direction, and the edges connecting to each intersection point of P and Q were arranged in sequential order. Then, all minimum circles were found using the minimum turning angle rule. These minimum circles were classified according to edges direction in P and Q. Intersection, union, and difference of the two polygons are corresponding to different kinds of minimum circles. The algorithm run in time O((n+m+k)logd) in a worst presented case, where n and m were the vertex numbers of the two polygons respectively, k was the numbers of intersection points, and d was the number of polygon’s monotonic chain. The algorithm has explicit geometric significance, and well resolves the problems in special cases,such as overlapped edges, and operation edges intersection at the vertex of edges.

Key words: polygon, vertex, minimum circle, Boolean

中图分类号: