A few weeks back, a colleague was searching for matlab for a task to get the Voronoi diagram from some points he had. I suggested why not use #python? He was not convinced and he got hold of matlab license and did his job.

But I had this itch for trying Voronoi in python, so here it is. Finally got some spare time. It was so easy in python, that I built the example around a tkinter gui.

But before we go to code, for everyone’s benefit What is Voronoi Diagram?

In mathematics, a Voronoi diagram is a way of dividing space into a number of regions. A set of points (called seeds, sites, or generators) is specified beforehand and for each seed there will be a corresponding region consisting of all points closer to that seed than to any other. The regions are called Voronoi cells. It is dual to the Delaunay triangulation.

via wikipedia

And here’s the code.

Continue reading →

### Like this:

Like Loading...