delaunify is a command-line tool to perform 2D Delaunay triangulation on a set of points. It is designed to be a simple filter that accepts point coordinates streamed in via stdin, then outputs the vertex indices of the generated triangles to stdout.
delaunify uses the Geogram library by Bruno Lévy, specifically its Delaunay PSM (pluggable software module, a library standalone autogenerated from the Geogram source tree). The Geogram version included here is currently 1.6.4.
The software should build with g++ using the following command:
g++ -std=gnu++11 -O3 -fopenmp -frounding-math -ffp-contract=off -Wall delaunify.cpp Delaunay_psm.cpp -o delaunify -lm
It is possible to build using Cygwin after applying the provided patch for the PSM:
patch --binary < cygwin_psm_patch.patch
(The --binary
flag helps deal with any misery caused by mismatching line
endings.)
Then, building is similar to that on Linux, though with a -D__linux__
flag
added:
g++ -std=gnu++11 -D__linux__ -O3 -fopenmp -frounding-math -ffp-contract=off -Wall delaunify.cpp Delaunay_psm.cpp -o delaunify -lm
Not yet working.
delaunify expects input through stdin in the form of plaintext, one line for each point, with x and y coordinates separated by whitespace. The generated output will contain the (zero-based) indices of the vertices in the triangulation, specified for one triangle per line.
Example with a heredoc as input:
./delaunify > faces.txt << EOF
0.5 1.0
2.0 0.5
1.0 1.5
3.0 3.5
EOF
Using a text file as input:
./delaunify > faces.txt < vertices.txt