Skip to content

luihabl/delaunator.h

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

delaunator.h

A header-only C++11 port of the delaunator JavaScript Delaunay triangulation library.

How to use

Here is a minimal usage example:

#include <delaunator.h>

#include <iostream>


int main() {   
    std::vector<float> points = {
        -12.0f, 8.0f,
        -10.0f, 6.0f,
        -12.0f, 4.0f,
         12.0f, 8.0f,
         10.0f, 6.0f,
         12.0f, 4.0f
    };
    
    Delaunator d(points);

    std::cout << "Triangles:" << std::endl;
    for(std::size_t i = 0; i < d.trianglesLen; i+=3) {
        std::cout << d.triangles[i] << "\t" << d.triangles[i+1] << "\t" << d.triangles[i+2] << std::endl;
    }

    return 0;
}

Building

To use the library just include the delaunator.h header and use it! To build the example file you can use CMake 3.11+.

About

A header-only C++11 port of the Delaunator

Topics

Resources

License

Stars

Watchers

Forks

Contributors