I'm fooling around with landscape generation. so far so good, until I hit the Voroni diagram... For simplicity purpose, I generated a diagram without any equation and it seems to work properly (left image). However, the code I found (Mietze's & others) gives me a weird result (right image).

On Left:
distanceBuffer(x, y) = nearestDistance
On right:
distanceBuffer(x, y) = nearestDistance2 - nearestDistance
But there is something that bothers me in this:
If nearestDistance < minimumDistance Then minimumDistance = nearestDistance
If nearestDistance > maximumDistance Then maximumDistance = nearestDistance
For x As Integer = 0 To tableSizeX
For y As Integer = 0 To tableSizeY
pixel(x, y) = (distanceBuffer(x, y) - minimumDistance) / (maximumDistance - minimumDistance)
Next
Next
If I'm using 2 distances, how come I'm only using minimum and maximum distance from distance #1?
I'm trying to acheive this:
http://www.blackpawn.com/texts/cellular/default.html