Commit b70ccab9 authored by Thomas's avatar Thomas

adding mergeFaces on map3

parent d360e0e7
...@@ -84,6 +84,11 @@ public: ...@@ -84,6 +84,11 @@ public:
*/ */
virtual void splitFace(Dart d, Dart e); virtual void splitFace(Dart d, Dart e);
/**
* The attributes attached to the face of dart d are kept on the resulting face
*/
virtual bool mergeFaces(Dart d);
//! //!
/*! /*!
* *
......
...@@ -209,6 +209,14 @@ public: ...@@ -209,6 +209,14 @@ public:
*/ */
virtual void splitFace(Dart d, Dart e); virtual void splitFace(Dart d, Dart e);
//! Merge the two faces incident to the edge of d.
/*! Works only for edges of degree 2.
* \warning Darts of the edge of d no longer exist after the call
* @param d a dart in the first face
* @return true if the merge has been executed, false otherwise
*/
virtual bool mergeFaces(Dart d);
//! Collapse a face (that is deleted) possibly merging its vertices //! Collapse a face (that is deleted) possibly merging its vertices
/*! \warning /*! \warning
* @param d a dart in the deleted face * @param d a dart in the deleted face
......
...@@ -235,6 +235,28 @@ void EmbeddedMap3::splitFace(Dart d, Dart e) ...@@ -235,6 +235,28 @@ void EmbeddedMap3::splitFace(Dart d, Dart e)
} }
} }
bool EmbeddedMap3::mergeFaces(Dart d)
{
Dart d1 = phi1(d);
if(Map3::mergeFaces(d))
{
if(isOrbitEmbedded<FACE2>())
{
embedOrbit<FACE2>(d1, getEmbedding<FACE2>(d1)) ;
}
if(isOrbitEmbedded<FACE>())
{
embedOrbit<FACE>(d1, getEmbedding<FACE>(d1)) ;
}
return true;
}
return false;
}
//! //!
/*! /*!
* *
......
...@@ -557,6 +557,33 @@ void Map3::splitFace(Dart d, Dart e) ...@@ -557,6 +557,33 @@ void Map3::splitFace(Dart d, Dart e)
phi3sew(phi_1(e), phi_1(dd)); phi3sew(phi_1(e), phi_1(dd));
} }
bool Map3::mergeFaces(Dart d)
{
assert(edgeDegree(d)==2);
Dart dd = phi3(d);
phi3unsew(d);
phi3unsew(dd);
//use code of mergesFaces to override the if(isBoundaryEdge)
//we have to merge the faces if the face is linked to a border also
// Map2::mergeFaces(d);
Dart e = phi2(d) ;
phi2unsew(d) ;
Map1::mergeCycles(d, phi1(e)) ;
Map1::splitCycle(e, phi1(d)) ;
Map1::deleteCycle(d) ;
// Map2::mergeFaces(dd);
e = phi2(dd) ;
phi2unsew(dd) ;
Map1::mergeCycles(dd, phi1(e)) ;
Map1::splitCycle(e, phi1(dd)) ;
Map1::deleteCycle(dd);
return true;
}
Dart Map3::collapseFace(Dart d, bool delDegenerateVolumes) Dart Map3::collapseFace(Dart d, bool delDegenerateVolumes)
{ {
Dart resV = NIL; Dart resV = NIL;
......
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