I am trying to find a way to calculate a 2d Power Diagram in Python. For this I want to make use of the fact that a 2d power diagram can be interpreted as the intersection of a regular 3d voronoi diagram with a plane.
With the SciPy Voronoi module I can calculate a 3d Voronoi diagram - is there a possibility to intersect it with a plane and convert it to a 2d diagram?
There isn't yet a power diagram capability inside of SciPy.
Converting a 3D Voronoi diagram into a 2D power diagram is likely to be difficult and, at least within Python, slow.
To work around this, I've developed a C++ program based around CGAL that can then be wrapped by Python.
With the Python function and C++ code in hand, a power diagram can be generated using:
And the result looks like this if the power diagram is cropped to the bounding box of the point cloud:
and this if it is uncropped (but converted to a finite representation):
The code below worked as of 02019-01-12 using GCC 7.3.0, Python 3.6.7, CGAL 4.11 (1041101000). The code can also be acquired on Github here.
Python code
Makefile
And the resulting executable named
power_diagramer.exe
and placed in the same directory as the Python script.C++ code