CGAL 3.4: How to get the coordinates of end vertices from Finite_edges_iterator?

Here is the 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 manual :

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

This is good for me ... but how do I get the final vertex edges using CT::Finite_edges_iteratorin the above code?

Update: I managed to find this solution:

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

I'm still looking for a better way to do this.

+3
source share
3

:

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

.

+2

-

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

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

+1

. 3 CGAL. - ; (, i, j). i- (0, 1 2) (i).. , , :

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

Source: https://habr.com/ru/post/1729520/


All Articles