Commit 6c6cad56 authored by Pierre Kraemer's avatar Pierre Kraemer

update import mesh to handle non-manifold edges with a pair number of faces

parent 7de130a9
......@@ -92,6 +92,8 @@ bool importMesh(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts)
}
}
bool needBijectiveCheck = false;
// reconstruct neighbourhood
unsigned int nbBoundaryEdges = 0;
for (Dart d = map.begin(); d != map.end(); map.next(d))
......@@ -103,27 +105,31 @@ bool importMesh(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts)
unsigned int embd = map.template getEmbedding<VERTEX>(d);
Dart good_dart = NIL;
bool firstOK = true;
for (typename std::vector<Dart>::iterator it = vec.begin(); it != vec.end() && good_dart == NIL; ++it)
{
if (map.template getEmbedding<VERTEX>(map.phi1(*it)) == embd)
good_dart = *it;
}
if (good_dart != NIL)
{
if (good_dart == map.phi2(good_dart))
{
map.sewFaces(d, good_dart, false);
m.unmarkOrbit<EDGE>(d);
}
else
{
++nbBoundaryEdges;
good_dart = *it;
if (good_dart == map.phi2(good_dart))
{
map.sewFaces(d, good_dart, false);
m.unmarkOrbit<EDGE>(d);
}
else
{
good_dart = NIL;
firstOK = false;
}
}
}
else
if (!firstOK)
needBijectiveCheck = true;
if (good_dart == NIL)
{
m.unmark(d);
m.unmarkOrbit<EDGE>(d);
++nbBoundaryEdges;
}
}
......@@ -133,6 +139,10 @@ bool importMesh(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts)
{
unsigned int nbH = map.closeMap();
CGoGNout << "Map closed (" << nbBoundaryEdges << " boundary edges / " << nbH << " holes)" << CGoGNendl;
}
if (needBijectiveCheck)
{
// ensure bijection between topo and embedding
map.template bijectiveOrbitEmbedding<VERTEX>();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment