A Speculative Approach to Clipping Line Segments

  • Frank Dévai
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3980)


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.


Line Segment Clock Cycle Edge Region Corner Region Valid Intersection 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Blinn, J.F.: A trip down the graphics pipeline: Line clipping. IEEE Computer Graphics & Applications 11(1), 98–105 (1991)CrossRefGoogle Scholar
  2. 2.
    Cyrus, M., Beck, J.: Generalised two- and three-dimensional clipping. Computers & Graphics 3(1), 23–38 (1978)CrossRefGoogle Scholar
  3. 3.
    Day, J.D.: A new two dimensional line clipping algorithm for small windows. Computer Graphics Forum 11(4), 241–245 (1992)CrossRefGoogle Scholar
  4. 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
  5. 5.
    Dévai, F.: Analysis of the Nicholl-Lee-Nicholl algorithm. In: Gervasi, O., Gavrilova, M.L., Kumar, V., Laganá, A., Lee, H.P., Mun, Y., Taniar, D., Tan, C.J.K. (eds.) ICCSA 2005. LNCS, vol. 3480, pp. 726–736. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  6. 6.
    Duvanenko, V.J., Gyurcsik, R.S., Robins, W.E.: Simple and efficient 2D and 3D span clipping algorithms. Computers & Graphics 17(1), 39–54 (1993)CrossRefGoogle Scholar
  7. 7.
    Liang, Y.D., Barsky, B.A.: A new concept and method for line clipping. ACM Transactions on Graphics 3(1), 1–22 (1984)MATHCrossRefGoogle Scholar
  8. 8.
    Nicholl, T.M., Lee, D.T., Nicholl, R.A.: An efficient new algorithm for 2-D line clipping: its development and analysis. Comput. Graph. 21(4), 253–262 (1987)CrossRefGoogle Scholar
  9. 9.
    Slater, M., Barsky, B.A.: 2D line and polygon clipping based on space subdivision. The Visual Computer 10(1), 407–422 (1994)CrossRefGoogle Scholar
  10. 10.
    Foley, J.D., van Dam, A., Feiner, S.K., Hughes, J.F.: Computer Graphics: Principles and Practice, 2nd edn. Addison-Wesley, Reading (1996)MATHGoogle Scholar
  11. 11.
    Hearn, D., Baker, P.: Computer Graphics with OpenGL, 3rd edn. Prentice Hall, Englewood Cliffs (2004)Google Scholar
  12. 12.
    Skala, V.: An efficient algorithm for line clipping by convex polygon. Computers & Graphics 17(4), 417–421 (1993)CrossRefGoogle Scholar
  13. 13.
    Knuth, D.E.: Sorting and Searching. In: The Art of Computer Programming, vol. 3. Addison-Wesley, Reading (1973)Google Scholar
  14. 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
  15. 15.
    Rabin, M.O.: Probabilistic algorithms for testing primality. Journal of Number Theory 12, 128–138 (1980)MATHCrossRefMathSciNetGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Frank Dévai
    • 1
  1. 1.London South Bank UniversityLondonUK

Personalised recommendations