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.
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.
Javascript Demos ▼
Here's a bunch of javascript... things I wrote over the years whenever time permitted.
Abhivadaye Generator
Game of Life
Anagram Finder
Deflection Demo
Break Out
Cycloids
Double Pendulum
Flocking
Fog fly through
Fractals
EV Savings
Target Finder
Bouncing Spheres
Horizontal Stars
Image Scanning
Pandemic Simulator
JSON Beautify
Julia Sets
Kaleidoscope
Kock Fractals
Lorenz Attractor
Mandlebrot Set
Meta Balls
Number Convert
Number Game
Forces on Objects
Particles & Nodes
Simple Pendulum
Perlin Noise
Poisson Disk
QuadTree Search
8 Queens Problem
Natural Flocking
Ripples
Set Demonstration
Sine Waves
Classic Snake
Starfield
Sierpinski Triangles
Super Shapes 2D
Tic Tac Toe
Voronoi Diagram
Who Moved My...