Commit b70a54c5 by untereiner

### 3-map OK ! (a priori.. -> not proved)

parent a08ce280
 ... ... @@ -274,22 +274,125 @@ void MyQT::cb_keyPress(int code) } } Dart embedCube() { Dart d = Algo::Modelisation::Polyhedron::createPolyhedron(myMap,6); myMap.closeMap(); Dart dres = d; position[d] = PFP::VEC3(0,0,0); position[myMap.phi1(d)] = PFP::VEC3(1,0,0); position[myMap.phi1(myMap.phi1(d))] = PFP::VEC3(1,0,1); position[myMap.phi_1(d)] = PFP::VEC3(0,0,1); d = myMap.phi_1(myMap.phi2(myMap.phi_1(myMap.phi_1(myMap.phi2(myMap.phi_1(d)))))); position[d] = PFP::VEC3(1,1,0); position[myMap.phi1(d)] = PFP::VEC3(0,1,0); position[myMap.phi1(myMap.phi1(d))] = PFP::VEC3(0,1,1); position[myMap.phi_1(d)] = PFP::VEC3(1,1,1); return myMap.phi2(myMap.phi1(dres)); } Dart embedCube2() { Dart d = Algo::Modelisation::Polyhedron::createPolyhedron(myMap,6); myMap.closeMap(); Dart dres = d; position[d] = PFP::VEC3(2,0,0); position[myMap.phi1(d)] = PFP::VEC3(3,0,0); position[myMap.phi1(myMap.phi1(d))] = PFP::VEC3(3,0,1); position[myMap.phi_1(d)] = PFP::VEC3(2,0,1); d = myMap.phi_1(myMap.phi2(myMap.phi_1(myMap.phi_1(myMap.phi2(myMap.phi_1(d)))))); position[d] = PFP::VEC3(3,1,0); position[myMap.phi1(d)] = PFP::VEC3(2,1,0); position[myMap.phi1(myMap.phi1(d))] = PFP::VEC3(2,1,1); position[myMap.phi_1(d)] = PFP::VEC3(3,1,1); return myMap.phi2(myMap.phi_1(dres)); } int main(int argc, char **argv) { position = myMap.addAttribute(VERTEX, "position"); Dart d1 = embedCube() ; Dart d2 = embedCube2() ; Dart dd = myMap.phi2(d1) ; myMap.check() ; std::cout << "nb darts -> " << myMap.getNbDarts() << std::endl ; myMap.sewVolumes(d1, d2); myMap.check() ; std::cout << "nb darts -> " << myMap.getNbDarts() << std::endl ; myMap.mergeVolumes(d1) ; myMap.check() ; std::cout << "nb darts -> " << myMap.getNbDarts() << std::endl ; std::vector v ; v.push_back(dd) ; dd = myMap.phi1(myMap.phi2(myMap.phi1(dd))) ; v.push_back(dd) ; dd = myMap.phi1(myMap.phi2(myMap.phi1(dd))) ; v.push_back(dd) ; dd = myMap.phi1(myMap.phi2(myMap.phi1(dd))) ; v.push_back(dd) ; myMap.splitVolume(v) ; myMap.check() ; std::cout << "nb darts -> " << myMap.getNbDarts() << std::endl ; Dart f = myMap.phi2(v.front()) ; Dart f3 = myMap.phi3(f) ; myMap.unsewVolumes(f) ; myMap.check() ; std::cout << "nb darts -> " << myMap.getNbDarts() << std::endl ; myMap.sewVolumes(f, f3) ; myMap.check() ; std::cout << "nb darts -> " << myMap.getNbDarts() << std::endl ; myMap.splitFace(f, myMap.phi1(myMap.phi1(f))) ; myMap.check() ; std::cout << "nb darts -> " << myMap.getNbDarts() << std::endl ; PFP::VEC3 p = position[f] + position[myMap.phi_1(f)] ; p /= 2.0 ; myMap.cutEdge(myMap.phi_1(f)) ; position[myMap.phi_1(f)] = p ; myMap.check() ; std::cout << "nb darts -> " << myMap.getNbDarts() << std::endl ; myMap.uncutEdge(myMap.phi_1(myMap.phi_1(f))) ; myMap.check() ; std::cout << "nb darts -> " << myMap.getNbDarts() << std::endl ; CGoGNout << 5.34 << " toto "<< Geom::Vec3f(2.5f, 2.2f, 4.3f) << CGoGNendl; CGoGNout << 3 << " tutu "<< 4 < " << myMap.getNbDarts() << std::endl ; Algo::Modelisation::Primitive3D prim(myMap, position); int nb=3; if (argc>1) nb = atoi(argv[1]); dglobal = prim.hexaGrid_topo(nb,nb,nb); prim.embedHexaGrid(1.0f,1.0f,1.0f); // Algo::Modelisation::Primitive3D prim(myMap, position); // // int nb=3; // if (argc>1) // nb = atoi(argv[1]); // dglobal = prim.hexaGrid_topo(nb,nb,nb); // prim.embedHexaGrid(1.0f,1.0f,1.0f); // // myMap.closeMap(); // un peu d'interface QApplication app(argc, argv); ... ...
 ... ... @@ -124,5 +124,5 @@ class BoundingBox } // namespace CGoGN #include "bounding_box.hpp" #include "Geometry/bounding_box.hpp" #endif
 ... ... @@ -73,7 +73,7 @@ public: } current = m.begin() ; while(m.isBoundaryMarked(current) || !m_good(current)) while(current != m.end() && (m.isBoundaryMarked(current) || !m_good(current))) m.next(current) ; if(current == m.end()) ... ...
 ... ... @@ -103,7 +103,7 @@ inline Dart Map3::alpha0(Dart d) inline Dart Map3::alpha1(Dart d) { return phi_1(phi3(d)) ; return phi3(phi_1(d)) ; } inline Dart Map3::alpha2(Dart d) ... ...
 ... ... @@ -195,7 +195,8 @@ void EmbeddedMap3::sewVolumes(Dart d, Dart e, bool withBoundary) void EmbeddedMap3::unsewVolumes(Dart d) { Dart dd = phi1(phi3(d)); Dart dd = alpha1(d); Map3::unsewVolumes(d); unsigned int fEmb = EMBNULL ; ... ... @@ -212,6 +213,13 @@ void EmbeddedMap3::unsewVolumes(Dart d) { embedNewCell(VERTEX, dd); copyCell(VERTEX, dd, dit); copyDartEmbedding(VERTEX, alpha1(dit), dit) ; } else { unsigned int vEmb = getEmbedding(VERTEX, dit) ; setDartEmbedding(VERTEX, alpha_2(dit), vEmb) ; setDartEmbedding(VERTEX, alpha_2(dd), vEmb) ; } } ... ... @@ -224,6 +232,13 @@ void EmbeddedMap3::unsewVolumes(Dart d) { embedNewCell(EDGE, dd); copyCell(EDGE, dd, dit); copyDartEmbedding(EDGE, phi3(dit), dit) ; } else { unsigned int eEmb = getEmbedding(EDGE, dit) ; setDartEmbedding(EDGE, phi3(dit), eEmb) ; setDartEmbedding(EDGE, alpha_2(dit), eEmb) ; } } ... ... @@ -292,7 +307,7 @@ void EmbeddedMap3::splitVolume(std::vector& vd) if(isOrbitEmbedded(VOLUME)) { Dart v = vd.begin() ; Dart v = vd.front() ; Dart v23 = alpha2(v) ; embedNewCell(VOLUME, v23) ; copyCell(VOLUME, v23, v) ; ... ... @@ -302,44 +317,42 @@ void EmbeddedMap3::splitVolume(std::vector& vd) unsigned int EmbeddedMap3::closeHole(Dart d, bool forboundary) { unsigned int nbF = Map3::closeHole(d, forboundary) ; Dart d3 = phi3(d) ; DartMarkerStore mark(*this); // Lock a marker std::vector visitedFaces; // Faces that are traversed visitedFaces.reserve(1024) ; visitedFaces.push_back(d); // Start with the face of d visitedFaces.push_back(phi3(d));// Start with the face of d mark.markOrbit(ORIENTED_FACE, phi3(d)) ; // For every face added to the list for (std::vector::iterator it = visitedFaces.begin(); it != visitedFaces.end(); ++it) { if (!mark.isMarked(*it)) // Face has not been visited yet Dart f = *it ; do { Dart f = *it ; do if(isOrbitEmbedded(VERTEX)) { mark.mark(f); if(isOrbitEmbedded(VERTEX)) { copyDartEmbedding(VERTEX, f, alpha1(f)) ; } if(isOrbitEmbedded(EDGE)) { copyDartEmbedding(EDGE, f, phi3(f)) ; } if(isOrbitEmbedded(FACE)) { copyDartEmbedding(FACE, f, phi3(f)) ; } Dart adj = phi2(f); // Get adjacent face if (!mark.isMarked(adj)) visitedFaces.push_back(adj); // Add it f = phi1(f) ; } while(f != *it) ; } copyDartEmbedding(VERTEX, f, alpha1(f)) ; } if(isOrbitEmbedded(EDGE)) { copyDartEmbedding(EDGE, f, phi3(f)) ; } if(isOrbitEmbedded(FACE)) { copyDartEmbedding(FACE, f, phi3(f)) ; } Dart adj = phi2(f); // Get adjacent face if (!mark.isMarked(adj)) { visitedFaces.push_back(adj); // Add it mark.markOrbit(ORIENTED_FACE, adj) ; } f = phi1(f) ; } while(f != *it) ; } return nbF ; ... ...
 ... ... @@ -24,7 +24,6 @@ #include "Topology/map/map2.h" #include "Topology/generic/traversorCell.h" #include "Topology/generic/traversor2CC.h" namespace CGoGN { ... ... @@ -132,35 +131,35 @@ void Map2::deleteCC(Dart d) std::vector visited; visited.reserve(1024) ; visited.push_back(d); std::vector::iterator it; mark.mark(d) ; for (it = visited.begin(); it != visited.end(); ++it) for (std::vector::iterator it = visited.begin(); it != visited.end(); ++it) { if (!mark.isMarked(*it)) Dart d1 = phi1(*it) ; if(!mark.isMarked(d1)) { Dart d1 = phi1(*it) ; if(!mark.isMarked(d1)) { mark.mark(d1); visited.push_back(d1) ; } Dart d2 = phi2(*it) ; if(!mark.isMarked(d2)) { mark.mark(d2); visited.push_back(d2) ; } visited.push_back(d1) ; mark.mark(d1); } Dart d2 = phi2(*it) ; if(!mark.isMarked(d2)) { visited.push_back(d2) ; mark.mark(d2); } } for(it = visited.begin(); it != visited.end(); ++it) for(std::vector::iterator it = visited.begin(); it != visited.end(); ++it) deleteDart(*it) ; } void Map2::fillHole(Dart d) { assert(isBoundaryMarked(d)) ; boundaryUnmarkOrbit(FACE, d) ; assert(isBoundaryEdge(d)) ; Dart dd = d ; if(!isBoundaryMarked(dd)) dd = phi2(dd) ; boundaryUnmarkOrbit(FACE, dd) ; } /*! @name Topological Operators ... ... @@ -757,7 +756,7 @@ bool Map2::foreach_dart_of_oriented_volume(Dart d, FunctorType& f, unsigned int // For every face added to the list for (std::vector::iterator it = visitedFaces.begin(); !found && it != visitedFaces.end(); ++it) { if (!isBoundaryMarked(*it) && !mark.isMarked(*it)) // Face has not been visited yet if (!mark.isMarked(*it)) // Face has not been visited yet { // Apply functor to the darts of the face found = foreach_dart_of_oriented_face(*it, f); ... ... @@ -769,9 +768,9 @@ bool Map2::foreach_dart_of_oriented_volume(Dart d, FunctorType& f, unsigned int Dart e = *it ; do { mark.mark(e); // Mark Dart adj = phi2(e); // Get adjacent face if (!isBoundaryMarked(adj) && !mark.isMarked(adj)) mark.mark(e); // Mark Dart adj = phi2(e); // Get adjacent face if (!mark.isMarked(adj)) visitedFaces.push_back(adj); // Add it e = phi1(e); } while(e != *it); ... ...
 ... ... @@ -39,13 +39,14 @@ void Map3::deleteVolume(Dart d) visitedFaces.reserve(512); visitedFaces.push_back(d); // Start with the face of d mark.markOrbitInParent(FACE, d) ; mark.markOrbit(ORIENTED_FACE, d) ; for(std::vector::iterator face = visitedFaces.begin(); face != visitedFaces.end(); ++face) { Dart e = *face ; unsewVolumes(e); if(!isBoundaryFace(e)) unsewVolumes(e) ; do // add all face neighbours to the table { ... ... @@ -53,7 +54,7 @@ void Map3::deleteVolume(Dart d) if(!mark.isMarked(ee)) // not already marked { visitedFaces.push_back(ee) ; mark.markOrbitInParent(FACE, ee) ; mark.markOrbit(ORIENTED_FACE, ee) ; } e = phi1(e) ; } while(e != *face) ; ... ... @@ -66,8 +67,11 @@ void Map3::deleteVolume(Dart d) void Map3::fillHole(Dart d) { assert(isBoundaryMarked(d)) ; boundaryUnmarkOrbit(VOLUME, d) ; assert(isBoundaryFace(d)) ; Dart dd = d ; if(!isBoundaryMarked(dd)) dd = phi3(dd) ; boundaryUnmarkOrbit(VOLUME, dd) ; } /*! @name Topological Operators ... ... @@ -221,13 +225,15 @@ void Map3::sewVolumes(Dart d, Dart e, bool withBoundary) phi2sew(fitD2, fitE2) ; phi2sew(fitD, fitE) ; } phi3unsew(fitD) ; phi3unsew(fitE) ; fitD = phi1(fitD) ; fitE = phi_1(fitE) ; } while(fitD != d) ; } while(fitD != dd) ; Map2::deleteCC(dd) ; Dart fitD = d ; Dart fitE = e ; fitD = d ; fitE = e ; do { phi3sew(fitD, fitE) ; ... ... @@ -586,7 +592,7 @@ bool Map3::foreach_dart_of_vertex(Dart d, FunctorType& f, unsigned int thread) for(std::vector::iterator it = darts.begin(); !found && it != darts.end() ; ++it) { //add phi21 and phi23 successor if they are not marked yet // add phi21 and phi23 successor if they are not marked yet Dart d2 = phi2(*it); Dart d21 = phi1(d2); // turn in volume Dart d23 = phi3(d2); // change volume ... ... @@ -666,10 +672,12 @@ bool Map3::foreach_dart_of_cc(Dart d, FunctorType& f, unsigned int thread) unsigned int Map3::closeHole(Dart d, bool forboundary) { assert(phi3(d) == d); // Nothing to close DartMarkerStore m(*this) ; std::vector visitedFaces; // Faces that are traversed visitedFaces.reserve(1024) ; visitedFaces.push_back(d); // Start with the face of d m.markOrbit(ORIENTED_FACE, d) ; unsigned int count = 0 ; ... ... @@ -691,12 +699,16 @@ unsigned int Map3::closeHole(Dart d, bool forboundary) if(phi3(e) == e) { found = true ; visitedFaces.push_back(e) ; if(!m.isMarked(e)) { visitedFaces.push_back(e) ; m.markOrbit(ORIENTED_FACE, e) ; } } else if(isBoundaryMarked(phi3(e))) else if(isBoundaryMarked(e)) { found = true ; phi2sew(phi3(e), bit) ; phi2sew(e, bit) ; } else e = alpha2(e) ; ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!