Question

I am trying to use the undocumented function CGAL::triangulate_polyhedron. But I am receiving lots of error with it. here is my simple code:

#include <CGAL/Exact_predicates_exact_constructions_kernel_with_sqrt.h>
#include <CGAL/point_generators_3.h>
#include <CGAL/algorithm.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/convex_hull_3.h>

#include <CGAL/triangulate_polyhedron.h>

#include <vector>

typedef CGAL::Exact_predicates_exact_constructions_kernel_with_sqrt K;
typedef CGAL::Polyhedron_3<K> Polyhedron_3;
typedef K::Segment_3 Segment_3;
// define point creator
typedef K::Point_3 Point_3;
typedef CGAL::Creator_uniform_3<double, Point_3> PointCreator;



int main() {
    CGAL::Random_points_in_sphere_3<Point_3, PointCreator> gen(100.0);
    // generate 250 points randomly on a sphere of radius 100.0
    // and copy them to a vector
    std::vector<Point_3> points;
    CGAL::cpp11::copy_n(gen, 250, std::back_inserter(points));
    // define polyhedron to hold convex hull
    Polyhedron_3 poly;

    // compute convex hull of non-colinear points
    CGAL::convex_hull_3(points.begin(), points.end(), poly);

    CGAL::triangulate_polyhedron<Polyhedron_3>(poly);

    return 0;
}

and here are the (sample) errors:

/CGALtest/include/CGAL/Triangulation_2_filtered_projection_traits_3.h:38:36: error: no type named ‘Exact_kernel’ in ‘CGAL::Triangulation_2_filtered_projection_traits_3 >::K {aka struct CGAL::Simple_cartesian}’ typedef typename K::Exact_kernel Exact_kernel; ^ /CGALtest/include/CGAL/Triangulation_2_filtered_projection_traits_3.h:39:42: error: no type named ‘Approximate_kernel’ in ‘CGAL::Triangulation_2_filtered_projection_traits_3 >::K {aka struct CGAL::Simple_cartesian}’ typedef typename K::Approximate_kernel Approximate_kernel; ^ /CGALtest/include/CGAL/Triangulation_2_filtered_projection_traits_3.h:40:27: error: no type named ‘C2E’ in ‘CGAL::Triangulation_2_filtered_projection_traits_3 >::K {aka struct CGAL::Simple_cartesian}’ typedef typename K::C2E C2E;

... and a lot more like above ....

plus this:

/usr/include/c++/4.8/cmath:494:5: note: template argument deduction/substitution failed: ... /usr/include/c++/4.8/cmath:494:5: error: no type named ‘__type’ in ‘struct __gnu_cxx::__enable_if’ In file included from /home/hamed/workspace/CGALtest/include/CGAL/triangulate_polyhedron.h:32:0,

any help would be appreciated!

Was it helpful?

Solution

The functions in <CGAL/triangulation_polyhedron.h> are not documented, because they are not ready to be used widely. That header is supposed to be used by the Polyhedron demo only.

The compilation error you get is there because the function template CGAL::triangulate_polyhedron requires that the kernel used by the polyhedron is the CGAL::Exact_predicates_inexact_triangulation_kernel.

As Sébastien has pointed out, anyway the output of CGAL::convex_hull_3 is a polyhedron with facets that are already triangulated.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top