Processing Geometry Suite is a software project that provides easy access to 2D geometric algorithms in the form of a Processing library. Over time it has grown to include an incredibly comprehensive range of algorithms.
The focus of the library is on visualisation rather than providing underlying data structures. To this end all methods in the library are static and most of them take in and return PShapes
or PVectors
.
Docs are hosted via GitHub Pages here.
Library functionality is split over the following classes:
PGS_CirclePacking
- Circle packings of shapes, subject to varying constraints and patterns of tangencies
PGS_Coloring
- Minimal colorings of meshes (or mesh-like shapes)
PGS_Construction
- Construct uncommon/interesting 2D primitives
PGS_Contour
- Methods that produce various contours from shapes: medial axes, straight skeletons, offset curves, etc.
PGS_Conversion
- Conversion between Processing PShapes and JTS Geometries (amongst other formats)
PGS_Hull
- Convex and concave hulls of polygons and point sets
PGS_Meshing
- Mesh generation (excluding triangulation) and processing
PGS_Morphology
- Methods that affect the geometry or topology of shapes (buffering, simplification, smoothing, etc.)
PGS_Optimisation
- Solve geometric optimisation problems, such as finding the maximum inscribed circle, or the closest vertex to a coordinate
PGS_PointSet
- Generates sets of 2D points having a variety of different distributions and constraints
PGS_Processing
- Methods that process a shape in some way: compute hulls, partition, slice, etc.
PGS_SegmentSet
- Generates sets of random non-intersecting line segments
PGS_ShapeBoolean
- Boolean set-operations for 2D shapes
PGS_ShapePredicates
- Various shape metrics (area, circularity, etc.) and predicates ("do these shapes intersect?")
PGS_Tiling
- Tiling, tessellation and subdivision of the plane using periodic or non-periodic geometric shapes.
PGS_Transformation
- Various geometric and affine transformations that affect vertex coordinates
PGS_Triangulation
- Delaunay triangulation (constrained and refined) and earcut triangulation of shapes and point sets
PGS_Voronoi
- Voronoi Diagrams of shapes and point sets
Processing IDE — Quick
Download the latest PGS.jar from releases and simply drag-and-drop it onto the Processing IDE.
Processing IDE — Permanently
Download the latest PGS.jar from releases and save it to Documents\Processing\libraries\PGS\library
.
Result: Documents\Processing\libraries\PGS\library\PGS.jar
.
(Note the .jar and the folder must be called PGS
— rename the .jar if this is not the case).
Maven/Gradle
PGS is hosted as an artifact for use in Maven or Gradle projects via Jitpack — follow the instructions there (very easy).
A number of example Processing sketches are provided in examples.
Much of the functionality (but by no means all) is demonstrated below:
Union | Intersection | Subtraction | Symmetric Difference |
Complement | Mesh Union | Mesh Intersection | Mesh Subtraction |
- Length/perimeter
- Width & Height
- Diameter
- Circularity
- Similarity
- Sphericity
- Elongation
- Density
- Holes
- Maximum interior angle
- Is simple?
- Is convex?
- Equal? (structural and topological equivalence)
- Distance
- Area
- Centroid
- Median
Concave Hull | Convex Hull of Polygons | ||
Concave hull of point sets via breadth-first or depth-first approaches. | |||
Convex Hull | Snap Hull | ||
A variable-convexity hull. |
Delaunay Triangulation | Earcut Triangulation | ||
Poisson Delaunay Triangulation | |||
Delaunay triangulation of shapes where steiner points generated by poisson disk sampling are inserted. |
Voronoi Diagram (inner) | Voronoi Diagram (compound) | ||
Centroidal Relaxation | |||
Front Chain | Trinscribed | ||
Maximum Inscribed | Stochastic | ||
Repulsion | Square Lattice | ||
Hex Lattice | Tangency Pack | ||
Obstacle | |||
Graph-matched | Stochastic | Noded | |
Parallel | Polygon Interior Segments | ||
Random Quad Subdivision | Random Rect Subdivision | Random Triangle Subdivision | Hatch Subdivision |
Islamic Tiling | Doyle Spiral | Hexagon Tiling | |
Penrose Tiling | Square-Triangle Tiling | ||