• 中国计算机学会会刊
  • 中国科技核心期刊
  • 中文核心期刊

计算机工程与科学

• 论文 • 上一篇    下一篇

基于sign(x)函数的点在多边形内外判别算法及应用

孙爱玲,赵光华,赵敏华,常璐   

  1. (西安建筑科技大学信息与控制工程学院,陕西 西安 710055)
  • 收稿日期:2015-10-14 修回日期:2016-01-31 出版日期:2017-04-25 发布日期:2017-04-25
  • 基金资助:

    西安市工业应用技术研发项目(CXY1122(2));陕西省自然科学基金青年基金 (2013JQ8003);陕西省教育厅科研计划项目(12JK1007)

A  sign(x) point in-out polygon test algorithm
based on sign function and its application

SUN Ai-ling,ZHAO Guang-hua,ZHAO Min-hua,CHANG Lu   

  1. (School of Information and Control Engineering,Xi’an University of Architecture and Technology,Xi’an 710055,China)
  • Received:2015-10-14 Revised:2016-01-31 Online:2017-04-25 Published:2017-04-25

摘要:

在对已有的点与多边形位置关系判断算法分析与研究的基础之上,提出一种新的判断点在多边形内外的算法。该算法用三维空间来解决二维平面问题,将二维平面内的点看作是三维空间在平面上的点,从而得出简单的待判断点与多边形顶点之间的坐标关系式。由于符号函数仅仅有三个值,巧妙地利用符号函数的特殊性来表示待判断点与多边形的顶点之间的坐标关系。最终,可以简单地由符号函数之和判断点是否位于多边形内部。程序验证表明,该算法简单、易于实现。同时,将该算法应用于基于RTK GPS定位技术的机动车驾驶证申领场地考试系统中,结果表明,判断准确率高,且实时性好。

关键词: 多边形, 点, 坐标关系, 符号函数

Abstract:

By studying and analyzing a number of existing methods for point in-out polygon tests, we propose a new algorithm for point in-out polygon tests. This algorithm solves the two-dimensional problem in three-dimensional space. We regard the point in the two-dimensional space as a point of the three-dimensional space, hence obtaining simple coordinate relations between the point and the polygon vertices. Since the sign function only has three values, we particularly use the sign function to record the coordinate relation between the point and the polygon vertices. In the end, we can use the sum of sign function to determine whether the point is in the polygon or not. Software implementation verifies the simplicity and efficiency of the proposed algorithm. This algorithm is applied to a field test system of driving license based on the RTK GPS positioning technology, and the results show that the judgment accuracy of point in-out polygon tests is high, and the real-time performance is satisfactory.

Key words: polygon, point, coordinate relations, sign function