A few people have asked for the code for my Voronoi Toy. I haven’t made the entire program public yet, but I have released the underlying as3delaunay library, which I originally ported from Steven Fortune’s C implementation of his plane-sweep algorithm.
In addition to the Voronoi diagram and the Delaunay triangulation, the library also provides the convex hull, minimum and maximum spanning trees, and several other related geometric entities.
You can download the source and compile it, or just get the compiled swc from the downloads page.
So far I have had two users, JakeTastic (Voronoi shattering complete!) and Li (Faster Voronoi Noise); thanks to them both for jumping on, and to Jake also for finding the two bugs :-)
There’s no documentation yet, but there is a test suite which incorporates an example of using the library for nearest-site queries, and there’s also a mailing list, where I’ve archived Fortune’s paper and his C code, as well as a growing page of interesting links related to Voronoi/Delaunay.
The library is hosted on github, so YOU can conveniently modify, fix, or enhance it!
Roadmap for possible enhancements:
Generalize to support weighted Voronoi diagrams, both additive and multiplicative (This is described in Fortune’s paper)
Generalize to use an arbitrary polygon as a boundary
… what else?
Looks great Alan, also glad you’ve posted it to github.
Thanks, Alan! (BTW Folks, that’s not me commenting on my own work, it’s Alan Klement.)
[...] Voronoi open-source library for AS3 [...]
[...] only part way there, but I’ve learned a lot in the process and discovered an amazing open source AS3 Delaunay library created by NodeName. It can do Voronoi diagrams, minimum spanning tree and lots of other useful stuff. Props to [...]
the delaunay library is really nice. I speed tested it against a couple different ones and it was very fast with dense points.
Also, in the code, the _triangles.push(blabla) is commented out. Why is that? it seems to work fine with it included.
@dood: Thanks for your comments! I just haven’t needed the triangles data per se — it’s redundant information for me, so I decided to save a little time by commenting it out — but I did want to document that the data is available in that format. Glad to hear it works OK!