【发布时间】:2010-01-22 05:45:34
【问题描述】:
这里有一些代码:
struct K : CGAL::Exact_predicates_inexact_constructions_kernel {};
typedef CGAL::Triangulation_vertex_base_2<K> Vb;
typedef CGAL::Constrained_triangulation_face_base_2<K> Fb;
typedef CGAL::Triangulation_data_structure_2<Vb,Fb> TDS;
typedef CGAL::Exact_predicates_tag Itag;
typedef CGAL::Constrained_triangulation_2<K, TDS, Itag> CT;
typedef CT::Point Point;
for (CT::Finite_edges_iterator eit = ct.finite_edges_begin();
eit != ct.finite_edges_end(); ++eit){
// TODO: list vertex co-ordinates here
}
来自manual:
"边没有显式表示,它们只是通过两个面的邻接关系隐式表示。每条边有两种隐式表示:与索引为i的顶点相对的面f的边可以表示为以及 f 的邻居(i)的一条边。”
这对我来说很好......但是如何在上面给出的代码中使用CT::Finite_edges_iterator 获得边缘的末端顶点?
更新: 我设法想出了这个解决方案:
Segment s = ct.segment(eit);
const Point& p1 = s.point(0);
const Point& p2 = s.point(1);
我仍在寻找更好的方法来做到这一点。
【问题讨论】:
-
我认为你的做法很好。
标签: math geometry 2d computational-geometry cgal