diff --git a/Apps/Tuto/tuto5.h b/Apps/Tuto/tuto5.h index 49fd306a9c35031db9e0288d42a6bbb2c2331fb7..dd346ee5034e522ca059fbe4a782cfdcfff5fc97 100644 --- a/Apps/Tuto/tuto5.h +++ b/Apps/Tuto/tuto5.h @@ -27,7 +27,7 @@ #include -#define WITH_GMAP 0 +//#define WITH_GMAP 0 #include "Topology/generic/parameters.h" #ifdef WITH_GMAP diff --git a/include/Algo/ImplicitHierarchicalMesh/subdivision3.hpp b/include/Algo/ImplicitHierarchicalMesh/subdivision3.hpp index 55522e5ddd1cb626588f1cf3d81f4d38cc4e54dd..4963c244f01f01beaaa87398262bf184965d32c0 100644 --- a/include/Algo/ImplicitHierarchicalMesh/subdivision3.hpp +++ b/include/Algo/ImplicitHierarchicalMesh/subdivision3.hpp @@ -450,67 +450,70 @@ Dart subdivideVolumeClassic2(typename PFP::MAP& map, Dart d, typename PFP::TVEC3 map.splitVolume(v) ; -// Dart old = map.phi2(map.phi1(dit)); -// Dart dd = map.phi1(map.phi1(old)) ; -// map.splitFace(old,dd) ; -// -// unsigned int idface = map.getNewFaceId(); -// map.setFaceId(dd,idface, FACE); -// -// Dart ne = map.phi1(map.phi1(old)) ; -// -// map.cutEdge(ne); -// centralDart = map.phi1(ne); -// newEdges.push_back(ne); -// newEdges.push_back(map.phi1(ne)); -// -// unsigned int id = map.getNewEdgeId() ; -// map.setEdgeId(ne, id, EDGE) ; -// -// Dart stop = map.phi2(map.phi1(ne)); -// ne = map.phi2(ne); -// do -// { -// dd = map.phi1(map.phi1(map.phi1(ne))); -// -// map.splitFace(ne, dd) ; -// unsigned int idface = map.getNewFaceId(); -// map.setFaceId(dd,idface, FACE); -// -// newEdges.push_back(map.phi1(dd)); -// -// ne = map.phi2(map.phi_1(ne)); -// dd = map.phi1(map.phi1(dd)); -// } -// while(dd != stop); + Dart old = map.phi2(map.phi1(dit)); + Dart dd = map.phi1(map.phi1(old)) ; + map.splitFace(old,dd) ; + + unsigned int idface = map.getNewFaceId(); + map.setFaceId(dd,idface, FACE); + + Dart ne = map.phi1(map.phi1(old)) ; + + map.cutEdge(ne); + centralDart = map.phi1(ne); + newEdges.push_back(ne); + newEdges.push_back(map.phi1(ne)); + position[centralDart] = volCenter; + + unsigned int id = map.getNewEdgeId() ; + map.setEdgeId(ne, id, EDGE) ; + + Dart stop = map.phi2(map.phi1(ne)); + ne = map.phi2(ne); + do + { + dd = map.phi1(map.phi1(map.phi1(ne))); + + map.splitFace(ne, dd) ; + unsigned int idface = map.getNewFaceId(); + map.setFaceId(dd,idface, FACE); + + newEdges.push_back(map.phi1(dd)); + + ne = map.phi2(map.phi_1(ne)); + dd = map.phi1(map.phi1(dd)); + } + while(dd != stop); } -// map.deleteVolume(map.phi3(map.phi2(map.phi1(traV.begin())))); -// + // //Third step : 3-sew internal faces // for (std::vector >::iterator it = subdividedfaces.begin(); it != subdividedfaces.end(); ++it) // { // Dart f1 = (*it).first; // Dart f2 = (*it).second; // +// // if(map.isBoundaryFace(map.phi2(f1)) && map.isBoundaryFace(map.phi2(f2))) // { +// std::cout << "boundary" << std::endl; // //id pour toutes les faces interieures // map.sewVolumes(map.phi2(f1), map.phi2(f2)); -// -// //Fais a la couture !!!!! -// unsigned int idface = map.getNewFaceId(); -// map.setFaceId(map.phi2(f1),idface, FACE); +// break; +//// +//// //Fais a la couture !!!!! +//// unsigned int idface = map.getNewFaceId(); +//// map.setFaceId(map.phi2(f1),idface, FACE); // } -// -// //FAIS a la couture !!!!!!! -// //id pour toutes les aretes exterieurs des faces quadrangulees -// unsigned int idedge = map.getEdgeId(f1); -// map.setEdgeId(map.phi2(f1), idedge, DART); -// map.setEdgeId( map.phi2(f2), idedge, DART); +//// +//// //FAIS a la couture !!!!!!! +//// //id pour toutes les aretes exterieurs des faces quadrangulees +//// unsigned int idedge = map.getEdgeId(f1); +//// map.setEdgeId(map.phi2(f1), idedge, DART); +//// map.setEdgeId( map.phi2(f2), idedge, DART); // } -// + // //LA copie de L'id est a gerer avec le sewVolumes normalement !!!!!! // //id pour les aretes interieurs : (i.e. 6 pour un hexa) // DartMarker mne(map); @@ -523,9 +526,9 @@ Dart subdivideVolumeClassic2(typename PFP::MAP& map, Dart d, typename PFP::TVEC3 // mne.markOrbit(EDGE, newEdges[i]); // } // } -// -// -// position[centralDart] = volCenter; //plonger a la fin de la boucle ???? + + + //plonger a la fin de la boucle ???? map.setCurrentLevel(cur) ; diff --git a/include/Algo/Modelisation/subdivision3.hpp b/include/Algo/Modelisation/subdivision3.hpp index 4c34c52deeb83083724ca7bfab9d78fe1d4ca782..97e03c612a0cbef2a246543e3c2b8d04137721ae 100644 --- a/include/Algo/Modelisation/subdivision3.hpp +++ b/include/Algo/Modelisation/subdivision3.hpp @@ -184,26 +184,38 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec std::vector v; do { - Dart dN = map.phi1(map.phi2(d)); + v.push_back(map.phi1(map.phi1(d))); + v.push_back(map.phi1(d)); - Dart dRing = map.phi1(d); - - if(map.phi2(dRing)!=dRing) - { - toSew.insert(std::pair(dRing,map.phi2(dRing))); - v.push_back(dRing); - } - - dRing = map.phi1(dRing); - - if(map.phi2(dRing)!=dRing) - { - toSew.insert(std::pair(dRing,map.phi2(dRing))); - v.push_back(dRing); - } + d = map.phi2(map.phi_1(d)); + } + while(d != *it); - d = dN; - } while (d != *it); +// do +// { +// Dart dN = map.phi1(map.phi2(d)); +// +// Dart dRing = map.phi1(d); +// +// if(map.phi2(dRing)!=dRing) +// { +// toSew.insert(std::pair(dRing,map.phi2(dRing))); +// v.push_back(dRing); +// } +// +// dRing = map.phi1(dRing); +// +// if(map.phi2(dRing)!=dRing) +// { +// toSew.insert(std::pair(dRing,map.phi2(dRing))); +// v.push_back(dRing); +// } +// +// d = dN; +// } while (d != *it); + + map.splitCC(v); + map.fillHole(v.front()); // //close the generated hole and create the central vertex // //unsigned int degree = map.closeHole(map.phi1(d)); @@ -211,12 +223,12 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec //TODO : pb de face en trop avec splitVolume //map.splitVolume(v); - Dart e = v.front(); - for(std::vector::iterator it = v.begin() ; it != v.end() ; ++it) - if(map.Map2::isBoundaryEdge(*it)) - map.unsewFaces(*it); + // - map.fillHole(e) ; +// Dart e = v.front(); +// for(std::vector::iterator it = v.begin() ; it != v.end() ; ++it) +// if(map.Map2::isBoundaryEdge(*it)) +// map.unsewFaces(*it); // Dart dd = map.phi1(map.phi2(map.phi1(d))); // map.splitFace(map.phi_1(dd),map.phi1(dd)); diff --git a/include/Topology/gmap/gmap2.h b/include/Topology/gmap/gmap2.h index f1341c717a267171a422f53b0975e63f0865e44b..d872c7d5a49a4777137797b6172c158ce135d5f9 100644 --- a/include/Topology/gmap/gmap2.h +++ b/include/Topology/gmap/gmap2.h @@ -252,6 +252,13 @@ public: * @return true if the merge has been executed, false otherwise */ virtual bool mergeVolumes(Dart d, Dart e); + + //! + /*! + * + */ + virtual void splitCC(std::vector& vd); + //@} /*! @name Topological Queries diff --git a/include/Topology/map/map2.h b/include/Topology/map/map2.h index 558826247607ff08f5433f9a8d251dd6061aba25..e3b6476cb9a12a8804160703944f7775a7a88131 100644 --- a/include/Topology/map/map2.h +++ b/include/Topology/map/map2.h @@ -274,6 +274,13 @@ public: * @return true if the merge has been executed, false otherwise */ virtual bool mergeVolumes(Dart d, Dart e); + + //! + /*! + * + */ + virtual void splitCC(std::vector& vd); + //@} /*! @name Topological Queries diff --git a/src/Topology/gmap/gmap2.cpp b/src/Topology/gmap/gmap2.cpp index 63ce6e76d55c360b91632d56c940726856e7cf1d..4384349b3540dc164f616e244e2ac929536e478f 100644 --- a/src/Topology/gmap/gmap2.cpp +++ b/src/Topology/gmap/gmap2.cpp @@ -584,6 +584,11 @@ bool GMap2::mergeVolumes(Dart d, Dart e) return true ; } +void GMap2::splitCC(std::vector& vd) +{ + //assert(checkSimpleOrientedPath(vd)) ; +} + /*! @name Topological Queries * Return or set various topological information *************************************************************************/ diff --git a/src/Topology/map/map2.cpp b/src/Topology/map/map2.cpp index 6d1ce182b3836298edd6465392182123a2e2ac13..3270bb924d4266dd4934e5a08bd5b93f9db12993 100644 --- a/src/Topology/map/map2.cpp +++ b/src/Topology/map/map2.cpp @@ -359,7 +359,7 @@ void Map2::sewFaces(Dart d, Dart e, bool withBoundary) void Map2::unsewFaces(Dart d) { - assert(!isBoundaryEdge(d)) ; + assert(!Map2::isBoundaryEdge(d)) ; Dart dd = phi2(d) ; @@ -407,7 +407,7 @@ bool Map2::collapseDegeneratedFace(Dart d) void Map2::splitFace(Dart d, Dart e) { - assert(d != e && sameFace(d, e)) ; + assert(d != e && Map2::sameFace(d, e)) ; Dart dd = Map1::cutEdge(phi_1(d)) ; Dart ee = Map1::cutEdge(phi_1(e)) ; Map1::splitCycle(dd, ee) ; @@ -515,6 +515,14 @@ bool Map2::mergeVolumes(Dart d, Dart e) return true ; } +void Map2::splitCC(std::vector& vd) +{ + //assert(checkSimpleOrientedPath(vd)) ; + + for(std::vector::iterator it = vd.begin() ; it != vd.end() ; ++it) + Map2::unsewFaces(*it); +} + /*! @name Topological Queries * Return or set various topological information *************************************************************************/ diff --git a/src/Topology/map/map3.cpp b/src/Topology/map/map3.cpp index 0ce90de57a943fb85e402fb3c5ee4d41193ea34e..55427c94bb76db8d32e45508a59c85ce695afc3a 100644 --- a/src/Topology/map/map3.cpp +++ b/src/Topology/map/map3.cpp @@ -490,11 +490,25 @@ void Map3::splitVolume(std::vector& vd) Map2::fillHole(e) ; + Dart b = Map1::newBoundaryCycle(vd.size()); + + Dart fit1 = phi2(e) ; + Dart fit2 = b ; + do + { + phi3sew(fit1, fit2) ; + + fit1 = phi1(fit1) ; + fit2 = phi_1(fit2) ; + } while(fit2 != b) ; + + + // if(isBoundaryMarked(e2)) - Map2::fillHole(e2) ; +// Map2::fillHole(e2) ; //sew the two connected components - Map3::sewVolumes(phi2(e), phi2(e2), false); +// Map3::sewVolumes(phi2(e), phi2(e2), false); } /*! @name Topological Queries