These polygons are generated with Perlin noise. The noise is quantized to black and white to allow for easier shape identification.
- Create groups of points by grouping the black pixels together with a simple radius check.
- Heapsort the points along the X, then Y, axes.
- Pass each group of points into a Andrew’s Monotone Chain function (a convex hull algorithm, similar to Graham Scan).
- Each group of points is now a convex hull, so we can draw a polygon for each one.
For the boxy drawing method there are a few steps between 3 and 4:
- Determine the bounding box for each polygon.
- Treat each line of the box as a tangent line.
- Connect the points that intersect the tangents, creating a triangle or quadrilateral.
The source code is available on github.