Home |

# Overview

The Clipper Library has been designed to perform boolean operations on polygons and polygon offsetting.
Several features set it apart from other clipping libraries:

- it accepts all types of polygons including self-intersecting ones
- it supports multiple polygon filling rules (EvenOdd, NonZero, Positive, Negative)
- it's very fast relative to other libraries
- it can perform polygon offsetting
- it's numerically robust
- it's free to use in both freeware and commercial applications

Author & copyright:
Angus Johnson. Copyright © 2010-2013
License, terms and conditions: Boost Software License

Terminology:

- Polygon Clipping: This commonly refers to the process of removing from a set of subject polygons, any polygons or parts of polygons that are outside a rectangular 'clipping' window. This can be achieved by intersecting the subject polygons with the clipping rectangle. In a more general sense, the clipping window need not be rectangular but can be any type of polygon, even multiple polygons. Also, while clipping typically refers to an intersection operation, in this documentation it will refer to any one of the four boolean operations (intersection, union, difference and exclusive-or).
- Polygon: A sequence of vertices defining a single closed path, irrespective of whether it represents an outer or inner boundary to a brush filling region. Polygon is also the name of a data structure representing a sequence of vertices.
- Contour: Synonymous with polygon.
- Hole Polygon (hole): Refers to a polygon that's entirely within an outer polygon and defines an inner boundary to brush filling. The specified filling rule determines whether a polygon is a hole or another outer polygon. With NonZero filling, holes must have reverse orientations to outers. With Even-Odd filling, holes are determined simply by their locations relative to other polygons such that outers contain holes and holes contain outers. This term is generally used in contexts where polygons do not intersect (eg in solutions to clipping operations).

Distribution package contents:
The ZIP package contains the Clipper library's source code, a Windows CHM help file, HTML help, and a number of compiled demo applications (with full source code). The library was initially written in Delphi Pascal (and compiles with Delphi version 7 or above) but now contains C++, C# and Python translations too. The library's source code in each language is a little under 4000 lines. The Delphi code contains reasonably extensive comments, but comments are fewer in the C++ and C# code. The included sample applications show how Clipper can be used with the different languages using a number of graphics display libraries including - AGG, Cairo, OpenGL, Graphics32, GDI+ and SVG.
Download Link:
SourceForge
References:
The 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.
A section in "Computer graphics and geometric modeling: implementation and algorithms" by By Max K. Agoston (Springer, 2005) discussing Vatti Polygon Clipping was also helpful in creating the initial Clipper implementation.
The paper titled "Polygon Offsetting by Computing Winding Numbers" by Chen & McMains (Paper no. DETC2005-85513, ASME 2005. Pages 565-575) contains helpful discussion on the complexities of polygon offsetting together with some solutions.

## See Also

Source, License, Clipper, OffsetPolygons, Orientation, ClipType, PolyFillType, Polygon

Copyright ©2010-2013 Angus Johnson - Clipper version 5.1.5 - Help file built on 6-May-2013