Commit 3dd929f4 authored by Pierre Kraemer's avatar Pierre Kraemer

MRDAT import OK + closeMap returns number of holes

parent 7596ab32
......@@ -76,10 +76,6 @@ public:
{
if(isSubdivided())
{
unsigned int emb0 = vID[children[0]->indices[0]] ;
unsigned int emb1 = vID[children[0]->indices[1]] ;
unsigned int emb2 = vID[children[0]->indices[2]] ;
Dart d0 = map.phi1(d) ;
Dart d1, d2 ;
if(CCW)
......@@ -93,9 +89,40 @@ public:
d2 = map.phi_1(d) ;
}
map.incCurrentLevel() ;
map.embedOrbit(VERTEX, map.phi1(d0), emb0) ;
map.embedOrbit(VERTEX, map.phi1(d1), emb1) ;
map.embedOrbit(VERTEX, map.phi1(d2), emb2) ;
unsigned int emb0 = vID[children[0]->indices[0]] ;
unsigned int e0 = map.getEmbedding(VERTEX, map.phi2(d0)) ;
if(!cm.isMarked(map.phi2(d0)))
{
assert(e0 == EMBNULL) ;
map.embedOrbit(VERTEX, map.phi2(d0), emb0) ;
cm.mark(map.phi2(d0)) ;
}
else
assert(e0 == emb0) ;
unsigned int emb1 = vID[children[0]->indices[1]] ;
unsigned int e1 = map.getEmbedding(VERTEX, map.phi2(d1)) ;
if(!cm.isMarked(map.phi2(d1)))
{
assert(e1 == EMBNULL) ;
map.embedOrbit(VERTEX, map.phi2(d1), emb1) ;
cm.mark(map.phi2(d1)) ;
}
else
assert(e1 == emb1) ;
unsigned int emb2 = vID[children[0]->indices[2]] ;
unsigned int e2 = map.getEmbedding(VERTEX, map.phi2(d2)) ;
if(!cm.isMarked(map.phi2(d2)))
{
assert(e2 == EMBNULL) ;
map.embedOrbit(VERTEX, map.phi2(d2), emb2) ;
cm.mark(map.phi2(d2)) ;
}
else
assert(e2 == emb2) ;
map.decCurrentLevel() ;
Dart t0 = map.phi_1(d) ;
......@@ -121,6 +148,11 @@ public:
children[3]->embed(map, t3, vID, cm, !CCW) ;
map.decCurrentLevel() ;
}
else
{
if(map.getCurrentLevel() < map.getMaxLevel())
std::cout << "adaptive !!!!!!!" << std::endl ;
}
}
void print()
......
......@@ -235,14 +235,27 @@ bool importMRDAT(typename PFP::MAP& map, const std::string& filename, std::vecto
for(unsigned int i = 0; i < depth; ++i)
map.addNewLevel(false) ;
map.setCurrentLevel(0) ;
map.setCurrentLevel(0) ;
qt.embed(map, verticesID) ;
map.setCurrentLevel(map.getMaxLevel()) ;
for(unsigned int l = 0; l <= map.getMaxLevel(); ++l)
TraversorV<typename PFP::MAP> tv(map, allDarts, true) ;
for(Dart d = tv.begin(); d != tv.end(); d = tv.next())
{
map.setCurrentLevel(l) ;
map.check() ;
unsigned int vertexLevel = map.getDartLevel(d) ;
if(vertexLevel > 0 && vertexLevel < map.getMaxLevel())
{
map.pushLevel() ;
map.setCurrentLevel(vertexLevel) ;
unsigned int emb = map.getEmbedding(VERTEX, d) ;
for(unsigned int i = vertexLevel + 1; i <= map.getMaxLevel(); ++i)
{
map.setCurrentLevel(i) ;
map.embedOrbit(VERTEX, d, emb) ;
}
map.popLevel() ;
}
}
return true ;
......
......@@ -121,8 +121,8 @@ bool importMesh(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts)
if (nbBoundaryEdges > 0)
{
map.closeMap();
CGoGNout << "Map closed (" << nbBoundaryEdges << " boundary edges)" << CGoGNendl;
unsigned int nbH = map.closeMap();
CGoGNout << "Map closed (" << nbBoundaryEdges << " boundary edges / " << nbH << " holes)" << CGoGNendl;
// ensure bijection between topo and embedding
map.bijectiveOrbitEmbedding(VERTEX);
}
......@@ -130,7 +130,6 @@ bool importMesh(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts)
return true ;
}
template <typename PFP>
bool importMeshSToV(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts, float dist)
{
......
......@@ -449,8 +449,9 @@ public:
//! Close the map removing topological holes: DO NOT USE, only for import/creation algorithm
/*! Add faces to the map that close every existing hole.
* These faces are marked as boundary.
* @return the number of closed holes
*/
void closeMap();
unsigned int closeMap();
//@}
};
......
......@@ -338,8 +338,9 @@ public:
//! Close the map removing topological holes: DO NOT USE, only for import/creation algorithm
/*! Add volumes to the map that close every existing hole.
* These faces are marked as boundary.
* @return the number of closed holes
*/
void closeMap();
unsigned int closeMap();
};
} // namespace CGoGN
......
......@@ -456,8 +456,9 @@ public:
//! Close the map removing topological holes: DO NOT USE, only for import/creation algorithm
/*! Add faces to the map that close every existing hole.
* These faces are marked as boundary.
* @return the number of closed holes
*/
void closeMap();
unsigned int closeMap();
//@}
};
......
......@@ -366,8 +366,9 @@ public:
//! Close the map removing topological holes: DO NOT USE, only for import/creation algorithm
/*! Add volumes to the map that close every existing hole.
* These faces are marked as boundary.
* @return the number of closed holes
*/
void closeMap();
unsigned int closeMap();
//@}
};
......
......@@ -896,14 +896,19 @@ unsigned int GMap2::closeHole(Dart d, bool forboundary)
return countEdges ;
}
void GMap2::closeMap()
unsigned int GMap2::closeMap()
{
// Search the map for topological holes (fix points of phi2)
unsigned int nb = 0 ;
for (Dart d = begin(); d != end(); next(d))
{
if (beta2(d) == d)
{
++nb ;
closeHole(d);
}
}
return nb ;
}
} // namespace CGoGN
......@@ -937,14 +937,19 @@ unsigned int GMap3::closeHole(Dart d, bool forboundary)
return count ;
}
void GMap3::closeMap()
unsigned int GMap3::closeMap()
{
// Search the map for topological holes (fix points of beta3)
unsigned int nb = 0 ;
for (Dart d = begin(); d != end(); next(d))
{
if (beta3(d) == d)
{
++nb ;
closeHole(d);
}
}
return nb ;
}
} // namespace CGoGN
......@@ -853,14 +853,19 @@ unsigned int Map2::closeHole(Dart d, bool forboundary)
return countEdges ;
}
void Map2::closeMap()
unsigned int Map2::closeMap()
{
// Search the map for topological holes (fix points of phi2)
unsigned int nb = 0 ;
for (Dart d = begin(); d != end(); next(d))
{
if (phi2(d) == d)
{
++nb ;
closeHole(d);
}
}
return nb ;
}
} // namespace CGoGN
......@@ -922,14 +922,19 @@ unsigned int Map3::closeHole(Dart d, bool forboundary)
return count ;
}
void Map3::closeMap()
unsigned int Map3::closeMap()
{
// Search the map for topological holes (fix points of phi3)
unsigned int nb = 0 ;
for (Dart d = begin(); d != end(); next(d))
{
if (phi3(d) == d)
{
++nb ;
closeHole(d);
}
}
return nb ;
}
} // namespace CGoGN
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