Commit 49e1fa24 authored by Pierre Kraemer's avatar Pierre Kraemer

add uncutEdge

parent 160ee166
......@@ -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") ;
unsigned int cur = map.getCurrentLevel() ;
Dart d2 = map.phi2(d) ;
// Dart e = map.phi2(d) ;
map.setCurrentLevel(cur + 1) ;
unsigned int dl = map.getDartLevel(d2) ;
map.setDartLevel(map.phi1(d2), dl) ;
map.collapseEdge(d2) ;
// unsigned int dl = map.getDartLevel(e) ;
// map.setDartLevel(map.phi1(e), dl) ;
// map.collapseEdge(e) ;
map.uncutEdge(d) ;
map.setCurrentLevel(cur) ;
}
......
......@@ -55,6 +55,11 @@ public:
*/
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
* @param d a dart of the edge to test
......
......@@ -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>
bool EmbeddedMap2<MAP2>::edgeCanCollapse(Dart d)
{
......
......@@ -90,6 +90,20 @@ 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)
......@@ -112,11 +126,11 @@ Dart Map2::collapseEdge(Dart d, bool delDegenerateFaces)
if (f != e && delDegenerateFaces)
{
Map1::collapseEdge(e); // Collapse edge e
collapseDegeneratedFace(f); // and collapse its face if degenerated
Map1::collapseEdge(e) ; // Collapse edge e
collapseDegeneratedFace(f) ;// and collapse its face if degenerated
}
else
Map1::collapseEdge(e); // Just collapse edge e
Map1::collapseEdge(e) ; // Just collapse edge e
}
Dart f = phi1(d) ;
......@@ -134,11 +148,11 @@ Dart Map2::collapseEdge(Dart d, bool delDegenerateFaces)
if (f != d && delDegenerateFaces)
{
Map1::collapseEdge(d); // Collapse edge d
collapseDegeneratedFace(f); // and collapse its face if degenerated
Map1::collapseEdge(d) ; // Collapse edge d
collapseDegeneratedFace(f) ;// and collapse its face if degenerated
}
else
Map1::collapseEdge(d); // Just collapse edge d
Map1::collapseEdge(d) ; // Just collapse edge d
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