Home |

The **Clipper Library** performs **clipping**, and **offsetting** of both lines and polygons.

A number of features set Clipper 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's numerically robust
- it also performs line and polygon offsetting
- it's free to use in both freeware and commercial applications

**Current Version:** 6.2.0

**Author & copyright:**

Angus Johnson. Copyright © 2010-2014

License, terms and conditions: Boost Software License

**Terminology:**

**Clipping:**commonly refers to the process of cutting away from a set of 2-dimensional geometric shapes those parts that are outside a rectangular '*clipping*' window. This can be achieved by*intersecting*subject paths (lines and polygons) with a 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).**Path:**is an ordered sequence of vertices defining a single geometric contour that's either a line (an open path) or a polygon (a closed path).**Line:**or polyline is an*open*path containing 2 or more vertices.**Polygon:**commonly refers to a two-dimensional region bounded by an outer non-intersecting closed contour. That region may also contain a number of 'holes'. In this documentation however, polygon will simply refer to a*closed*path.**Contour:**synonymous with path.**Hole:**is a closed region within a polygon that's not part of the polygon. A 'hole polygon' is a closed path that forms the outer boundaries of a hole.**Polygon Filling Rule:**the**filling rule**, together with a list of closed paths, defines those regions (bounded by paths) that are*inside*(ie regions 'brush filled' in a graphical display) and those which are*outside*(ie 'holes').

**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 about 5000 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.

Source, License, Clipper, ClipperOffset, ClipType, PolyFillType

Copyright ©2010-2014 Angus Johnson - Clipper 6.2.0 - Help file built on 16-October-2014