Search code examples
cgal

Triangulating Polyhedron faces in CGAL


Having an arbitrary polyhedron in CGAL (one that can be convex, concave or, even, have holes) how can I triangulate its faces so that I can create OpenGL Buffers for rendering?

I have seen the convex_hull_3() returns a polyhedron that has triangulated faces, but it won't do what I want for arbitrary polyhedrons.


Solution

  • The header file <CGAL/triangulate_polyhedron.h> contains a non-documented function

    template <typename Polyhedron>
    void triangulate_polyhedron(Polyhedron& p)
    

    that is working with CGAL::Exact_predicates_inexact_constructions_kernel for example.