作者投稿和查稿 主编审稿 专家审稿 编委审稿 远程编辑

计算机工程 ›› 2012, Vol. 38 ›› Issue (5): 30-34. doi: 10.3969/j.issn.1000-3428.2012.05.007

• 专栏 • 上一篇    下一篇

一种改进的点在多边形内外判断算法

李楠,肖克炎   

  1. (中国地质科学院矿产资源研究所,北京 100037)
  • 收稿日期:2011-09-23 出版日期:2012-03-05 发布日期:2012-03-05
  • 作者简介:李 楠(1980-),男,工程师、博士,主研方向:地理信息工程,地图制图学;肖克炎,研究员、博士生导师
  • 基金资助:

    国家自然科学基金资助项目(41002119);国家“863”计划基金资助项目(2006AA06Z114);国家科技支撑计划基金资助项目(2006BAB01A01);中央级公益性科研院所基本科研业务费专项基金资助项目

Improved Judgment Algorithm of Point In-out Polygon

LI Nan, XIAO Ke-yan   

  1. (Institute of Mineral Resources, Chinese Academy of Geological Sciences, Beijing 100037, China)
  • Received:2011-09-23 Online:2012-03-05 Published:2012-03-05

摘要:

为解决多边形内外算法中BSP树退化为链表的问题,提出一种改进的点在多边形内外的判断算法。在构建水平扫描线的BSP树之前,对水平扫描线按照Y值进行排序,将排好序的水平扫描线按照二分法的顺序插入到BSP树中,其查找时间复杂度为O(lbn)。实验结果表明,该算法在不增加BSP构建时间复杂度的前提下,能够保证BSP树的查找效果总是最优的,且简单易行,具有较好的通用性。

关键词: BSP树, 平衡二叉树, 任意简单多边形, 二分查找, 快排序

Abstract:

For settling a problem that Binary Space Partition(BSP) tree of in-out polygon algorithm degenerates into line list, this paper presents an improved judgment algorithm of point in-out polygon. The algorithm sorts Y value per node in polygon. It travels all horizon lines by way of binary. BSP tree is always balance binary tree. The time complexity of the BSP-Tree searching is O(lbn). Experimental results show that the improved algorithm makes sure that time complexity for the query of binary space partition trees is always high efficient while time complexity for the construction of BSP trees does not increase. Meanwhile, it has good versatility.

Key words: Binary Space Partition(BSP) tree, balanced binary tree, arbitrary simple polygon, binary search, quick sort

中图分类号: