Subject: CGAL users discussion list
List archive
- From: Thiago Milanetto Schlittler <>
- To:
- Subject: Re: [cgal-discuss] Question about the "create_face()"TDS modifier
- Date: Tue, 18 Aug 2015 16:19:14 +0200
Hello!
I am not sure what is going on precisely, but what looks very clear is that something important is missing in your code: you must set adjacency relations (in both directions) between the new face and other faces of the triangulation.
Yes, the version of the function that I send didn’t build the adjacency relations, but the problem wasn't linked to this: I simply forgot to set the dimension of the triangulation before building it … adding the line
mesh.tds().set_dimension(2);
before starting the whole algorithm fixed the face creation problem, and setting the adjacency relations à posteriori works fine for the finite faces (still testing for the infinite ones, but it seems to work).
Thanks for the response!
Thiago Milanetto Schlittler
On 17 Aug 2015, at 15:45, Monique Teillaud <> wrote:
Hi,
I am not sure what is going on precisely, but what looks very clear is that something important is missing in your code: you must set adjacency relations (in both directions) between the new face and other faces of the triangulation.
Best,
--
Monique Teillaud
http://www.loria.fr/~teillaud/
INRIA Nancy - Grand Est, LORIA
Institut National de Recherche en Informatique et Automatique
Le 14/08/15 11:27, Thiago Milanetto Schlittler a écrit :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;
}
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss
- [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.