Overview

The Clipper Library

Overview

The Clipper Library is based on but significantly extends Bala Vatti's polygon clipping algorithm as described in "A generic solution to polygon clipping", Communications of the ACM, Vol 35, Issue 7 (July 1992) pp 56-63.

The library can perform each of the four boolean clipping operations - intersection, union, difference and exclusive-or (xor). It can accept any number of, and any type of polygon as input (including polygons with holes and self-intersecting polygons).

Clipper's ZIP package contains the core library, a Windows CHM help file, HTML help, and a number of compiled examples. The library's code was initially written in Delphi Pascal (compiling in Delphi ver. 7+) but now contains C++ and C# translations too. The core library's source code in each language is a little over 3500 lines (including extensive comments), with a file size of about 100KB. The examples show how Clipper can be used with the different languages using a number of graphics libraries including - AGG, Cairo, OpenGL, Graphics32 and GDI+.

Several features set Clipper apart from other polygon clipping libraries:

  1. it's very fast compared to other libraries
  2. the ability to handle self-intersecting polygons
  3. it's free, under its Boost license, to use in both freeware and commercial applications.
  4. support for EvenOdd, NonZero, Positive and Negative polygon filling modes.
  5. ability to perform polygon offsetting.


See Also

Source, License, Clipper