SkillAgentSearch skills...

PGS

Processing Geometry Suite

Install / Use

/learn @micycle1/PGS

README

Lines of Code

Processing Geometry Suite

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.

Overview

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: partition, slice, clean, 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.

Installation

<details><summary>Processing</summary> <p> PGS is available on Processing's contribution manager as "Geometry Suite for Processing".

image

</p> </details> <details><summary>Maven/Gradle</summary> <p>

PGS is hosted as an artifact for use in Maven or Gradle projects via Jitpack — follow the instructions there (very easy).

</p> </details>

Examples

A number of example Processing sketches are provided in examples.

<p float="middle"> <a href="examples/organicSponge"><img src="resources/examples/organicSponge.png" alt="" width="24%"/></a> <a href="examples/interlock"><img src="resources/examples/interlock.png" alt="" width="24%"/></a> <a href="examples/warpedQuilt"><img src="resources/examples/warpedQuilt.png" alt="" width="24%"/></a> <a href="examples/blobbies"><img src="resources/examples/blobbies.png" alt="" width="24%"/></a> <a href="examples/partitionSmooth"><img src="resources/examples/partitionSmooth.png" alt="" width="24%"/></a> <a href="examples/textOffsetCurves"><img src="resources/examples/textOffsetCurves.png" alt="" width="24%"/></a> <a href="examples/ripplingTriangles"><img src="resources/examples/ripplingTriangles.png" alt="" width="24%"/></a> <a href="examples/contourMap"><img src="resources/examples/contourMap.png" alt="" width="24%"/></a> </p>

Illustrations

Much of the functionality (but by no means all) is demonstrated below:

2D Boolean Operations

<table> <tr> <td align="center" valign="center"><b>Union</td> <td align="center" valign="center"><b>Intersection</td> <td align="center" valign="center"><b>Subtraction</td> <td align="center" valign="center"><b>Symmetric Difference</td> </tr> <tr> <td valign="top"><img src="resources/boolean/union.gif"></td> <td valign="top"><img src="resources/boolean/intersect.gif"></td> <td valign="top"><img src="resources/boolean/subtract.gif"></td> <td valign="top" ><img src="resources/boolean/symDifference.gif"></td> </tr> <tr> <td align="center" valign="center"><b>Complement</td> <td align="center" valign="center"><b>Mesh Union</td> <td align="center" valign="center"><b>Mesh Intersection</td> <td align="center" valign="center"><b>Mesh Subtraction</td> </tr> <tr> <td valign="top" width="25%"><img src="resources/boolean/complement.png"></td> <td valign="top" width="25%"><img src="resources/boolean/meshUnion.gif"></td> <td valign="top" width="25%"><img src="resources/boolean/intersectMesh.gif"></td> <td valign="top" width="25%"><img src="resources/boolean/subtractMesh.gif"></td> </tr> <tr> <td align="center" valign="center"><b>Union Lines</td> <td align="center" valign="center"><b>Overlap Regions</td> </tr> <tr> <td valign="top" width="25%"><img src="resources/boolean/unionLines.gif"></td> <td valign="top" width="25%"><img src="resources/boolean/overlapRegions.gif"></td> </tr> </table>

Transformation

<table> <tr> <td align="center" valign="center" colspan="2"><b>Rotate Around</td> <td align="center" valign="center"><b>Translate To</td> <td align="center" valign="center"><b>Touch Scale</td> </tr> <tr> <td valign="top" width="25%"><img src="resources/transform/rotateCenter.gif"></td> <td valign="top" width="25%"><img src="resources/transform/rotate.gif"></td> <td valign="top" width="25%"><img src="resources/transform/translateTo.gif"></td> <td valign="top" width="25%"><img src="resources/transform/touchScale.gif"></td> </tr> <tr> <td align="center" valign="center" colspan="2">Rotate a shape around its centroid or an arbitrary point.</td> <td align="center" valign="center">Translate a shape such that its centroid matches some position.</td> <td align="center" valign="center">Scale one shape such that it touches another.</td> </tr> <tr> <td align="center" valign="center"><b>Resize</td> <td align="center" valign="center"><b>Homothetic Transformation</td> <td align="center" valign="center"><b>Shear</td> <td align="center" valign="center"><b>Align</td> </tr> <tr> <td valign="top" width="25%"><img src="resources/transform/resize.gif"></td> <td valign="top" width="25%"><img src="resources/transform/homothetic.gif"></td> <td valign="top" width="25%"><img src="resources/transform/shear.gif"></td> <td valign="top" width="25%"><img src="resources/transform/align.gif"></td> </tr> <tr> <td align="center" valign="center"></td> <td align="center" valign="center">Projection-transform a shape with respect to a fixed point.</td> <td align="center" valign="center"></td> <td align="center" valign="center">Maximum-overlap alignment.</td> </tr> </table>

Geometric Predicates & Metrics

<table> <tr> <td align="center" valign="center"><b>Intersects</td> <td align="center" valign="center"><b>Contains Shape</td> <td align="center" valign="center"><b>Contains Point</td> <td align="center" valign="center"><b>Containing Cell</td> </tr> <tr> <td valign="top" align="center" width="25%"> <img src="resources/predicate/intersect.gif"><br>Do shapes intersect with each other?</td> <td valign="top" align="center" width="25%"><img src="resources/predicate/contains.gif"><br>Does one shape fully contain another?</td> <td valign="top" align="center" width="25%"><img src="resources/predicate/containsPoint.gif"><br>For individual points and point sets.</td> <td valign="top" align="center" width="25%"><img src="resources/predicate/containingCell.gif"><br>Which cell contains the query point?</td> </table>

Metrics

| <!-- --> | <!-- --> | <!-- --> | |-------------|-------------|-------------| | Length/perimeter | Similarity | Is simple? | | Width & Height | Sphericity | Is convex? | | Diameter | Elongation | Equal? (structural and topological equivalence) | | Circularity | Density | Distance | | Area | Holes | Centroid | | Interior angles | Maximum interior angle | Median |

Contour

<table> <tr> <td align="center" valign="center" colspan="2"><b>Isolines</td> <td align="center" valign="center" colspan="2"><b>Offset Curves</td> </tr> <tr> <td valign="top"><img src="resources/contour/isolines.gif"></td> <td valign="top"><img src="resources/contour/isolines2.gif"></td> <td valign="top"><img src="resources/contour/miteredInterior.gif"></td> <td valign="top"><img src="resources/contour/miteredExterior.gif"></td> </tr> </tr> <tr> <td align="center" valign="center" colspan="2">Isolines from intra-shape euclidean distance, or point sets.</td> <td align="center" valign="center" colspan="2">Inner and exterior offset curves; based on <i>miter, bevel</i> or <i>round</i> offset styles.</td> </tr> <tr> <td align="center" valign="center"><b>Straight Skeleton</td> <td align="center" valign="center" colspan="2"><b>Medial Axis</td> <td align="center" valign="center"><b>Chordal Axis</td> </tr> <tr> <td valign="top" width="2

Related Skills

View on GitHub
GitHub Stars208
CategoryDevelopment
Updated21d ago
Forks22

Languages

Java

Security Score

100/100

Audited on Mar 12, 2026

No findings