Voronoi regions in Beta 4?

Jun 22 at 2:21 PM
Hi,
where can I enumerate Voronoi regions (and its points) in the Beta 4 implementation?

Could you just point me to the right direction?
Thanks.
Coordinator
Jun 22 at 10:18 PM
Edited Jun 23 at 9:48 AM
It's the Faces property of the DCEL:
var voronoi = new StandardVoronoi(mesh);

foreach (var face in voronoi.Faces)
{
    HalfEdge e = null;

    foreach (var edge in face.EnumerateEdges())
    {
        e = edge;

        Console.WriteLine(e.Origin);
    }

    if (!face.Bounded)
    {
        Console.WriteLine(e.Twin.Origin);
    }
}
EDIT: added code to report points of the Voronoi region.

For unbounded regions, the first and last point reported are not part of the Voronoi diagram (meaning they aren't dual to any triangle), so you decide if you want to have them included or not.
Jun 23 at 12:33 PM
Thanks for that!

I have some code integrating Triangle.NET into Unity here https://github.com/eppz/Unity.Library.eppz.Geometry/blob/master/AddOns/TriangleNetAddOns.cs, I can now update it to beta 4. Awesome tools, thanks!