Search code examples
c++visual-c++triangulationdelaunay

Has anyone already used the Triangle/Triangle++ library in a C++ project ? (delaunay triangulation)


I'm using SFML and I want to make a delaunay triangulation of a random set of points.

http://www.cs.cmu.edu/~quake/triangle.html

I'm using triangle++, a c++ wrapper

http://www.compgeom.com/~piyush/scripts/triangle/

I added those #defines

#define REDUCED  
#define ANSI_DECLARATORS  
#define TRILIBRARY  
#define CDT_ONLY  
#define NO_TIMER  
#define CYGWIN  

This compiles, it runs fines, but now that it calculated those things, how do I get the edges between vertices ?


Solution

  • This was not really clear, but fiterator means face iterator, and a face is a triangle. Org, Dest and Apex are the indices of those vertices.

    for(Delaunay::fIterator fit  = delobject.fbegin(); 
                            fit != delobject.fend(); 
                          ++fit)
    {
        cout << " Org " <<  delobject.Org(fit)  << ", " 
             << " Dest " << delobject.Dest(fit) << ", " 
             << " Apex " << delobject.Apex(fit) << //" \t: Area = " 
    }
    

    Don't forget Triangle++ doesn't really require you to put the actual Triangle.c code, so it was really easy to use.