我在获取Delaunay三角剖分中每条边的两个端点的顶点句柄上遇到了一些困难。由于我已经花费了几个小时的时间,还没有找到解决方法,因此我认为也许你们中的某个人可以帮助我解决这个看似微不足道的问题:
#include <iostream>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_2.h>
using namespace std;
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Delaunay_triangulation_2<K> Triangulation;
typedef Triangulation::Point Point;
typedef Triangulation::Edge_iterator Edge_iterator;
typedef Triangulation::Vertex_handle Vertex;
int main(){
Point p;
Triangulation t;
while(cin >> p)
t.insert(p);
// Iterate over edges
for(Edge_iterator ei=t.finite_edges_begin();ei!=t.finite_edges_end(); ei++){
// Get a vertex from the edge
Vertex vs = ei->source();
}
}
根据文档,对于Edge_iterator的解引用,应该得到一个Edge_handle,而Edge_handle应该有成员source()和target()来简单获取端点,但是编译无法通过,似乎是错误的。像上面那样解引用将给我一个没有这些成员函数的pair<>。你有什么想法吗?