Commit cbc777a1 authored by Sylvain Thery's avatar Sylvain Thery Committed by Pierre Kraemer

nouvelle version mergeFacewithBoundary

parent 7c1c5c11
......@@ -69,7 +69,7 @@ public:
protected:
// protected copy constructor to forbid its usage
DartMarkerGen(const DartMarkerGen& dm) : m_map(dm.m_map)
DartMarkerGen(const DartMarkerGen& dm) : m_map(dm.m_map), m_thread(0), m_mark(NIL)
{}
public:
......@@ -215,7 +215,7 @@ public:
}
protected:
DartMarkerStore(const DartMarkerStore& dm) : DartMarkerGen(dm)
DartMarkerStore(const DartMarkerStore& dm) : DartMarkerGen(dm),m_markedDarts(dm.m_markedDarts)
{}
public:
......
......@@ -112,7 +112,7 @@ public:
/*! @param nbEdges the number of edges
* @return return a dart of the face
*/
Dart newFace(unsigned int nbEdges) ;
virtual Dart newFace(unsigned int nbEdges) ;
//! Create an new face for boundary (marked)
/*! @param nbEdges the number of edges
......
......@@ -117,6 +117,13 @@ protected:
void deleteOrientedFace(Dart d) ; // OK boundary
public:
//! Create an new face of nbEdges
/*! @param nbEdges the number of edges
* @return return a dart of the face
*/
virtual Dart newFace(unsigned int nbEdges) ;
virtual void deleteFace(Dart d) ;
//@}
......
......@@ -40,25 +40,66 @@ void Map2::mergeBoundaryFaces(Dart dd, Dart ee)
Map1::deleteOrientedFace(dd) ;
}
//void Map2::mergeFacewithBoundary(Dart d)
//{
// Dart e = d ;
// do // foreach edge of face
// {
// Dart f = phi2(e);
// if (isBoundaryMarked(f)) // if sewed to boundary
// {
// phi2unsew(e);// ?? not necessary
// Dart ff = phi_1(f);
// if (e != ff)
// phi1sew(e, ff) ; // merge with it
// Dart ee = phi_1(e);
// if (f != ee)
// phi1sew(f, ee) ;
// Map1::deleteOrientedFace(e) ;
// }
// e = phi1(e) ;
// } while (e != d) ;
//}
void Map2::mergeFacewithBoundary(Dart d)
{
std::vector<Dart> storeForLinkVertex;
std::vector<Dart> storeForLinkFace;
Dart e = d ;
do // foreach edge of face
do // foreach vertex/edge of face
{
Dart f = phi2(e);
if (isBoundaryMarked(f)) // if sewed to boundary
Dart f = findBoundaryVertex(alpha1(e)); // check if connexion by vertex
if (f != e)
{
storeForLinkVertex.push_back(phi_1(e));
storeForLinkVertex.push_back(phi_1(f));
}
Dart g = phi2(f);
if (isBoundaryMarked(g)) // check if connextion by a face
{
phi2unsew(e);// ?? not necessary
Dart ff = phi_1(f);
if (e != ff)
phi1sew(e, ff) ; // merge with it
Dart ee = phi_1(e);
if (f != ee)
phi1sew(f, ee) ;
Map1::deleteOrientedFace(e) ;
storeForLinkFace.push_back(f);
storeForLinkFace.push_back(g);
}
e = phi1(e) ;
} while (e != d) ;
// merge by vertices
while (!storeForLinkVertex.empty())
{
Dart a = storeForLinkVertex.pop_back();
Dart b = storeForLinkVertex.pop_back();
phi1sew(a,b);
}
//merge by faces
while (!storeForLinkFace.empty())
{
Dart a = storeForLinkFace.pop_back();
Dart b = storeForLinkFace.pop_back();
mergeBoundaryFaces(a,b);
}
}
void Map2::deleteOrientedFace(Dart d)
......@@ -76,6 +117,22 @@ void Map2::sewOrientedFaces(Dart d, Dart e)
phi2sew(d, e);
}
Dart Map2::newFace(unsigned int nbEdges)
{
Dart d = Map1::newFace(nbEdges);
Dart e = Map1::newBoundaryFace(nbEdges);
Dart x = d;
do
{
phi2sew(d,e);
d = phi1(d);
e = phi1(e);
} while (d != x);
return x;
}
/*! @name Topological Operators
* Topological operations on 2-maps
*************************************************************************/
......
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