Commit 16b913c1 authored by Pierre Kraemer's avatar Pierre Kraemer
Browse files

correctifs bijectiveOrbitEmbedding et closeHole

parent 1b28477f
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "Topology/generic/attribmap.h" #include "Topology/generic/attribmap.h"
#include "Topology/generic/autoAttributeHandler.h" #include "Topology/generic/autoAttributeHandler.h"
#include "Topology/generic/dartmarker.h" #include "Topology/generic/dartmarker.h"
namespace CGoGN namespace CGoGN
{ {
...@@ -54,7 +55,6 @@ void AttribMap::clear(bool removeAttrib) ...@@ -54,7 +55,6 @@ void AttribMap::clear(bool removeAttrib)
init() ; init() ;
} }
/**************************************** /****************************************
* UTILITIES * * UTILITIES *
****************************************/ ****************************************/
...@@ -72,8 +72,8 @@ void AttribMap::bijectiveOrbitEmbedding(unsigned int orbit) ...@@ -72,8 +72,8 @@ void AttribMap::bijectiveOrbitEmbedding(unsigned int orbit)
{ {
assert(isOrbitEmbedded(orbit) || !"Invalid parameter: orbit not embedded") ; assert(isOrbitEmbedded(orbit) || !"Invalid parameter: orbit not embedded") ;
AutoAttributeHandler<int> counter(*this,VERTEX); AutoAttributeHandler<int> counter(*this, orbit) ;
counter.setAllValues(int(0)); counter.setAllValues(int(0)) ;
DartMarker mark(*this) ; DartMarker mark(*this) ;
for(Dart d = begin(); d != end(); next(d)) for(Dart d = begin(); d != end(); next(d))
...@@ -81,19 +81,19 @@ void AttribMap::bijectiveOrbitEmbedding(unsigned int orbit) ...@@ -81,19 +81,19 @@ void AttribMap::bijectiveOrbitEmbedding(unsigned int orbit)
if(!mark.isMarked(d)) if(!mark.isMarked(d))
{ {
mark.markOrbit(orbit, d) ; mark.markOrbit(orbit, d) ;
unsigned int emb = getEmbedding(orbit, d); unsigned int emb = getEmbedding(orbit, d) ;
if (emb != EMBNULL) if (emb != EMBNULL)
{ {
if (counter[d]>0) if (counter[d] > 0)
{ {
unsigned int newEmb = embedNewCell(orbit, d) ; unsigned int newEmb = embedNewCell(orbit, d) ;
copyCell(VERTEX,newEmb,emb); copyCell(orbit, newEmb, emb) ;
} }
counter[d]++; counter[d]++ ;
} }
} }
} }
} }
} // namespace CGoGN } // namespace CGoGN
...@@ -379,7 +379,7 @@ bool Map2::collapseDegeneratedFace(Dart d) ...@@ -379,7 +379,7 @@ bool Map2::collapseDegeneratedFace(Dart d)
if (e2 != e) phi2unsew(e); if (e2 != e) phi2unsew(e);
if (d2 != d && e2 != e) if (d2 != d && e2 != e)
phi2sew(d2, e2); phi2sew(d2, e2);
deleteCycle(d);// Delete the single edge or two edges of the loop deleteCycle(d); // Delete the single edge or two edges of the loop
return true ; return true ;
} }
return false ; return false ;
...@@ -974,13 +974,16 @@ unsigned int Map2::closeHole(Dart d, bool forboundary) ...@@ -974,13 +974,16 @@ unsigned int Map2::closeHole(Dart d, bool forboundary)
} }
} while (dPhi1 != d); } while (dPhi1 != d);
if (countEdges == 2) if (countEdges < 3)
{ {
countEdges = 0 ; countEdges = 0 ;
collapseDegeneratedFace(first); // if the closing face is 2-sided, collapse it collapseDegeneratedFace(first); // if the closing face is 2-sided, collapse it
} }
else
boundaryMarkOrbit(FACE, phi2(d)); {
if(forboundary)
boundaryMarkOrbit(FACE, phi2(d));
}
return countEdges ; return countEdges ;
} }
......
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