我正在尝试使用CGAL库的Triangulated Surface Mesh Shortest Paths算法。
我使用以下三角方形情况进行测试:
当我尝试计算任意两个顶点之间的最短距离时,我总是会遇到以下两个错误之一:
错误1:
With ThisWorkbook.Sheets("Sheet2")
'Select this workbook
Dim X As Integer
'I am not sure what I need to Dim this as
.Range("B2").Value = .Range("A2").Value
'B2 is the value I want to autofill down with
X = .Range("A" & .Range("A" & .Rows.Count).End(xlUp).Row).Value - .Range("B2").Value
'X will be the last value in column A
.Range("B2").Select
Selection.AutoFill Destination:=.Range("B2:B" & X + 2), Type:=xlFillDefault
'Not sure what to set my Type as
End With
错误2:
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
您可以下载最小代码示例,其中包括非格式here的网格。我遵循了CGAL网站上显示的实现。编译需要CGAL和gmp库:
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
可执行文件需要两个参数:源点和目标点的索引:
g++ main.cpp -lCGAL -lgmp
尝试2和6获得第一个错误,或者0和2获得第二个错误。