Reputation: 84539
The question is clear from the title. I tried a ton of variants of
const DT3::Finite_edges itedges = mesh.finite_edges();
for(DT3::Finite_edges_iterator eit = itedges.begin(); eit != itedges.end(); eit++) {
const CGAL::Triple<DT3::Cell_handle, int, int> edge = *eit;
edge.first->vertex((edge.second+1) % 3)->info();
edge.first->vertex((edge.third+1) % 3)->info();
}
but none has worked (I tried % 2
, % 4
, +2
, etc).
I'm able to get the tetrahedra and the triangles. Of course I could extract the edges from them but that would require to remove some duplicates.
Upvotes: 1
Views: 184
Reputation: 6274
No need to use addition or modular arithmetic. The solution is simpler:
const DT3::Finite_edges itedges = mesh.finite_edges();
for(DT3::Finite_edges_iterator eit = itedges.begin(); eit != itedges.end(); eit++) {
const DT3::Edge edge = *eit;
const DT3::Vertex::Info v1_info = edge.first->vertex(edge.second)->info();
const DT3::Vertex::Info v2_info = edge.first->vertex(edge.third)->info();
}
The documentation of the nested type Edge
is here as well as in the section "Representation" of the user manual of 3D Triangulation Data Structure.
Edit: note that I have chosen to respect your coding style, ignoring modern C++ features. Using C++11 features, I prefer to write it this way, using auto
and range-based for loop:
for(const auto edge: mesh.finite_edges()) {
const auto v1_info = edge.first->vertex(edge.second)->info();
const auto v2_info = edge.first->vertex(edge.third)->info();
}
Upvotes: 3