BrunoLevy / geogram

a programming library with geometric algorithms
Other
1.87k stars 126 forks source link

How can I iterate vertices in the order of they are in the loaded .obj file? #156

Closed GtJeight closed 5 months ago

GtJeight commented 5 months ago

I iterate the vertices of a mesh loaded from an .obj like this: for (GEO::index_t v : mesh.vertices) { std::cout << mesh.vertices.point(v).x << " " << mesh.vertices.point(v).y << " " << mesh.vertices.point(v).z << std::endl; } but checking the output coordinates I find that vertices are not permuted in the way they are in the .obj files. However, after saving this mesh to a new .obj file, it reproduces the original vertice order. So I think there should be a way that iterate vertices in correct order?

GtJeight commented 5 months ago

Sorry, that was my wrong that loading from an .obj won't change vertices' order. My output order was changed because I applied some algorithm to the mesh, though I think this shouldn't happen because the algorithm ought not to modifies the input mesh (namely the algorithm remesh_smooth), but this is another issue