C++ CGAL 2D Delaunay三角剖分:如何获取作为顶点id对的边

C++ CGAL 2D Delaunay三角剖分:如何获取作为顶点id对的边,c++,cgal,delaunay,C++,Cgal,Delaunay,我有一组2D点,每个点都有一个相关id。例如,如果点存储在数组中,则id是每个点0,…,n-1的索引 现在我创建这些点的Delaunay三角剖分,并希望列出所有有限边。对于每一条边,我想用对应的两个顶点来表示点的ID。示例:如果在点0和点2之间有一条边,则为0,2。这可能吗 #include <vector> #include <CGAL\Exact_predicates_inexact_constructions_kernel.h> #include <CGAL\

我有一组2D点,每个点都有一个相关id。例如,如果点存储在数组中,则id是每个点0,…,n-1的索引

现在我创建这些点的Delaunay三角剖分,并希望列出所有有限边。对于每一条边,我想用对应的两个顶点来表示点的ID。示例:如果在点0和点2之间有一条边,则为0,2。这可能吗

#include <vector>
#include <CGAL\Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL\Delaunay_triangulation_2.h>

typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Delaunay_triangulation_2<K> Delaunay;
typedef K::Point_2 Point;

 void load_points(std::vector<Point>& rPoints)
 {
  rPoints.push_back(Point(10,10));   // first point
  rPoints.push_back(Point(60,10));   // second point
  rPoints.push_back(Point(30,40));   // third point
  rPoints.push_back(Point(40,80));   // fourth point
 }

void main()
{
 std::vector<Point> points;
 load_points(points);

 Delaunay dt;
 dt.insert(points.begin(),points.end());

 for(Delaunay::Finite_edges_iterator it = dt.finite_edges_begin(); it != dt.finite_edges_end(); ++it)
 {
     }
}

首先,需要使用顶点类型,其信息如中所示。然后,边是一对,包含面的控制柄以及面中与边相对的顶点的索引

如果您有:

Delaunay::Edge e=*it;
您要查找的索引包括:

int i1= e.first->vertex( (e.second+1)%3 )->info();
int i2= e.first->vertex( (e.second+2)%3 )->info();