Commit 7bc719f8 authored by Pierre Kraemer's avatar Pierre Kraemer
Browse files

IHM -> test arete simplifiable

parent 0966f73e
...@@ -174,6 +174,14 @@ public: ...@@ -174,6 +174,14 @@ public:
*/ */
bool edgeIsSubdivided(Dart d) ; bool edgeIsSubdivided(Dart d) ;
/**
* Return true if the edge of d in the current level map
* is subdivided to the next level,
* none of its resulting edges is in turn subdivided to the next level
* and the middle vertex is of degree 2
*/
bool edgeCanBeCoarsened(Dart d) ;
/** /**
* Return true if the face of d in the current level map * Return true if the face of d in the current level map
* has already been subdivided to the next level * has already been subdivided to the next level
...@@ -183,7 +191,7 @@ public: ...@@ -183,7 +191,7 @@ public:
/** /**
* Return true if the face of d in the current level map * Return true if the face of d in the current level map
* is subdivided to the next level * is subdivided to the next level
* and none of these resulting faces is in turn subdivided to the next level * and none of its resulting faces is in turn subdivided to the next level
*/ */
bool faceIsSubdividedOnce(Dart d) ; bool faceIsSubdividedOnce(Dart d) ;
} ; } ;
......
...@@ -144,6 +144,8 @@ template <typename PFP> ...@@ -144,6 +144,8 @@ template <typename PFP>
void coarsenEdge(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position) void coarsenEdge(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position)
{ {
assert(map.getDartLevel(d) <= map.getCurrentLevel() || !"Access to a dart introduced after current level") ; assert(map.getDartLevel(d) <= map.getCurrentLevel() || !"Access to a dart introduced after current level") ;
assert(map.edgeCanBeCoarsened(d) || !"Trying to coarsen an edge that can not be coarsened") ;
} }
template <typename PFP> template <typename PFP>
......
...@@ -131,18 +131,10 @@ Dart ImplicitHierarchicalMap::faceOldestDart(Dart d) ...@@ -131,18 +131,10 @@ Dart ImplicitHierarchicalMap::faceOldestDart(Dart d)
bool ImplicitHierarchicalMap::edgeIsSubdivided(Dart d) bool ImplicitHierarchicalMap::edgeIsSubdivided(Dart d)
{ {
assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ; assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ;
// Dart d2 = phi2(d) ; // Dart d2 = phi2(d) ;
// ++m_curLevel ;
// Dart d2_l = phi2(d) ;
// --m_curLevel ;
// if(d2 != d2_l)
// return true ;
// else
// return false ;
Dart d1 = phi1(d) ; Dart d1 = phi1(d) ;
++m_curLevel ; ++m_curLevel ;
// Dart d2_l = phi2(d) ;
Dart d1_l = phi1(d) ; Dart d1_l = phi1(d) ;
--m_curLevel ; --m_curLevel ;
if(d1 != d1_l) if(d1 != d1_l)
...@@ -151,6 +143,28 @@ bool ImplicitHierarchicalMap::edgeIsSubdivided(Dart d) ...@@ -151,6 +143,28 @@ bool ImplicitHierarchicalMap::edgeIsSubdivided(Dart d)
return false ; return false ;
} }
bool ImplicitHierarchicalMap::edgeCanBeCoarsened(Dart d)
{
assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ;
bool subd = false ;
bool subdOnce = true ;
bool degree2 = false ;
if(edgeIsSubdivided(d))
{
subd = true ;
Dart d2 = phi2(d) ;
++m_curLevel ;
if(vertexDegree(phi1(d)) == 2)
{
degree2 = true ;
if(edgeIsSubdivided(d) || edgeIsSubdivided(d2))
subdOnce = false ;
}
--m_curLevel ;
}
return subd && degree2 && subdOnce ;
}
bool ImplicitHierarchicalMap::faceIsSubdivided(Dart d) bool ImplicitHierarchicalMap::faceIsSubdivided(Dart d)
{ {
assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ; assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ;
......
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