Commit 6c57ca4f authored by Thomas's avatar Thomas
Browse files

Merge branch 'master' of cgogn:~kraemer/CGoGN

parents e8dbdda7 49e1fa24
...@@ -147,11 +147,12 @@ void coarsenEdge(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position) ...@@ -147,11 +147,12 @@ void coarsenEdge(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position)
assert(map.edgeCanBeCoarsened(d) || !"Trying to coarsen an edge that can not be coarsened") ; assert(map.edgeCanBeCoarsened(d) || !"Trying to coarsen an edge that can not be coarsened") ;
unsigned int cur = map.getCurrentLevel() ; unsigned int cur = map.getCurrentLevel() ;
Dart d2 = map.phi2(d) ; // Dart e = map.phi2(d) ;
map.setCurrentLevel(cur + 1) ; map.setCurrentLevel(cur + 1) ;
unsigned int dl = map.getDartLevel(d2) ; // unsigned int dl = map.getDartLevel(e) ;
map.setDartLevel(map.phi1(d2), dl) ; // map.setDartLevel(map.phi1(e), dl) ;
map.collapseEdge(d2) ; // map.collapseEdge(e) ;
map.uncutEdge(d) ;
map.setCurrentLevel(cur) ; map.setCurrentLevel(cur) ;
} }
......
...@@ -55,6 +55,11 @@ public: ...@@ -55,6 +55,11 @@ public:
*/ */
virtual void cutEdge(Dart d) ; virtual void cutEdge(Dart d) ;
/**
* The attributes attached to the edge of d are kept on the resulting edge
*/
virtual void uncutEdge(Dart d) ;
/** /**
* Check if the edge of d can be collapsed or not based on some topological conditions * Check if the edge of d can be collapsed or not based on some topological conditions
* @param d a dart of the edge to test * @param d a dart of the edge to test
......
...@@ -87,6 +87,20 @@ void EmbeddedMap2<MAP2>::cutEdge(Dart d) ...@@ -87,6 +87,20 @@ void EmbeddedMap2<MAP2>::cutEdge(Dart d)
} }
} }
template <typename MAP2>
void EmbeddedMap2<MAP2>::uncutEdge(Dart d)
{
bool doSomethg = (d != MAP2::phi2(d)) ;
MAP2::uncutEdge(d) ;
if(doSomethg)
{
if(MAP2::isOrbitEmbedded(EDGE_ORBIT))
MAP2::copyDartEmbedding(EDGE_ORBIT, MAP2::phi2(d), d) ;
}
}
template <typename MAP2> template <typename MAP2>
bool EmbeddedMap2<MAP2>::edgeCanCollapse(Dart d) bool EmbeddedMap2<MAP2>::edgeCanCollapse(Dart d)
{ {
......
...@@ -130,6 +130,11 @@ public: ...@@ -130,6 +130,11 @@ public:
*/ */
virtual void cutEdge(Dart d); virtual void cutEdge(Dart d);
//! Undo the cut of the edge of d and its opposite edge if it exists
/*! @param d a dart of the edge to uncut
*/
virtual void uncutEdge(Dart d);
//! Collapse an edge (that is deleted) possibly merging its vertices //! Collapse an edge (that is deleted) possibly merging its vertices
/*! If delDegenerateFaces is true, the method checks that no degenerate /*! If delDegenerateFaces is true, the method checks that no degenerate
* faces are built (faces with less than 3 edges). If it occurs the faces * faces are built (faces with less than 3 edges). If it occurs the faces
......
...@@ -88,6 +88,24 @@ void Map2::cutEdge(Dart d) ...@@ -88,6 +88,24 @@ void Map2::cutEdge(Dart d)
} }
} }
void Map2::uncutEdge(Dart d)
{
assert(vertexDegree(phi1(d)) == 2) ;
Dart ne = phi2(d) ;
if(ne == d)
collapseEdge(d) ;
else
{
Dart nd = phi1(d) ;
Dart e = phi_1(ne) ;
phi2unsew(e) ;
phi2unsew(d) ;
Map1::collapseEdge(nd) ;
Map1::collapseEdge(ne) ;
phi2sew(d, e) ;
}
}
Dart Map2::collapseEdge(Dart d, bool delDegenerateFaces) Dart Map2::collapseEdge(Dart d, bool delDegenerateFaces)
{ {
Dart resV ; Dart resV ;
...@@ -108,11 +126,11 @@ Dart Map2::collapseEdge(Dart d, bool delDegenerateFaces) ...@@ -108,11 +126,11 @@ Dart Map2::collapseEdge(Dart d, bool delDegenerateFaces)
if (f != e && delDegenerateFaces) if (f != e && delDegenerateFaces)
{ {
Map1::collapseEdge(e); // Collapse edge e Map1::collapseEdge(e) ; // Collapse edge e
collapseDegeneratedFace(f); // and collapse its face if degenerated collapseDegeneratedFace(f) ;// and collapse its face if degenerated
} }
else else
Map1::collapseEdge(e); // Just collapse edge e Map1::collapseEdge(e) ; // Just collapse edge e
} }
Dart f = phi1(d) ; Dart f = phi1(d) ;
...@@ -130,11 +148,11 @@ Dart Map2::collapseEdge(Dart d, bool delDegenerateFaces) ...@@ -130,11 +148,11 @@ Dart Map2::collapseEdge(Dart d, bool delDegenerateFaces)
if (f != d && delDegenerateFaces) if (f != d && delDegenerateFaces)
{ {
Map1::collapseEdge(d); // Collapse edge d Map1::collapseEdge(d) ; // Collapse edge d
collapseDegeneratedFace(f); // and collapse its face if degenerated collapseDegeneratedFace(f) ;// and collapse its face if degenerated
} }
else else
Map1::collapseEdge(d); // Just collapse edge d Map1::collapseEdge(d) ; // Just collapse edge d
return resV ; return resV ;
} }
......
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