Commit a3219fc5 authored by Pierre Kraemer's avatar Pierre Kraemer

correction sewFaces dans embeddedMap2

parent b70a54c5
......@@ -38,15 +38,13 @@ namespace Import
template <typename PFP>
bool importMesh(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts)
{
typedef typename PFP::VEC3 VEC3 ;
AutoAttributeHandler< NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, VERTEX, "incidents");
unsigned nbf = mts.getNbFaces();
int index = 0;
// buffer for tempo faces (used to remove degenerated edges)
std::vector<unsigned int> edgesBuffer;
edgesBuffer.reserve(8);
edgesBuffer.reserve(16);
DartMarkerNoUnmark m(map) ;
......@@ -79,7 +77,6 @@ bool importMesh(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts)
{
unsigned int em = edgesBuffer[j]; // get embedding
map.embedOrbit(VERTEX, d, em) ;
// map.setDartEmbedding(VERTEX, d, em); // associate to dart
vecDartsPerVertex[em].push_back(d); // store incident darts for fast adjacency reconstruction
d = map.phi1(d);
}
......@@ -124,9 +121,8 @@ bool importMesh(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts)
{
map.closeMap();
CGoGNout << "Map closed (" << nbnm << " boundary edges)" << CGoGNendl;
// ensure bijection between topo a embedding
// ensure bijection between topo and embedding
map.bijectiveOrbitEmbedding(VERTEX);
}
return true ;
......
......@@ -101,7 +101,7 @@ public:
* The attributes attached to the vertices of the edge of d are kept on the vertices of the resulting edge
* The attributes attached to the edge of d are kept on the resulting edge
*/
virtual void sewFaces(Dart d, Dart e, bool withBoundary=true) ;
virtual void sewFaces(Dart d, Dart e, bool withBoundary = true) ;
/**
* The attributes attached to the vertices of the old edge of d are duplicated on the vertices of both resulting edges
......
......@@ -295,28 +295,22 @@ void EmbeddedGMap2::sewFaces(Dart d, Dart e, bool withBoundary)
{
// for fixed point construction (import & primitives)
if (!withBoundary)
return GMap2::sewFaces(d, e, false) ;
unsigned int vEmb1 = EMBNULL ;
unsigned int vEmb2 = EMBNULL ;
if (isOrbitEmbedded(VERTEX))
{
vEmb1 = getEmbedding(VERTEX, d) ;
vEmb2 = getEmbedding(VERTEX, phi1(d)) ;
GMap2::sewFaces(d, e, false) ;
return ;
}
GMap2::sewFaces(d, e, true) ;
if (isOrbitEmbedded(VERTEX))
{
embedOrbit(VERTEX, d, vEmb1) ;
embedOrbit(VERTEX, e, vEmb2) ;
embedOrbit(VERTEX, d, getEmbedding(VERTEX, d)) ;
embedOrbit(VERTEX, e, getEmbedding(VERTEX, beta0(d))) ;
}
if (isOrbitEmbedded(EDGE))
{
vEmb1 = getEmbedding(EDGE, d) ;
embedOrbit(EDGE, e, vEmb1) ;
embedOrbit(EDGE, e, getEmbedding(EDGE, d)) ;
}
}
......
......@@ -705,6 +705,16 @@ bool GMap2::check()
}
CGoGNout << "Check: topology ok" << CGoGNendl;
std::cout << "nb vertex orbits" << getNbOrbits(VERTEX) << std::endl ;
std::cout << "nb vertex cells" << m_attribs[VERTEX].size() << std::endl ;
std::cout << "nb edge orbits" << getNbOrbits(EDGE) << std::endl ;
std::cout << "nb edge cells" << m_attribs[EDGE].size() << std::endl ;
std::cout << "nb face orbits" << getNbOrbits(FACE) << std::endl ;
std::cout << "nb face cells" << m_attribs[FACE].size() << std::endl ;
return true;
}
......
......@@ -259,8 +259,11 @@ bool EmbeddedMap2::flipBackEdge(Dart d)
void EmbeddedMap2::sewFaces(Dart d, Dart e, bool withBoundary)
{
// if (!withBoundary)
// return Map2::sewFaces(d, e, false) ;
if (!withBoundary)
{
Map2::sewFaces(d, e, false) ;
return ;
}
Map2::sewFaces(d, e, withBoundary) ;
......
......@@ -28,65 +28,6 @@
namespace CGoGN
{
/*! @name Boundary marker management
* Function used to merge boundary faces properly
*************************************************************************/
//void Map2::mergeBoundaryFaces(Dart dd, Dart ee)
//{
// if (ee != phi_1(dd))
// phi1sew(ee, phi_1(dd)) ;
// if (dd != phi_1(ee))
// phi1sew(dd, phi_1(ee)) ;
// deleteCycle(dd);
//}
//void Map2::mergeFaceWithBoundary(Dart d)
//{
// std::vector<Dart> storeForLinkVertex;
// std::vector<Dart> storeForLinkFace;
//
// Dart it = d ;
// do // foreach vertex/edge of face
// {
// Dart e = phi2(it) ;
// if(isBoundaryMarked(e)) // check if connection by edge
// {
// storeForLinkFace.push_back(it);
// storeForLinkFace.push_back(e);
// }
// else
// {
// Dart f = findBoundaryEdgeOfVertex(alpha1(it)); // check if connection by vertex
// if (f != it)
// {
// storeForLinkVertex.push_back(phi_1(it));
// storeForLinkVertex.push_back(phi_1(f));
// }
// }
// it = phi1(it) ;
// } while (it != d) ;
//
// // merge by vertices
// while (!storeForLinkVertex.empty())
// {
// Dart a = storeForLinkVertex.back() ;
// storeForLinkVertex.pop_back() ;
// Dart b = storeForLinkVertex.back() ;
// storeForLinkVertex.pop_back() ;
// phi1sew(a, b);
// }
// //merge by faces
// while (!storeForLinkFace.empty())
// {
// Dart a = storeForLinkVertex.back() ;
// storeForLinkVertex.pop_back() ;
// Dart b = storeForLinkVertex.back() ;
// storeForLinkVertex.pop_back() ;
// mergeBoundaryFaces(a, b);
// }
//}
/*! @name Generator and Deletor
* To generate or delete faces in a 2-map
*************************************************************************/
......@@ -694,6 +635,7 @@ bool Map2::check()
if (phi2(d1) == d)
CGoGNout << "Check: (warning) dangling edge" << CGoGNendl;
}
for(Dart d = Map2::begin(); d != Map2::end(); Map2::next(d))
{
if (!m.isMarked(d)) // phi1 a au moins un antécédent ?
......@@ -702,7 +644,18 @@ bool Map2::check()
return false;
}
}
CGoGNout << "Check: topology ok" << CGoGNendl;
std::cout << "nb vertex orbits" << getNbOrbits(VERTEX) << std::endl ;
std::cout << "nb vertex cells" << m_attribs[VERTEX].size() << std::endl ;
std::cout << "nb edge orbits" << getNbOrbits(EDGE) << std::endl ;
std::cout << "nb edge cells" << m_attribs[EDGE].size() << std::endl ;
std::cout << "nb face orbits" << getNbOrbits(FACE) << std::endl ;
std::cout << "nb face cells" << m_attribs[FACE].size() << std::endl ;
return true;
}
......
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