The following code is the implementation of the Restricted Power Diagrams on the GPU article published at Eurographics in 2021 (link to come). This method simultaneously decomposes a 3D object into power diagram cells and integrates given functions in each of the obtained simple regions, on the GPU.
To build under Linux or macOS:
mkdir build
cd build/
cmake ..
make
cd ..
Three sets of 100K points are provided (blue noise, perturbed grid, white noise). Following commands compute Voronoi diagrams restricted to a volume (elephant):
build/test_voronoi --grid=data/gpu_elephant_100.txt --output=xyz --K=20 --P=25 --V=30 data/100K-blue.xyz
build/test_voronoi --grid=data/gpu_elephant_100.txt --output=xyz --K=50 --P=30 --V=40 data/100K-perturbed-grid.xyz
build/test_voronoi --grid=data/gpu_elephant_100.txt --output=xyz --K=70 --P=30 --V=40 data/100K-white.xyz
Each command produces the file gridGPU.xyz; the file contains barycenters of non-empty cells.
NOTE: these sources contain the float and the double implementations of restricted voronoi,
- to compile the float's implementation, use cmake -DUSE_DOUBLE:BOOL=OFF ..
- to compile the double's implementation, use cmake -DUSE_DOUBLE:BOOL=ON ..
The misc folder contains some useful code for this project:
- createGrid: code to create the input grid file of cVoroOpenCL
- rvd: code to launch geogram's RVD on a volume ( given a list of seed)
- diffResult: code to do a diff of two ascii result files with format numPoints m0x0 m0y0 m0z0 m0 m1x1 m1y1 m1z1 m1 m2x2 m2y2 m2*z2 m2 ...
To compile this directory, you must first add the geogram's source in it. Then, you can do ./configure.sh, ...
Examples:
createGrid division=50 input.geogram grid=input_50.grid output=finalInput.geogram
rvd input=finalInput.geogram points=20Knormed.xyz output=rvd_mg.xyzw
diffResult rvd_mg.xyzw gridGPUres.xyzw