GPC

General Polygon Clipper library


Difference

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,
as referenced in the comp.graphics.algorithms FAQ
and the UIUC Computational Geometry Pages.

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

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


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).

DifferenceIntersection
Exclusive-orUnion


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 (zip, 28k).  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.

agg-gpc

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:

ActionScript port (gpcas) Jakub Kaniewsky
C# wrapper Stefan Menne
COM wrapper Tom Wolf
Delphi/Pascal port (GPC v2.30) Stefan Schedel
Delphi/Pascal port (GPC v2.32) Richard B. Winston
Haskell port Marco Túlio Gontijo e Silva
Java port Daniel Bridenbecker
Lua binding Luiz Henrique de Figueiredo
Octave binding Rafael Laboissiere
Perl binding

Eric Wilhelm

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: 5March 2010.