c++ - How to use CGAL::triangulate_polyhedron -
i trying use undocumented function cgal::triangulate_polyhedron. receiving lots of error it. here 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 sphere of radius 100.0 // , copy them vector std::vector<point_3> points; cgal::cpp11::copy_n(gen, 250, std::back_inserter(points)); // define polyhedron 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 (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;
... , lot more 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 /home/hamed/workspace/cgaltest/include/cgal/triangulate_polyhedron.h:32:0,
any appreciated!
the functions in <cgal/triangulation_polyhedron.h>
not documented, because not ready used widely. header supposed used polyhedron demo only.
the compilation error there because function template cgal::triangulate_polyhedron
requires kernel used polyhedron cgal::exact_predicates_inexact_triangulation_kernel
.
as sébastien has pointed out, anyway output of cgal::convex_hull_3
polyhedron facets triangulated.
Comments
Post a Comment