This post was meant to come out on the 15th April... but I forgot to upload it to the server - I am posting now instead.
Today I bring you another experiment with the HTML5 Canvas - Voronoi diagrams. A Voronoi diagram is an image where you scatter a bunch of points across an image, give each point a colour, and then colour each pixel according to which point is closest.
You can find my implementation here: Voronoi Diagram Generator
Initially I had trouble implementing this algorithm as I was trying to draw the outline of each of the cells first, but the explanation on it's Wikipedia article helped me to realise that there was a much easier way to do it :)
Next time I am trying to implement something that looks rather complicated and difficult I will definitely look for an alternative way of thinking about it.
For those of you who are interested, I used a technique called 32 bit canvas manipulation when writing this one. In a nutshell, this is a way of setting the red, green, blue, and alpha values of a pixel all at once, instead of in 4 separate operations - speeding up the whole rendering process.