Subject: CGAL users discussion list
List archive
- From: Thiago Milanetto Schlittler <>
- To:
- Subject: [cgal-discuss] Question about the "create_face()"TDS modifier
- Date: Fri, 14 Aug 2015 11:27:43 +0200
Hello!
I’m writing a code to import a 2D triangulation from a Gmsh or medit file into CGAL, and to do so I’m using some of the advanced modifiers of this class. I had no problems inserting the vertices using the “create_vertex()” modifier, but I cannot say the same thing about the “create_face()” modifier. After using it and adding the corresponding vertices with [face_handle]->set_vertices([vertex_handles]), trying to iterate over the faces of the triangulation yields no results, and both [triangulation].number_of_faces() and [triangulation].tds().number_of_faces() return zero. Does anyone have an idea of why this is happening?
I’ve added below the method I’m using to create the faces. “mesh” is the 2D triangulation. “Face_handle_2" and “Vertex_handle_2" are typedefs of the handlers of the triangulation. “mVertexHandleIndexMap” is a map container associating an index to each vertex (also added as part of “info()” for each vertex). The vertex check at the end of the code snipped yields the correct vertices.
Thanks in advance,
Thiago Milanetto Schlittler
void Triangular_Mesh_2::Create_Face_2(std::vector<int>& idx)
{
// Create face
Face_handle_2 outputHandle;
outputHandle = mesh.tds().create_face();
outputHandle->set_neighbors();
Vertex_handle_2 dummyHandle0 = mVertexHandleIndexMap[idx[0]];
Vertex_handle_2 dummyHandle1 = mVertexHandleIndexMap[idx[1]];
Vertex_handle_2 dummyHandle2 = mVertexHandleIndexMap[idx[2]];
outputHandle->set_vertices(dummyHandle0,dummyHandle1,dummyHandle2);
// Set incident faces
mVertexHandleIndexMap[idx[0]]->set_face(outputHandle);
mVertexHandleIndexMap[idx[1]]->set_face(outputHandle);
mVertexHandleIndexMap[idx[2]]->set_face(outputHandle);
// Check vertices
std::cout << "Vertices : “ << mVertexHandleIndexMap[idx[0]]->info().ExtIndex << " "
<< mVertexHandleIndexMap[idx[1]]->info().ExtIndex << " "
<< mVertexHandleIndexMap[idx[2]]->info().ExtIndex << std::endl;
}
- [cgal-discuss] Question about the "create_face()"TDS modifier, Thiago Milanetto Schlittler, 08/14/2015
- Re: [cgal-discuss] Question about the "create_face()"TDS modifier, Monique Teillaud, 08/17/2015
- Re: [cgal-discuss] Question about the "create_face()"TDS modifier, Thiago Milanetto Schlittler, 08/18/2015
- Re: [cgal-discuss] Question about the "create_face()"TDS modifier, Monique Teillaud, 08/17/2015
Archive powered by MHonArc 2.6.18.