CGAL没有计算完整的德劳内三角测量
CGAL is not computing a complete delaunay triangulation
我目前在使用 CGAL 库的 Delaunay 三角测量时遇到了错误。我计算三角测量如下
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
typedef Kernel::Point_2 Point;
typedef CGAL::Delaunay_triangulation_2<Kernel> DelaunayTriangulation;
auto triangulation = DelaunayTriangulation();
triangulation.insert(points.begin(),points.end());
其中points
是给定的Point
s 向量。我在几个实例上运行代码,大多数情况下三角测量都是正确计算的。然而,有时(我无法在某个实例中重现它)三角测量只能给我预期的面的一小部分。我实现了以下帮助程序函数
auto face_count = [](DelaunayTriangulation &triangulation)
{
std::size_t face_count = 0;
for (auto it = triangulation.finite_faces_begin(); it < triangulation.finite_faces_end(); it++) {
face_count ++;
}
return face_count;
};
auto is_correct = [&convex_hull_size, &face_count, &points](DelaunayTriangulation &triangulation)
{
return face_count(triangulation) != 2*points.size() - convex_hull_size - 2;
};
以计算计算三角测量的面数。在某些情况下,可以重新计算相同点上的三角测量,从而产生正确数量的三角形。然而,在其他情况下,我总是得到零三角形,这真的很烦人。
我的问题是,是否有人在使用 CGAL 时遇到过类似的错误,并且知道如何调试它。由于实例读取过程,提供最小的工作示例很困难。
编辑:
为清楚起见:以下代码
do
{
triangulation = DelaunayTriangulation();
triangulation.insert(points.begin(),points.end());
std::cout << "Calculated triangulation with " << face_count(triangulation) << " faces the correct amount is " << 2*points.size() - convex_hull_size - 2 << std::endl;
} while(is_correct(triangulation));
生成以下输出:
Calculated triangulation with 0 faces the correct amount is 60
Calculated triangulation with 0 faces the correct amount is 60
Calculated triangulation with 0 faces the correct amount is 60
Calculated triangulation with 0 faces the correct amount is 60
Calculated triangulation with 0 faces the correct amount is 60
Calculated triangulation with 0 faces the correct amount is 60
Calculated triangulation with 0 faces the correct amount is 60
Calculated triangulation with 0 faces the correct amount is 60
Calculated triangulation with 0 faces the correct amount is 60
Calculated triangulation with 0 faces the correct amount is 60
Calculated triangulation with 0 faces the correct amount is 60
Calculated triangulation with 0 faces the correct amount is 60
Calculated triangulation with 0 faces the correct amount is 60
Calculated triangulation with 0 faces the correct amount is 60
Calculated triangulation with 0 faces the correct amount is 60
Calculated triangulation with 0 faces the correct amount is 60
Calculated triangulation with 0 faces the correct amount is 60
Calculated triangulation with 0 faces the correct amount is 60
Calculated triangulation with 0 faces the correct amount is 60
Calculated triangulation with 0 faces the correct amount is 60
Calculated triangulation with 0 faces the correct amount is 60
Calculated triangulation with 0 faces the correct amount is 60
Calculated triangulation with 0 faces the correct amount is 60
Calculated triangulation with 11 faces the correct amount is 60
Calculated triangulation with 11 faces the correct amount is 60
Calculated triangulation with 11 faces the correct amount is 60
Calculated triangulation with 11 faces the correct amount is 60
Calculated triangulation with 11 faces the correct amount is 60
Calculated triangulation with 11 faces the correct amount is 60
Calculated triangulation with 0 faces the correct amount is 60
Calculated triangulation with 0 faces the correct amount is 60
Calculated triangulation with 0 faces the correct amount is 60
Calculated triangulation with 0 faces the correct amount is 60
Calculated triangulation with 0 faces the correct amount is 60
Calculated triangulation with 0 faces the correct amount is 60
Calculated triangulation with 60 faces the correct amount is 60
在某些情况下(但并非总是如此)。对于其他实例,我反复得到 0 个面,while 循环不会终止。
for (auto it = triangulation.finite_faces_begin(); it < triangulation.finite_faces_end(); it++)
应替换为
for (auto it = triangulation.finite_faces_begin(); it !=triangulation.finite_faces_end(); it++)
相关文章:
- 如何访问CGAL三维三角测量中的面
- CGAL 3D 周期性德劳内三角测量与信息的问题
- Fixed_alpha_shape_3() 会破坏或修改原始三角测量吗?
- 编译和运行 CGAL 三角测量演示
- CGAL没有计算完整的德劳内三角测量
- 优化德劳奈三角测量算法
- 如何使用每个顶点的自定义信息创建CGAL约束的delaunay三角测量
- CGAL 2.5D 三角测量 附加顶点信息
- 计算从德劳内三角测量获得的三角形的边长
- 在二维三角测量中添加约束时出错
- 在二维德劳奈三角测量中插入顶点时出错
- 视觉Opencv;C++;从线性三角测量法矩阵中提取点云点(x,y,z)
- visual有人在C++项目中使用过Triangle/Tangle++库吗?(delaunay三角测量)
- CGAL - 在德劳奈三角测量后检索顶点索引
- 如何对圆进行德劳内三角测量
- 如何从Subdiv2D Delaunay三角测量中获取顶点索引
- 配置 VS2010 用于贪婪投影三角测量
- 为什么opencv的三角测量点返回错误的结果?
- OpenCV:如何进行 Delaunay 三角测量并返回邻接矩阵
- OpenCV,C++:Missing Triangles in Delaunay三角测量