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

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) ...@@ -92,6 +92,8 @@ bool importMesh(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts)
} }
} }
bool needBijectiveCheck = false;
// reconstruct neighbourhood // reconstruct neighbourhood
unsigned int nbBoundaryEdges = 0; unsigned int nbBoundaryEdges = 0;
for (Dart d = map.begin(); d != map.end(); map.next(d)) for (Dart d = map.begin(); d != map.end(); map.next(d))
...@@ -103,27 +105,31 @@ bool importMesh(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts) ...@@ -103,27 +105,31 @@ bool importMesh(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts)
unsigned int embd = map.template getEmbedding<VERTEX>(d); unsigned int embd = map.template getEmbedding<VERTEX>(d);
Dart good_dart = NIL; Dart good_dart = NIL;
bool firstOK = true;
for (typename std::vector<Dart>::iterator it = vec.begin(); it != vec.end() && good_dart == NIL; ++it) 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) 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); good_dart = *it;
m.unmarkOrbit<EDGE>(d); if (good_dart == map.phi2(good_dart))
} {
else map.sewFaces(d, good_dart, false);
{ m.unmarkOrbit<EDGE>(d);
++nbBoundaryEdges; }
else
{
good_dart = NIL;
firstOK = false;
}
} }
} }
else
if (!firstOK)
needBijectiveCheck = true;
if (good_dart == NIL)
{ {
m.unmark(d); m.unmarkOrbit<EDGE>(d);
++nbBoundaryEdges; ++nbBoundaryEdges;
} }
} }
...@@ -133,6 +139,10 @@ bool importMesh(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts) ...@@ -133,6 +139,10 @@ bool importMesh(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts)
{ {
unsigned int nbH = map.closeMap(); unsigned int nbH = map.closeMap();
CGoGNout << "Map closed (" << nbBoundaryEdges << " boundary edges / " << nbH << " holes)" << CGoGNendl; CGoGNout << "Map closed (" << nbBoundaryEdges << " boundary edges / " << nbH << " holes)" << CGoGNendl;
}
if (needBijectiveCheck)
{
// ensure bijection between topo and embedding // ensure bijection between topo and embedding
map.template bijectiveOrbitEmbedding<VERTEX>(); 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