The original code kept crashing Unity, revealed internal core bugs in Unity. I tried to get Unity corp to accept / fix these, but they refused, so ... I found a better library to work with.
Use Triangle.net, the open-source C# library that's higher performance with more features. It does delaunay and voronoi.
This fork exists to add:
- Issue-tracking (missing from master project)
- More interactivity in the demo project / add missing docs to source code
I hate forking projects - big waste of time - but with no issue-tracking on upstream, I really had no choice.
Upgrades compared to upstream:
- NOW PACKAGED AS A SINGLE .DLL FILE YOU CAN DRAG/DROP INTO UNITY
- Demo project lets you enable/disable rendering of individual features
- Helps you understand the definitions (undocumented in source)
- Helps you experiment with the data structures before embedding in your own projects
- Usage instructions!
- Open the "demo" folder in Unity as a new Project
- Open the "Demo" scene inside Unity (otherwise nothing will happen when you run)
- Select the "Extended demo" object
- Click the "re-generate" button to make a new random Voronoi
- in the Editor view you'll now see a coloured diagram of your data
- also you now have tickboxes to show/hide various features of the output data
- In the CSharpLibrary folder, there should be a subfolder: AS3DelaunayExtended/AS3DelaunayExtended/bin/Debug
- ...which contains the DLL: AS3DelaunayExtended.dll
- Drag/drop that DLL into your Unity3D project, and Unity will automatically load + add it
- You can now use all the classes and features in your project
- NB: this DLL does NOT include the Custom Editor classes (Unity requires two DLLs if you want that)
- NB: this means you lose the custom buttons for "Re-generate Voronoi"; you can use the function via script/code only!
Voronoi diagrams, Delaunay triangulation, minimum spanning graphs, convex hull and more. Ported to C# for use in the Unity game engine from https://github.com/nodename/as3delaunay.
MIT licensed, like the original. Check out the original project page here.