1
votes

I've created a 3D Volume mesh using Cgal's documentation and I was succesfully able to visualize my c3t3 (Complex 3 in triangulation 3) object. The mesh is composed of several connected components the number of which i want to find using boost.

Dealing with c2t3 (cimplex 2 in triangulation 3) in the past i iterated over the vertices of the, make pairs with a vertex_descriptor and then again iterate over the edges finding the vertices and by using add_edge i created the undirected graph and finally return the number of c.c.

Now, the c3t3 object only provides iterators about vertices nad cells (not edges - only can be implicitly found). Can you help me pass the c3t3 object to a graph structure of Boost?

So far i did:

for (Cell_iterator c_it=c3t3.cells_in_complex_begin(); c_it != c3t3.cells_in_complex_end(); ++c_it)
{

  Vertex_descriptor vd1 = boost::add_vertex(graph);
  Vertex_descriptor vd2 = boost::add_vertex(graph);
  Vertex_descriptor vd3 = boost::add_vertex(graph);
  Vertex_descriptor vd4 = boost::add_vertex(graph);

  C3t3::Vertex_handle v0 = c_it->vertex(0);
  C3t3::Vertex_handle v1 = c_it->vertex(1);
  C3t3::Vertex_handle v2 = c_it->vertex(2);
  C3t3::Vertex_handle v3 = c_it->vertex(3);

  vertex_id_map.insert(std::make_pair(v0, vd1));
  vertex_id_map.insert(std::make_pair(v1, vd2));
  vertex_id_map.insert(std::make_pair(v2, vd3));
  vertex_id_map.insert(std::make_pair(v3, vd4));
}

Now i have to create the edges but i don;t know where to find the correct edges correspond to my c3t3 object.. Thank you for your help in advance

1
You have not reacted to the answer from Michael Simbirsky. Has it answered your question?lrineau

1 Answers

1
votes

CGAL provides "Boost Graph adapters" for many of its classes (at least for triangulations, arrangements and for polyhedral surfaces). See more details in CGAL BGL page.

Essentially all DCEL- or similar structures can be viewed as a combination of two graphs, "primary" for vertex-edge relationships and "dual" for cell-edge relationships; CGAL provides Boost graph adapters for both.

If this out-of-box graphs are not good for you, than you have to answer your central question: how do you iterate over edges of a given cell (i.e. over edges of the "dual" graph) or over edges of a given vertex (i.e. over edges of the "primal" graph).