Delaunay triangle and Voronoi diagram image generator
Generate pretty (to me) geometric images using math!
Delaunay triangle and Voronoi diagram image generator
This is a very tiny browser-based javascript mini-app that produces a random geometric pattern. Using the Delaunay algorithm, build a set of triangles from a set number of randomized points on the screen. Then, build a Voronoi diagram from adjacent triangles. Each cell in the diagram is colored using a color along a gradient.
The hard work and algorithim implementation details are all handled by d3-delaunay library, huge thanks to Mike Bostock for the library, and the rest of the d3 ecosystem, and all of the contributors for making this feasible for me.
And a big thanks to the Skypack CDN for hosting the libraries involved!
Usage
Refresh the page, and the points will be randomized again, producing a new image. Then, when you're happy, you can save the generated image. There are keyboard shortcuts available, too:
- R - Reload the page
- S - Prompt to download the generated image
- ? - Show the list of keys
Installing
There isn't anything to install, it's all static files. So, put it anywhere you can send static files from. Lazy? Here's a one-line ruby command:
ruby -run -ehttpd . -p8000