5
我有一組2D點,每個點都有一個關聯的ID。 (例如,如果點存儲在數組中,則id是到每個點0,...,n-1的索引)。CGAL 2D Delaunay三角剖分:如何將邊緣作爲頂點ID對
現在我創建這些點的Delaunay三角剖分,並希望列出所有有限邊緣。對於每個邊,我希望有相應的2個頂點表示的點的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)
{
}
}
sloriot:非常有幫助。謝謝。 – 911 2012-03-25 04:50:28
太清楚了!謝謝。 – LoveMeow 2014-12-27 18:22:16