A Speculative Approach to Clipping Line Segments
The Nicholl-Lee-Nicholl (NLN) algorithm for clipping line segments against a rectangular window in the plane (Computer Graphics 21,4 pp 253–262) was proved to be optimal recently in terms of the minimum and maximum number of comparisons and the number of predicates used. A new algorithm is proposed that does not use predicates, but calculates intersections speculatively. Surprisingly, this approach not only leads to a much simpler algorithm, but also takes fewer operations in many cases, including the worst case. It is proved that the new algorithm never takes more operations than the optimal algorithm. Experimental results demonstrate that the new algorithm is 80% to 560% faster than long-established, widely known algorithms.
KeywordsLine Segment Clock Cycle Edge Region Corner Region Valid Intersection
Unable to display preview. Download preview PDF.
- 4.Dévai, F.: An analysis technique and an algorithm for line clipping. In: Proc. 1998 IEEE Conference on Information Visualization, IV 1998, pp. 157–165 (1998)Google Scholar
- 11.Hearn, D., Baker, P.: Computer Graphics with OpenGL, 3rd edn. Prentice Hall, Englewood Cliffs (2004)Google Scholar
- 13.Knuth, D.E.: Sorting and Searching. In: The Art of Computer Programming, vol. 3. Addison-Wesley, Reading (1973)Google Scholar
- 14.Alford, W.R., Granville, A., Pomerance, C.: On the difficulty of finding reliable witnesses. LNCS, vol. 877, pp. 1–16. Springer, Heidelberg (1995)Google Scholar