nmwsharp / polyscope

A C++ & Python viewer for 3D data like meshes and point clouds
https://polyscope.run
MIT License
1.83k stars 203 forks source link

Polyscope and Geometry central disagree on the number of halfedges in a mesh ? #295

Open MathNewBalance opened 2 months ago

MathNewBalance commented 2 months ago

Not sure if anyone else has found this or if I am doing this wrong but I have found that when loading a mesh in with geometry central and then trying to add a halfedge scalar value to the mesh in polyscope I get an error as polyscope thinks there is fewer halfedges than geometry central does. Incase I am doing something stupid I have added a snipped below.


polyscope::init();
//Load Mesh 
std::tie(mesh, geometry) = readManifoldSurfaceMesh("QuadMesh.obj");
//Register Mesh
sm = polyscope::registerSurfaceMesh("my mesh", geometry->vertexPositions, mesh->getFaceVertexList());
//Object to store halfedge values
HalfedgeData<int> visitedHE(*mesh, 0);

// Filling data (This is not the way I am actually doing it, but its essentially the same )
for(Halfedge he : mesh->halfedges()){
visitedHE[he] =1;
}

sm->addHalfedgeScalarQuantity("HEvisit", visitedHE)->setEnabled(true);

polyscope::show();

From the mesh I have Geometry Central thinks that I have 10974 halfedges but polyscope thinks I have 10928 halfedges??

If I am missing something obvious then please let me know.

MathNewBalance commented 2 months ago

I found out a bit more.

This seems to be a difference in how Polyscope and Geometry central treat meshes with a boundary curve. When the mesh is a closed surface they have the same number of halfedges however when there is a boundary curve the difference in halfedge count matches the number of edges in the boundary loop.