A simple, easy to use implementation of Delaunay triangulation in 2D, written in C++.
This code based on Paul Bourke's implmentation of the Delaunay triangulation algorithm and is also strongly based on this C++ implementation.
To use the delaunay
class all you need are the files. This is a header only library. To build the tests and the demo application you'll need CMake and Qt5. If you're on windows I recommend using vcpkg. You can find instructions on how to use vcpkg
on windows with CMake here.
To build unit tests, ensure that BUILD_UNIT_TESTS
is on. To build the demo application, ensure that BUILD_DEMO_APP
is on.
The interface is quite simple: pass a point cloud (std::vector
of points) to the delaunay
object and then call triangulate()
.
Example:
using point = point<double>;
using triangle = triangle<double>;
std::vector<point> data = get_lots_of_points();
delaunaypp::delaunay<point> delaunay(data);
auto triangles = delaunay.triangulate();
// do something with the triangles.
I wrote this as a learning exercise, but if you find it useful feel free to use it! Feel free to contact me with any questions.