arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1305.4573cs.CG
收藏

用最少内存纠正自相交多边形一种简单有效的线段求交算法及思考

Correcting self-intersecting polygons using minimal memory A simple and efficient algorithm and thoughts on line-segment intersection algorithms

Jean Souviron

摘要:

虽然列出线段列表或复杂多边形的交点的众所周知的方法旨在实现最佳时间复杂度,但它们通常以内存消耗和复杂代码为代价。然而,现实生活中的软件优化在于同时优化速度和内存使用以及保持代码简单。本文首先提出了一些想法,在内存使用方面的可用算法,导致一个非常简单的扫描线为基础的算法,旨在回答这一挑战。虽然在速度方面是次优的,但如果将速度和存储器空间结合在一起,则是最优的,并且非常容易实现。对于N个线段和k个交点,它只使用了N个额外的整数,并在O(N^1.26)内列出交点,或者平均最多在O((N+k)N^0.26)内纠正它们,并且很有可能在0.16左右甚至低到0.1。因此,它非常适合包含在较大的软件中,似乎是一个很好的妥协。时间复杂度为O(N^2)。然后,本文将重点讨论现有的方法和暴力算法之间的差异,并提出了解决方案。虽然次优,它的应用主要是以快速的方式回答一些分散的不相关的交叉查询,使用最小的复杂性和额外的资源。

英文摘要:

While well-known methods to list the intersections of either a list of segments or a complex polygon aim at achieving optimal time-complexity they often do so at the cost of memory comsumption and complex code. Real-life software optimisation however lies in optimising at the same time speed and memory usage as well as keeping code simple. This paper first presents some thoughts on the available algorithms in terms of memory usage leading to a very simple scan-line-based algorithm aiming at answering that challenge. Although sub-optimal in terms of speed it is optimal if both speed and memory space are taken together and is very easy to implement. For N segments and k intersections it uses only N additional integers and lists the intersections in O(N^1.26) or corrects them in O((N+k) N^0.26) at most in average, with a high probability of a much lower exponent around 0.16 and even as low as 0.1. It is therefore well adapted for inclusion in larger software and seems like a good compromise. Worst-case is in O(N^2). Then the paper will focus on differences between available methods and the brute-force algorithm and a solution is proposed. Although sub-optimal its applications could mainly be to answer in a fast way a number of scattered unrelated intersection queries using minimal complexity and additional resources.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑