【问题标题】:How to use CGAL::triangulate_polyhedron如何使用 CGAL::triangulate_polyhedron
【发布时间】:2014-06-06 15:35:25
【问题描述】:

我正在尝试使用未记录的函数 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 >::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 >::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 >::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 包含的文件中,

任何帮助将不胜感激!

【问题讨论】:

  • 供参考,convex_hull_3 的输出已经三角化了

标签: c++ boost cgal


【解决方案1】:

&lt;CGAL/triangulation_polyhedron.h&gt; 中的函数没有记录,因为它们还没有准备好被广泛使用。该标头应该仅供多面体演示使用。

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

正如 Sébastien 所指出的,无论如何CGAL::convex_hull_3 的输出是一个多面体,其刻面已被三角剖分。

【讨论】:

  • 凸包仅适用于凸网格。如何对凹多面体进行三角测量?
  • @zync 在 StackOVerflow 中,在评论中提出新问题是一种非常糟糕的做法。请创建一个新问题。
猜你喜欢
  • 1970-01-01
  • 2014-05-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-10-07
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多