Math CGAL 3.4:如何从有限边迭代器获得端点坐标?

Math CGAL 3.4:如何从有限边迭代器获得端点坐标?,math,geometry,2d,computational-geometry,cgal,Math,Geometry,2d,Computational Geometry,Cgal,下面是一些代码: 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_st

下面是一些代码:

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
}

我仍在寻找更好的方法。边提供了面上顶点的索引。三角剖分的面在CGAL中只有3个顶点。边是一个三元组;(脸,i,j)。你可以。因此,要获取顶点,请使用:

v1 = eit->first->vertex(eit->second);
v2 = eit->first->vertex(eit->third);

我设法想出了这个解决方案:

Segment s = ct.segment(eit);
const Point& p1 = s.point(0);
const Point& p2 = s.point(1);
Segment s = ct.segment(eit);
const Point& p1 = s.point(0);
const Point& p2 = s.point(1);

我仍在寻找更好的方法来实现这一点。

我已经使用了类似的方法

三角剖分::顶点_句柄fVertex=eit->first->Vertex(三角剖分::ccw(eit->second))


三角剖分::顶点_句柄sVertex=eit->first->Vertex(三角剖分::cw(eit->second))

谢谢。。。但是,第三个不是eit的成员。。。这是受约束的三角剖分。。。CGAL 3.4我已经用可能的解决方案更新了我的问题。有更好的方法吗?嗯。您可以尝试使用ccw和cw来获取第二个顶点:eit->first->vertex(ct.ccw(eit->second)),但是您这样做似乎是一种非常好的方法,而且可能更好。我认为您这样做很好。