Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Surface Mesh indices are invalid during manual export

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Surface Mesh indices are invalid during manual export


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] Surface Mesh indices are invalid during manual export
  • Date: Fri, 7 Jun 2019 07:59:33 +0200
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-phdr: 9a23:5jUY8hSnk1fdT88N+tkxoSsuM9psv+yvbD5Q0YIujvd0So/mwa6yZhCN2/xhgRfzUJnB7Loc0qyK6vmmADBdqs/Z6DgrS99lb1c9k8IYnggtUoauKHbQC7rUVRE8B9lIT1R//nu2YgB/Ecf6YEDO8DXptWZBUhrwOhBoKevrB4Xck9q41/yo+53Ufg5EmCexbal9IRmrsAndrNQajIRiJ6o+1xfFvmdEcPlKyG11Il6egwzy7dqq8p559CRQtfMh98peXqj/Yq81U79WAik4Pm4s/MHkugXNQgWJ5nsHT2UZiQFIDBTf7BH7RZj+rC33vfdg1SaAPM32Sbc0WSm+76puVRTlhjsLOyI//WrKjMF7kaBVrw+7pxFn3oDafo+VOvp9cK3Tc9wVSmhOUdpeWSFaHoOxbZECA/YdMetWrYTwoUYFoxukBQmrAePi0jFEiGLo0qIhyeshCh3G3A0+ENIIrX/aqtL1NL0TUeCy0KnD0DHPYfJI1jf67YjHbAwhoeuMXLxwa8Xe1VUvFwTfjlSQrIDpMS6e2+MWs2if6OpgT+Ovi2k7qw1rpzivwtwhiobMho0Py1DE8T91z5oyJd29UUN2Z8OvHphItyyCKYd6XscvT3trtSs60LEKpIC3cSsQxJknyRPTc/6KfouS7h79W+ucIC10iG9hdb+xnRq/80itx+vhXceuyllKtDBKktzUu3ANyRPT7s+HR+N4/ki72DaP0xnf6+9BIUwpjKbbJZ4sz7AqmpoctkTDGSD2mEHog6OMakok/e2o5/zmYrXguJCcK5d5hh/iPqkqgMCyAuQ1PhITU2SF+umwzr3u8EPhTLVPlPI2k63ZsJ7AJcQco660GxRV0oIk6xalDjem18gYkWMCLFJBYx+HgI3pNEvPIPD8F/uwn1OskDJzy/DcIrLhGonNLmTEkLr5Ybl95FRTyA4qwd9C5pJUEa0OIO/oWk/qr9HYFR84Mwmsw+n9Etl914UeWXiOAqCDKq/Sv0WItaoTJLyHa4YR/Tr8MPM4/OXGjHkjmFZbc7P684EQbSXyJflsKl6FYHfqyvMGC2YNokJ+Y+HtjVCeSy99bn2uWLgtp3tzXJmiCp3CQZzrhbip0yKyH5kQbWdDXAPfWUz0fpmJDq9fIBmZJdVsx2RdCeqRDrQ53BTrjzfUjqJ9J7ONqCIdvJPnktNy4r+LzEBgxXlPF82Yllq1YSRxl2IMSSUx2fkm80N4w1aHl6N/hq4BTIEB17ZySg4/cKXk4al6BtT1AF+Te96ITBO5R4zjD2xqCN02xNAKbgB2HNDw1h0=

Can you provide a minimal example showing the pb?
With what you provide it is hard to guess what went wrong.

Sebastien.

On 6/6/19 10:47 PM, Rash wrote:
Dear mailing list,

why are there invalid indices when using surface mesh? I have 2275
correct vertices in it. But somehow the mesh got 13637 vertices. Some of
may be invalid.

Lets have a look:

Data in mesh -> vpoints_ -> data:

[2] -0.532385 -2.32635 -0.1027

Data in my file:

Verts:
[0] -0.532385 -2.32635 -0.1027
Faces:
[0] 2 4 13273

The [0] 2 seems to refer to the internal mesh element address not to the
second good vertex which mesh.point(vd) delivers.

Strange why is the first vertex in my list the second in the mesh? Oh
this is a pattern. There seem to be 13637 vertices in mesh, but only
2275 good ones. You may ask why. Or why there is no offset, which would
correct for it when you write the data out. To be honest, it took me
some time find this out. How do I get the correct indices?

Here is some code.



std::to_string(mesh.number_of_vertices()); //2275


//2275 vertices, cool lets write them down to my debug file
for(Vertex_index vd : mesh.vertices())
{
const Point p(mesh.point(vd));
myfile << p.x() << " " << p.y() << " " << p.z() << std::endl;
}


//cool now i go over all faces, save the vertex indices and have my nice
mesh

for(auto it = faces.begin(); it != faces.end(); it++)
{
face_descriptor fd = *it;


HalfEdgeIndex edge = mesh.halfedge(fd);

Vertex_index vert1=source(edge, mesh);
Vertex_index vert2=source(next(edge, mesh), mesh);
Vertex_index vert3=source(next(next(edge, mesh), mesh), mesh);

//save them to tris

}

//lets write the triangles into a file, easy we have Vertex_indices,
right? Oh no, of course not. THIS IS CGAL (image this with king leonidas
voice)
for(size_t i = 0; i < tris.size(); i++)
{
myfile << tris[i] << std::endl; //and we got the wrong indices,
suprise!
}




Archive powered by MHonArc 2.6.18.

Top of Page