如何使用CGAL :: triangulate_polyhedron

时间:2014-04-22 10:12:19

标签: c++ boost cgal

我正在尝试使用未记录的函数CGAL :: triangulate_polyhedron。但我收到很多错误。这是我的简单代码:

#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;
}

以下是(示例)错误:

/CGALtest/include/CGAL/Triangulation_2_filtered_projection_traits_3.h:38:36:错误:'CGAL :: Triangulation_2_filtered_projection_traits_3&gt; :: K {aka struct CGAL :: Simple_cartesian}'中没有名为'Exact_kernel'的类型    typedef typename K :: Exact_kernel Exact_kernel;                                     ^ /CGALtest/include/CGAL/Triangulation_2_filtered_projection_traits_3.h:39:42:错误:'CGAL :: Triangulation_2_filtered_projection_traits_3&gt; :: K {aka struct CGAL :: Simple_cartesian}'中没有名为'Approximate_kernel'的类型    typedef typename K :: Approximate_kernel Approximate_kernel;                                           ^ /CGALtest/include/CGAL/Triangulation_2_filtered_projection_traits_3.h:40:27:错误:'CGAL :: Triangulation_2_filtered_projection_traits_3&gt; :: K {aka struct CGAL :: Simple_cartesian}'中没有名为'C2E'的类型    typedef typename K :: C2E C2E;

......还有更多像以上......

加上这个:

/ usr / include / c ++ / 4.8 / cmath:494:5:注意:模板参数扣除/替换失败: ... /usr/include/c++/4.8/cmath:494:5:错误:'struct __gnu_cxx :: __ enable_if'中没有名为'__type'的类型 在/home/hamed/workspace/CGALtest/include/CGAL/triangulate_polyhedron.h:32:0中包含的文件中,

任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:2)

<CGAL/triangulation_polyhedron.h>中的函数未记录,因为它们尚未准备好被广泛使用。该标题应该仅由Polyhedron演示使用。

你得到的编译错误是因为函数模板CGAL::triangulate_polyhedron要求多面体使用的内核是CGAL::Exact_predicates_inexact_triangulation_kernel

正如塞巴斯蒂安指出的那样,无论如何CGAL::convex_hull_3的输出是一个多面体,其面已经被三角化。