我有一组带有关联id的2D点。(例如,如果这些点存储在数组中,则id是每个点0,....,n-1的索引。)
现在我创建了这些点的Delaunay三角剖分,并想列出所有有限边。对于每条边,我想要对应的两个顶点表示的点的id。例如:如果点0和点2之间有一条边,则为(0,2)。这是否可能?
现在我创建了这些点的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)
{
}
}