void subdivideK33_first(int times){ subdivideEdge(0, 6); subdivideK33impl(times-1); revertLastSubdivision(); subdivideEdge(0, 4); subdivideK33impl(times-1); revertLastSubdivision(); }
void subdivideK33impl(int times){ if(times == 0){ createMatching(); return; } int i, j; for(i = 0; i < 3; i++){ for(j = 0; j < 3; j++){ subdivideEdge(i, graph[i][j]); subdivideK33impl(times - 1); revertLastSubdivision(); } } }
unsigned int IHM2<PFP>::subdivideFace(Dart d, bool triQuad, bool OneLevelDifference) { assert(m_map.getDartLevel(d) <= m_map.getCurrentLevel() || !"subdivideFace : called with a dart inserted after current level") ; assert(!m_map.faceIsSubdivided(d) || !"Trying to subdivide an already subdivided face") ; unsigned int fLevel = m_map.faceLevel(d) ; Dart old = m_map.faceOldestDart(d) ; unsigned int cur = m_map.getCurrentLevel() ; m_map.setCurrentLevel(fLevel) ; // go to the level of the face to subdivide its edges unsigned int degree = 0 ; Dart it = old ; do { ++degree ; // compute the degree of the face //if(OneLevelDifference) //{ // Dart nf = m_map.phi2(it) ; // if(m_map.faceLevel(nf) == fLevel - 1) // check if neighboring faces have to be subdivided first // subdivideFace(nf) ; //} if(!m_map.edgeIsSubdivided(it)) subdivideEdge(it) ; // and cut the edges (if they are not already) it = m_map.phi1(it) ; } while(it != old) ; m_map.setCurrentLevel(fLevel + 1) ; // go to the next level to perform face subdivision if(triQuad && degree == 3) // if subdividing a triangle { Dart dd = m_map.phi1(old) ; Dart e = m_map.phi1(dd) ; //(*vertexVertexFunctor)(e) ; e = m_map.phi1(e) ; m_map.splitFace(dd, e) ; // insert a new edge unsigned int id = m_map.getNewEdgeId() ; m_map.setEdgeId(m_map.phi_1(dd), id) ; // set the edge id of the inserted m_map.setEdgeId(m_map.phi_1(e), id) ; // edge to the next available id dd = e ; e = m_map.phi1(dd) ; //(*vertexVertexFunctor)(e) ; e = m_map.phi1(e) ; m_map.splitFace(dd, e) ; id = m_map.getNewEdgeId() ; m_map.setEdgeId(m_map.phi_1(dd), id) ; m_map.setEdgeId(m_map.phi_1(e), id) ; dd = e ; e = m_map.phi1(dd) ; //(*vertexVertexFunctor)(e) ; e = m_map.phi1(e) ; m_map.splitFace(dd, e) ; id = m_map.getNewEdgeId() ; m_map.setEdgeId(m_map.phi_1(dd), id) ; m_map.setEdgeId(m_map.phi_1(e), id) ; } else // if subdividing a polygonal face { Dart dd = m_map.phi1(old) ; Dart next = m_map.phi1(dd) ; //(*vertexVertexFunctor)(next) ; next = m_map.phi1(next) ; m_map.splitFace(dd, next) ; // insert a first edge Dart ne = m_map.alpha1(dd) ; Dart ne2 = m_map.phi2(ne) ; m_map.cutEdge(ne) ; // cut the new edge to insert the central vertex unsigned int id = m_map.getNewEdgeId() ; m_map.setEdgeId(ne, id) ; m_map.setEdgeId(m_map.phi2(ne), id) ; // set the edge id of the inserted id = m_map.getNewEdgeId() ; m_map.setEdgeId(ne2, id) ; // edges to the next available ids m_map.setEdgeId(m_map.phi2(ne2), id) ; dd = m_map.phi1(next) ; (*vertexVertexFunctor)(dd) ; dd = m_map.phi1(dd) ; while(dd != ne) // turn around the face and insert new edges { // linked to the central vertex m_map.splitFace(m_map.phi1(ne), dd) ; Dart nne = m_map.alpha1(dd) ; id = m_map.getNewEdgeId() ; m_map.setEdgeId(nne, id) ; m_map.setEdgeId(m_map.phi2(nne), id) ; dd = m_map.phi1(dd) ; //(*vertexVertexFunctor)(dd) ; dd = m_map.phi1(dd) ; } (*faceVertexFunctor)(m_map.phi1(ne)) ; } m_map.setCurrentLevel(cur) ; return fLevel ; }
void initialSubdivision(){ subdivideEdge(0, 3); subdivideEdge(1, 4); subdivideEdge(2, 5); }