Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Efficient Clipping of Arbitrary Polygons using OpenGPL, based on a paper by Günther Greiner and Kai Hormann, for a Graphical Computation class. Provided Python and Java versions. Switch branches for each.
Branch: python

Efficient Clipping of Arbitrary Polygons using OpenGPL

Based on the paper "Efficient Clipping of Arbitrary Polygons" by Günther Greiner (greiner[at] and Kai Hormann (hormann[at], ACM Transactions on Graphics 1998;17(2):71-83.

Available at:


This work was created for educational purposes only, as an implementation in Python of the above algorithm, for a class in Graphical Computation.

To study the algorithm, inspect the file It can be imported and used in other contexts (i.e., not OpenGL).


> import polygon
> help(polygon)
> from polygon import *

Command line

The command line interface ( is provided for demonstration or testing purposes, using OpenGL.


Supports Python 2.5 or later.

Requires PyOpenGL (version 3 as of this writing). If you have pip, install is easy:

pip install pyopengl


Supported operations are: union, intersection and difference.

Polygon overrides

Subject and clip polygon can be defined per command line option. Defaults for the subject and clip polygon are set at the beggining of the file for easy edit, but they can be overriden from the command line using the options --subj-poly and --clip-poly.

Example: --subj-poly="1.5, 1.25; 7.5, 2.5; 4, 3; 4.5, 6.5"


Type -h for available options. Press Esc to exit.

Something went wrong with that request. Please try again.