CGAL 3.4:如何从 Finite_edges_iterator 获取结束顶点坐标?

发布于 2024-08-18 17:46:47 字数 1194 浏览 11 评论 0原文

这是一些代码:

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
}

来自 手册:

“边没有显式表示,它们只是通过两个面的邻接关系隐式表示。每条边有两个隐式表示:与索引 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);

我仍在寻找更好的方法来做到这一点。

Here is some code:

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
}

From the manual:

"The edges are not explicitly represented, they are only implicitly represented through the adjacency relations of two faces. Each edge has two implicit representations: the edge of a face f which is opposed to the vertex indexed i, can be represented as well as an edge of the neighbor(i) of f."

That's fine by me... but how do I get the end vertices of the edge using a CT::Finite_edges_iterator in the code given above?

Update:
I managed to come up with this solution:

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

I am still looking for a better way to do this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

和我恋爱吧 2024-08-25 17:46:47

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

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

我仍在寻找更好的方法来做到这一点。

I managed to come up with this solution:

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

I am still looking for a better way to do this.

缱倦旧时光 2024-08-25 17:46:47

我使用类似

Triangulation::Vertex_handle fVertex = eit->first->vertex(Triangulation::ccw(eit->second)); 的

东西Triangulation::Vertex_handle sVertex = eit->first->vertex(Triangulation::cw(eit->second));

I have using something like

Triangulation::Vertex_handle fVertex = eit->first->vertex(Triangulation::ccw(eit->second));

Triangulation::Vertex_handle sVertex = eit->first->vertex(Triangulation::cw(eit->second));

夏天碎花小短裙 2024-08-25 17:46:47

边提供面上顶点的索引。在 CGAL 中,三角剖分的面只有 3 个顶点。边是三元组; (脸,i,j)。您可以 获取第 i 个(0、1 ,或 2) 使用 vertex(i) 方法获取面的顶点。。因此,要获取顶点,请使用:

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

The edges provide the indices of the vertices on the face. The face of a triangulation has only 3 vertices in CGAL. Edges are a triplet; (face, i, j). You can get the i-th (either 0, 1, or 2) vertex of a face using the vertex(i) method.. So, to get the vertices, use:

v1 = eit->first->vertex(eit->second);
v2 = eit->first->vertex(eit->third);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文