首页 > 解决方案 > CGAL Triangulated Surface Mesh Shortest Paths 算法 - 断言错误

问题描述

我正在试验 CGAL 库的Triangulated Surface Mesh Shortest Paths算法。我正在使用以下三角方形案例进行测试: 在此处输入图像描述

当我尝试计算任意两个顶点之间的最短距离时,总是会出现以下两个错误之一:

错误1:

terminate called after throwing an instance of  'CGAL::Assertion_exception'
what():  CGAL ERROR: assertion violation!
Expr: baseOrientation != CGAL::COLLINEAR
File: /usr/local/include/CGAL/Surface_mesh_shortest_path/function_objects.h  
Line: 588

错误2:

terminate called after throwing an instance of 'CGAL::Assertion_exception'
what():  CGAL ERROR: assertion violation!
Expr: _idx < data_.size()
File: /usr/local/include/CGAL/Surface_mesh/Properties.h
Line: 204

您可以在此处下载包含非格式网格的最小代码示例。我遵循了 CGAL 网站上显示的实现。编译需要 CGAL 和 gmp 库:

g++ main.cpp -lCGAL -lgmp

可执行文件需要两个参数:源点和目标点的索引:

a.out 2 6

尝试 2 和 6 获得第一个错误,或尝试 0 和 2 获得第二个错误。

标签: c++cgal

解决方案


推荐阅读