GPC General Polygon Clipper Library

GPC General Polygon Clipper Library

The University of Manchester GPC library is a software library providing an API for computing the results of clipping operations on sets of polygons. It generalises the computer graphics clipping problem of intersecting polygons with polygons.

The first release of GPC was designed and implemented in 1997 at the University of Manchester by [http://www.cs.man.ac.uk/~toby/alan/ Alan Murta] . The current GPC release is version 2.32.

GPC is free for non-commercial use, and its author encourages the free use of GPC to support research, teaching and academic applications.

To use GPC in support of commercial applications, a Licence from the University of Manchester is required. The Licencing Managerat the University of Manchester is [http://www.cs.man.ac.uk/~toby/ Toby Howard] .

The core GPC library is written in C. The library has also been ported to work with several other languages (see Ports and Language bindings).

Features of GPC

The following summarises the features and operations on polygons supported by GPC:

* GPC can compute the following clip operations: difference, intersection, exclusive-or and union.
* Polygons may comprise multiple disjoint contours.
* Contour vertices may be specified as clockwise or anticlockwise.
* Contours may be convex, concave or self-intersecting.
* Contours may be nested. In other words, polygons may have holes.
* The clip operation output from GPC is a set of polygon contours or tristrips.
* Holes and external contours are differentiated in GPC's output.
* Coincident edges and degenerate regions are handled correctly.

Examples of GPC operations on sets of polygons

The following four images show examples of GPC computing operations between two polygon sets. The first polygon set comprises outlines of the United Kingdom and Ireland. The second polygon set comprises the four large inward-pointing arrows. In each example, the areas resulting from the GPC operation between the two sets of polygons are rendered in colour.

This example shows difference between the two sets:

This example shows intersection between the two sets:

This example shows union between the two sets:

This example shows exclusive-or between the two sets:

Ports and Language bindings

The core GPC code is written in C, but the GPC user community has contributed a number of ports and bindings (or wrappers) for various other languages (C#, Borland Delphi, Java, Perl, Python, Haskell, Lua, VB.Net). All of these ports and bindings are freely available.

Licencing arrangements

The GPC code (and associated language ports and bindings, and demo software) is completely free for downloading and time-unlimited evaluation by any individual or company. Following evaluation, arrangements for using GPC for a project depend on whether the project is non-commercial, or commercial, as follows:

* Non-commercial use: GPC may be used free of charge, without a licence, in any application which is strictly non-commercial (examples: hobbyist, academic research or teaching).

* Commercial use: To use GPC in support of for-profit commercial activity (example: product research & development), users must obtain an official GPC Commercial Use Licence from the University of Manchester.

External links

* [http://www.cs.man.ac.uk/~toby/alan/software/ The GPC homepage] - includes GPC library and Windows/Linux demo program downloads, licencing and contact details.

The following links cover polygon clipping in general:

* Michael Leonov has compiled a [http://www.complex-a5.ru/polyboolean/comp.html comparison of polygon clippers] which includes GPC.
* The [http://www.faqs.org/faqs/graphics/algorithms-faq/ comp.graphics.algorithms FAQ] .
* The [http://compgeom.cs.uiuc.edu/~jeffe/compgeom/ UIUC Computational Geometry Pages]
* Klaas Holwerda's [http://boolean.klaasholwerda.nl/bool.html Boolean] , a C++ library.
* David Kennison's [http://www.dkrz.de/ngdoc/ng/supplements/polypack/ Polypack] , a FORTRAN library based on the Vatti algorithm.
* Klamer Schutte's [http://clippoly.sourceforge.net/ Clippoly] , a clipper written in C++.
* Michael Leonov's [http://www.complex-a5.ru/polyboolean/comp.html poly_Boolean] C++ library, which extends the Schutte algorithm.
* Dave Eberly's [http://compgeom.cs.uiuc.edu/~jeffe/compgeom/code.html page on constructive planar geometry software] may also be of interest.
* [http://www.geolib.co.uk GeoLib] is a C++ and C# Library with Polygon Boolean Operations.


Wikimedia Foundation. 2010.

Игры ⚽ Нужно сделать НИР?

Look at other dictionaries:

  • GPC — may refer to: TOC In computing and technology* General Purpose Computer, aboard the Space Shuttle * Get/Post/Cookie, which are three methods of transferring information between dynamic web pages in PHP * Global Path Cache * GNU Pascal, a compiler …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”