Skip to main content
Log in

An efficient algorithm for line and polygon clipping

  • Published:
The Visual Computer Aims and scope Submit manuscript

Abstract

We present an algorithm for clipping a polygon or a line against a convex polygonal window. The algorithm demonstrates the practicality of various ideas from computational geometry. It spendsO(logp) time on each edge of the clipped polygon, wherep is the number of window edges, while the Sutherland-Hodgman algorithm spendsO(p) time per edge. Theoretical and experimental analyses show that the constants involved are small enough to make the algorithm competitive even for windows with four edges. The algorithm enables image-space clipping against windows whose boundaries are convex spline curves. The paper contains detailed pseudo-code implementation of the algorithm and an adaptation of the simulation of simplicity method for handling degenerate cases.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  • Chazelle B, Dobkin D (1987) Intersection of convex objects in two and three dimensions. J ACM 34(1):1–27

    Article  Google Scholar 

  • Edelsbrunner H (1987) Algorithms in combinatorial geometry )EATCS monographs on theoretical computer science). Springer, Berlin Heidelberg New York

    Google Scholar 

  • Edelsbrunner H, Mücke EP (1988) Simulation of simplicity: a technique to cope with degenerate cases in geometric algorithms. 4th ACM Symp Proc, Computational Geometry, pp 118–133

  • Foley J, Van Dam A (1982) Fundamentals of Interactive Computer Graphics. Addison-Wesley, Reading, Mass

    Google Scholar 

  • Hoffmann CM (1989) The problems of accuracy and robustness in geometric computations. IEEE Computer 22(3):31–42

    Google Scholar 

  • Hoffmann K, Mehlhorn K, Rosenstiehl P, Tarjan R (1986) Sorting Jordan sequences in linear time using level-linked search trees. Inf Control 68(1–3):170–184

    Article  Google Scholar 

  • Liang Y, Barsky B (1983) An analysis and algorithm for polygon clipping. Commun ACM 26(11):868–877

    Article  Google Scholar 

  • Newman WM, Sproull RF (1979) Principles of interactive computer graphics, 2nd edn. McGraw-Hill, New York

    Google Scholar 

  • Nicholl TM, Lee DT, Nicholl RA (1987) An efficient new algorithm for 2-D line clipping: its development and analysis. SIGGRAPH '87 Conf Proc. Computer Graphics 21(4):253–262

    Google Scholar 

  • Preparata F, Shamos MI (1985) Computational geometry: an introduction. Springer, Berlin Heidelberg New York

    Google Scholar 

  • Requicha AG, Voelcker HB (1985) Boolean operations in solid modeling: boundary evaluation and merging algorithms. Proc IEEE 73(1):30–44

    Google Scholar 

  • Sproull RF, Sutherland IE (1968) A clipping divider (Fall Joint Computer Conf Proc). Thompson Books, Washington, DC, pp 765–775

    Google Scholar 

  • Sutherland IE, Hodgman GW (1974) Reentrant polygon clipping. Commun ACM 17(1):32–42

    Article  Google Scholar 

  • Weiler K, Atherton P (1977) Hidden surface removal using polygon area sorting. SIGGRAPH '77 Conf Proc. Computer Graphics 11(2):214–222

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

About this article

Cite this article

Rappoport, A. An efficient algorithm for line and polygon clipping. The Visual Computer 7, 19–28 (1991). https://doi.org/10.1007/BF01994114

Download citation

  • Issue Date:

  • DOI: https://doi.org/10.1007/BF01994114

Key words

Navigation