Voronoi Diagram
29 Nov 2020

If we are to assume that a set of points (or objects) occupy a 2D (or 3D) plane, then a Voronoi diagram (or Voronoi Tesselation) is a partition of that plane into regions close to each of the set of points (or objects). These regions are called Voronoi cells.

Sorry, your browser does not support Canvas.

There are many better ways to achieve the Voronoi Tessalation. Here are some links 1, 2, 3. The way I have done it can be summed up as below.

1. Place objects (the black points) randomly on the canvas. Each of these objects carries with it a color (also randomly generated) property.
2. Start filling the canvas with ellipses.
3. While filling these ellipses, make the ellipse the same color as the object (the black point) closest to it.
That's it actually. You should be able to click on the canvas to place an additional object on the canvas.

1. voronoi.js - Download, index.html
//Code goes here

Javascript Demos

Here's a bunch of javascript... things I wrote over the years whenever time permitted.