Simple Python computational geometry code for computing voronoi diagrams, and its dual graph, the Delauney triangulation.
Voronoi diagrams are a type of tesselation pattern that emerges when every point in a plane is segmented into n cells through the computation of euclidean distances for a given set of n points.
For example, if n = 6, then the euclidean distance between every point in the plane and each n-th given point will be calculated. Each point will be colour-assigned to whichever n-th point it is closest to, creating colour-separated sites.
The pattern of voronoi diagrams may look familiar, that's because it shows up quite often: from cells to giraffe coat patterns. You can read more about it here, from this article which inspired me to create this repository. the-fascinating-world-of-voronoi-diagrams
Delauney triangulations are known as the dual graph of the Voronoi diagrams. The Delauney is an efficient triangulation in which for a given set of points, no point is inside the circumcircle of any triangle within the Delauney triangulation.
- Pygame 2.5.2
- Matplotlib 3.5.1
- Numpy 1.22.0
- Clone the repository
- Run voronoi.py in the voronoi folder
- Run delauney_triangulation.py in the delauney folder
python voronoi.py
python delauney_triangulation.py
Feel free to open a pull request if you see any changes to make. :-)
- 0.1
- Initial Release
This project is licensed under the MIT License - see the LICENSE.md file for details
Math resources/references,