Commit ef05a9fd authored by Pierre Kraemer's avatar Pierre Kraemer

IHM -> ajout simplif subdivision triangles + corrections

parent 7ceecc0e
...@@ -347,11 +347,10 @@ T& AttributeHandler_IHM<T>::operator[](Dart d) ...@@ -347,11 +347,10 @@ T& AttributeHandler_IHM<T>::operator[](Dart d)
unsigned int nbSteps = m->m_curLevel - m->vertexInsertionLevel(d) ; unsigned int nbSteps = m->m_curLevel - m->vertexInsertionLevel(d) ;
unsigned int index = m->getEmbedding(d, orbit) ; unsigned int index = m->getEmbedding(d, orbit) ;
if(index == EMBNULL && nbSteps == 0) if(index == EMBNULL)
{ {
index = m->embedNewCell(orbit, d) ; index = m->embedNewCell(orbit, d) ;
m->m_nextLevelCell[orbit]->operator[](index) = EMBNULL ; m->m_nextLevelCell[orbit]->operator[](index) = EMBNULL ;
return this->m_attrib->operator[](index);
} }
AttributeContainer& cont = m->getAttributeContainer(orbit) ; AttributeContainer& cont = m->getAttributeContainer(orbit) ;
......
...@@ -162,13 +162,39 @@ void coarsenFace(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position) ...@@ -162,13 +162,39 @@ void coarsenFace(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position)
assert(map.faceIsSubdividedOnce(d) || !"Trying to coarsen a non-subdivided face or a more than once subdivided face") ; assert(map.faceIsSubdividedOnce(d) || !"Trying to coarsen a non-subdivided face or a more than once subdivided face") ;
unsigned int cur = map.getCurrentLevel() ; unsigned int cur = map.getCurrentLevel() ;
map.setCurrentLevel(cur + 1) ;
Dart cv = map.phi1(map.phi1(d)) ; unsigned int degree = 0 ;
map.setCurrentLevel(map.getMaxLevel()) ;
map.deleteVertex(cv) ;
map.setCurrentLevel(cur) ;
Dart fit = d ; Dart fit = d ;
do do
{
++degree ;
fit = map.phi1(fit) ;
} while(fit != d) ;
if(degree == 3)
{
fit = d ;
do
{
map.setCurrentLevel(cur + 1) ;
Dart innerEdge = map.phi1(fit) ;
map.setCurrentLevel(map.getMaxLevel()) ;
map.mergeFaces(innerEdge) ;
map.setCurrentLevel(cur) ;
fit = map.phi1(fit) ;
} while(fit != d) ;
}
else
{
map.setCurrentLevel(cur + 1) ;
Dart centralV = map.phi1(map.phi1(d)) ;
map.setCurrentLevel(map.getMaxLevel()) ;
map.deleteVertex(centralV) ;
map.setCurrentLevel(cur) ;
}
fit = d ;
do
{ {
if(map.edgeCanBeCoarsened(fit)) if(map.edgeCanBeCoarsened(fit))
coarsenEdge<PFP>(map, fit, position) ; coarsenEdge<PFP>(map, fit, position) ;
......
...@@ -397,17 +397,31 @@ template <typename MAP2> ...@@ -397,17 +397,31 @@ template <typename MAP2>
bool EmbeddedMap2<MAP2>::mergeFaces(Dart d) bool EmbeddedMap2<MAP2>::mergeFaces(Dart d)
{ {
Dart dNext = MAP2::phi1(d) ; Dart dNext = MAP2::phi1(d) ;
Dart e = MAP2::phi2(d) ;
Dart eNext = MAP2::phi1(e) ;
unsigned int vEmb1 = EMBNULL ;
unsigned int vEmb2 = EMBNULL ;
if(MAP2::isOrbitEmbedded(VERTEX_ORBIT))
{
vEmb1 = MAP2::getDartEmbedding(VERTEX_ORBIT, d) ;
vEmb2 = MAP2::getDartEmbedding(VERTEX_ORBIT, e) ;
}
unsigned int fEmb = EMBNULL ; unsigned int fEmb = EMBNULL ;
if (MAP2::isOrbitEmbedded(FACE_ORBIT)) if (MAP2::isOrbitEmbedded(FACE_ORBIT))
{ {
fEmb = MAP2::getEmbedding(d, FACE_ORBIT) ; fEmb = MAP2::getEmbedding(d, FACE_ORBIT) ;
if(fEmb != EMBNULL)
MAP2::setDartEmbedding(FACE_ORBIT, dNext, fEmb) ;
} }
if(MAP2::mergeFaces(d)) if(MAP2::mergeFaces(d))
{ {
if (MAP2::isOrbitEmbedded(VERTEX_ORBIT))
{
if(vEmb1 != EMBNULL)
MAP2::setDartEmbedding(VERTEX_ORBIT, eNext, vEmb1) ;
if(vEmb2 != EMBNULL)
MAP2::setDartEmbedding(VERTEX_ORBIT, dNext, vEmb2) ;
}
if (MAP2::isOrbitEmbedded(FACE_ORBIT)) if (MAP2::isOrbitEmbedded(FACE_ORBIT))
{ {
MAP2::embedOrbit(FACE_ORBIT, dNext, fEmb) ; MAP2::embedOrbit(FACE_ORBIT, dNext, fEmb) ;
......
...@@ -284,7 +284,7 @@ bool ImplicitHierarchicalMap::faceIsSubdividedOnce(Dart d) ...@@ -284,7 +284,7 @@ bool ImplicitHierarchicalMap::faceIsSubdividedOnce(Dart d)
++m_curLevel ; ++m_curLevel ;
Dart cf = phi2(phi1(d)) ; Dart cf = phi2(phi1(d)) ;
++m_curLevel ; ++m_curLevel ;
if(m_dartLevel[phi1(d)] == m_curLevel && m_edgeId[phi1(d)] != m_edgeId[d]) if(m_dartLevel[phi1(cf)] == m_curLevel && m_edgeId[phi1(cf)] != m_edgeId[cf])
subdOnce = false ; subdOnce = false ;
--m_curLevel ; --m_curLevel ;
--m_curLevel ; --m_curLevel ;
......
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