GPC – General Polygon Clipper library


The University of Manchester GPC library (wikipedia: GPC)
is a flexible and highly robust polygon set operations library for use with
C, C#, Delphi, Java, Perl, Python, Haskell, Lua, VB.Net (and other) applications.

Designer and implementor: Alan Murta | Licencing Manager:
Toby Howard

Features | Licensing | Download | Demo apps | Ports and Wrappers | Links | Tech FAQ

GPC Features

  • Difference, intersection, exclusive-or and union clip operations are supported.
  • Polygons may be comprised of multiple disjoint contours.
  • Contour vertices may be given in any order - clockwise or anticlockwise.
  • Contours may be convex, concave or self-intersecting.
  • Contours may be nested (i.e. polygons may have holes).
  • Output may take the form of either polygon contours or tristrips.
  • Hole and external contours are differentiated in the result.
  • Coincident edges and degenerate regions are handled correctly.

GPC in action

The following examples show the results of GPC operations on two sets of polygons (Set 1: the United Kingdom and Ireland; Set 2: the four inward-pointing arrows). The operations are: difference (blue), intersection (green), exclusive-or (yellow) and union (purple).


GPC Licensing

GPC is free for downloading and time-unlimited evaluation by anyone.

Non-commercial use of GPC (for example: private / hobbyist / education)

GPC is free for non-commercial use only.
We invite non-commercial users to make a voluntary donation towards the upkeep of GPC.

Commercial use of GPC (for example: product development / commercial research)

If you wish to use GPC in support of a commercial product,
you must obtain an official GPC Commercial Use Licence from The University of Manchester.
Please email for details.

Download GPC

 GPC v2.32 – stable release.

 GPC v2.33 – experimental release (May 2014).

On-line documentation is here.

GPC demo for Windows

Maxim Shemanarev, developer of the Anti-Grain Geometry high quality rendering engine, has kindly donated this Windows application which shows GPC in action.


GPC demo for Linux

The gpctool package allows the interactive graphical evaluation of the GPC library under Unix / X11. Compilation requires the Mesa (or OpenGL) and xforms libraries - no precompiled binaries are available. The gpctool sources are available as either a Unix compressed tarfile (62k) or a PC Zip file (38k). Please note that this software is completely unsupported.

 gpctool screenshot 

GPC ports and wrappers

We thank these contributors for their GPC ports and wrappers:

.NET wrapper Christian Buck
ActionScript 3 port Jakub Kaniewski
C# wrapper Stefan Menne / Guido Bonino
Cocoa/NSBezier wrapper Graham Cox
COM wrapper Tom Wolf
Delphi/Pascal port (GPC v2.30) Stefan Schedel
Delphi/Pascal port (GPC v2.32) Richard B. Winston
haXe port Michael Baczynski
FORTRAN wrapper Jeff Krob
Haskell port Marco Túlio Gontijo e Silva
Java port Daniel Bridenbecker
Javascript port Arif Buntaran
Lua binding Luiz Henrique de Figueiredo
Objective-C wrapper John Swensen
OCaml binding Coherent Graphics/John Whitington
Octave binding Rafael Laboissiere
Perl binding Eric Wilhelm
Prolog wrapper Roy Ratcliffe
Python bindings Joerg Raedler
VB.NET wrapper Tadej Basa

Other polygon clipping resources

GPC is free for non-commercial use only

If you are a non-commercial user and you have found GPC to be useful, we invite you to please make a donation and help support the continuation of this project. Thanks!

However, If you wish to use GPC in support of a commercial product, you must obtain an official GPC Commercial Use Licence from The University of Manchester. Please email for details.

Page last updated: 24 April 2014