# Voronoi - something for compulsive optimization disorder :)

I just wanted to share this code. Haven’t figured out how it works really, just wanted to learn about how to calculate a voronoi. But for now I settle with some code written for corona I think, but adapted for codea. It can be used for creating a procedural island for example.

https://gist.github.com/tnlogy/9081637

Sometimes i just want to find solutions that are clean and clear. This is a bit messy with having the beach line in order, search google to find descriptions on the algorithm…

@tnlogy I was looking at something like this about a year ago. It had random points on the screen and a base line that was drawn across the screen. The line would start at the top of the screen and as the line moved down the screen and crossed a random point, a parabola would be drawn like the wake from a boat. Where multiple parabolas touched, a line would be drawn that created the web like feature that you display in your example. Yours is drawing the web a lot faster than the parabola example was. But then I think the parabola example wasn’t meant to be fast.

@tnlogy I found the example that I was thinking of here. This one goes across the screen instead of down the screen.

``````http://en.wikipedia.org/wiki/Fortune's_algorithm
``````

This is the same algorithm as the wikipedia article illustrates. I would be slower if it animated the web moving across the screen. I think it is messy with all the needed special cases though.

Oh, darn you

I actually wrote a 2D Voronoi tesselator in the late 1980s for college. I’ll stay away from this one while I deal with your Marching Tetrahedra code…

@tnlogy awsome program again!
however, needs a bit of study to reuse it.

I’ll try to clean it up in the future, to make it easier to use.

I read this article and got a bit curious about building something similar in Codea. Maybe I will get time to look into it more later.

http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/

that would be… wow!