I’m pleased to share something I’ve been working on the past few months – a 2D computational geometry that I’ve called Processing Geometry Suite.
The focus of the library is on visualisation rather than providing underlying data structures and so all methods in the library are static and most of them take in and return
I’ve made a real effort to make it easy to pick up – it’s well documented, the Github is replete with gifs illustrating the varied functionality, and there’s a handful of example sketches included too.
It certainly shares some functionality in common with existing computational geometry libraries for Processing but there’s a lot of novel functionality introduced too. Furthermore many of the existing libraries are poorly supported and documented. All of this hopefully makes PGS a very worthwhile addition to the Processing library ecosystem.
Library functionality is split over the following classes:
- Construct uncommon 2D primitives
- Methods that produce various contours from shapes: medial axes, straight skeletons, offset curves, etc.
- Conversion between PShapes and JTS Geometries
- Methods that affect the geometry or topology of shapes (buffering, simplification, smoothing, etc.)
- Solve geometric optimisation problems, such as finding the maximum inscribed circle, or the closest vertex to a coordinate
- Methods that process a shape in some way: compute hulls, partition, slice, etc.
- Boolean set-operations for 2D shapes
- Various shape metrics (area, circularity, etc.) and predicates (“do these shapes intersect?”)
- Various geometric and affine transformations that affect vertex coordinates
- Delaunay triangulation (constrained and refined) and earcut triangulation of shapes and point sets
- Voronoi Diagrams of shapes and point sets
Processing IDE — Quick
Processing IDE — Permanently
Download the latest PGS.jar from releases and save it to
(Note the .jar and the folder must be called
PGS — rename the .jar if this is not the case).
A number of example Processing sketches are provided in examples.
A few illustrations below. There are many more on the Github repo…