commit | f3157da5fbcca7b0c1e586163879754ad616a0ab | [log] [tgz] |
---|---|---|
author | Vova Bilonenko <bilonenko.v@gmail.com> | Sun Sep 09 08:23:35 2018 +0200 |
committer | Vova Bilonenko <bilonenko.v@gmail.com> | Sun Sep 09 08:23:35 2018 +0200 |
tree | 3192e67f6f44729121a6f119909f6ddf93255161 | |
parent | 72f0ad45ef3f7262242af92263f7eb4b3f66ee47 [diff] |
fix missing include
A really fast C++ library for Delaunay triangulation of 2D points.
delaunator-cpp is a C++ port from https://github.com/mapbox/delaunator a JavaScript implementation of very fast 2D Delaunay algorithm.
#include <delaunator.hpp> #include <cstdio> //... int main(int, char* argv[]) { //... std::vector<double> coords = {/* x0, y0, x1, y1, ... */}; //triangulation happens here //note moving points to constructor delaunator::Delaunator delaunator(coords); for(std::size_t i = 0; i < delaunator.triangles.size(); i+=3) { printf( "Triangle points: [[%f, %f], [%f, %f], [%f, %f]]\n", delaunator.coords[2 * delaunator.triangles[i]], //tx0 delaunator.coords[2 * delaunator.triangles[i] + 1], //ty0 delaunator.coords[2 * delaunator.triangles[i + 1]], //tx1 delaunator.coords[2 * delaunator.triangles[i + 1] + 1], //ty1 delaunator.coords[2 * delaunator.triangles[i + 2]], //tx2 delaunator.coords[2 * delaunator.triangles[i + 2] + 1], //ty2 ) } }
For full example see examples/triangulate/main.cpp