diff --git a/.qglviewer.xml b/.qglviewer.xml index ca8ea9dc0d6fe69fb8a39719bb871719c781acba..c534f874ddb54a0efbade10822f5199f0f1bd008 100644 --- a/.qglviewer.xml +++ b/.qglviewer.xml @@ -1,22 +1,22 @@ - - + + - + - + - + - - - - - + + + + + diff --git a/include/utils.h b/include/utils.h index 64657e65f9b1c67493aa45b400eac6f5480c0623..c1f4d1a50b718e1990f6242422dc1dd0a69187d7 100644 --- a/include/utils.h +++ b/include/utils.h @@ -104,6 +104,16 @@ inline float dist3D_Segment_to_Segment( std::pair S1, std::pair +inline void afficheVector(std::vector vect) +{ + CGoGNout<<"[ "; + for( T elem : vect) + { + CGoGNout<(volume)) { + volume=map.volumeOldestDart(volume); pushSegmentInCellAsNeighbor(o, volume); mo->neighbor_cells[n].push_back(volume); mo->addGeneralNeighbor ( d); @@ -548,6 +549,7 @@ bool EnvMap::subdivideVolume(Dart dglobal, bool OneLevelDifference) map.setCurrentLevel(map.getMaxLevel()) ; unsigned int vLevel = map.volumeLevel(dglobal); Dart old = map.volumeOldestDart(dglobal); + Dart centerDart=old; #ifdef DEBUG_affichage int count = 0; #endif @@ -556,8 +558,10 @@ bool EnvMap::subdivideVolume(Dart dglobal, bool OneLevelDifference) // Traversor3WF traF(map, old, true); // for(Dart dit = traF.begin(); dit != traF.end(); dit = traF.next()) // { + if(OneLevelDifference) { + map.setCurrentLevel(vLevel) ; for ( Face dit : facesIncidentToVolume3(map,old)) { #ifdef DEBUG_affichage @@ -577,16 +581,17 @@ bool EnvMap::subdivideVolume(Dart dglobal, bool OneLevelDifference) } else if(!map.volumeIsSubdivided(nv)) //check if neighboring volumes have to be subdivided first to avoid one cell surrounded by subdivided ones { - +// CGoGNout<<"neighbor not subdivided :"<popSegment(o) ; // old version // removeElementFromVector(RegisteredNeighborEdges[old], o) ; - removeElementFromVector(o->nid->neighbor_cells[o->index],old); - o->nid->removeGeneralNeighbor (old); +// CGoGNout<<"tentative de pop voisin "<index<<" : "; + if(removeElementFromVector(o->nid->neighbor_cells[o->index],old)) + { + o->nid->removeGeneralNeighbor (old); + } + else + { + CGoGNout<<"failed to remove... "; + afficheVector(o->nid->neighbor_cells[o->index]); + CGoGNout<<" et old :"<(map, dglobal, position,false); + centerDart =Algo::Volume::IHM::subdivideVolumeClassic(map, dglobal, position,false); + res=true; } @@ -647,25 +663,42 @@ bool EnvMap::subdivideVolume(Dart dglobal, bool OneLevelDifference) duration_subdiv = endSubdiv - startSubdiv; if(duration_subdiv.count()>0.035)std::cout << "subdiv duration : " << duration_subdiv.count() << "s\n"; - map.setCurrentLevel(vLevel+1); + map.setCurrentLevel(map.getMaxLevel()) ; CellMarkerMemo newVolumes(map); - Dart start = old; - do // on marque les nouvelles cellules ! attention TODO cas des volumes qui n'ont aucune arete en commun avec le volume d'origine + if(res) + { + for(Vol vo : VolumesIncidentToVertex3(map,centerDart)) + { + newVolumes.mark(map.volumeOldestDart(vo)); + } + } + else { - map.setCurrentLevel(vLevel+1); - newVolumes.mark(start); - map.setCurrentLevel(vLevel); - start=map.phi1(start); - }while(start !=old); + newVolumes.mark(old); + } - map.setCurrentLevel(map.getMaxLevel()) ; - // map.check(); +// Dart start = old; +// do // on marque les nouvelles cellules ! attention TODO cas des volumes qui n'ont aucune arete en commun avec le volume d'origine +// { +// map.setCurrentLevel(vLevel+1); +// newVolumes.mark(map.volumeOldestDart(start)); +// map.setCurrentLevel(vLevel); +// start=map.phi1(start); +// }while(start !=old); + + // map.check(); + + + +// CGoGNout<<"nombre de sous cellules markées :"<>(map,f,position); @@ -680,10 +713,13 @@ bool EnvMap::subdivideVolume(Dart dglobal, bool OneLevelDifference) { if(!newVolumes.isMarked(v)) { +// CGoGNout<<"reenregistrement des voisins de : "<index<nid->neighbor_cells[s->index].push_back(d); } } diff --git a/src/needle.cpp b/src/needle.cpp index 5e35f12b473a4b7e99e76067cc2dd4488ce64cc7..f4665684f76fb669eadc466fc7b7a433992d92a9 100644 --- a/src/needle.cpp +++ b/src/needle.cpp @@ -236,7 +236,7 @@ void Needle::refine() { if(sim_->envMap_.subdivideVolume(volume)) { -// refine(); + refine(); } } diff --git a/src/simulator.cpp b/src/simulator.cpp index b10f198b39344a96557a9b29f77f345fbfe9a27b..cf80ce6d6f350f620052bc1ad7d211795007634f 100644 --- a/src/simulator.cpp +++ b/src/simulator.cpp @@ -27,7 +27,7 @@ void Simulator::init(int argc, char **argv) Needle_or_knife=true; initFixedObjects(); -// initSurfaces(); + initSurfaces(); initMovingObject(); // initEmptyMovingObject(); diff --git a/src/surface.cpp b/src/surface.cpp index fb39aafa8fce511f46ec7b359404a72ed55f57fd..cedf1b9e4f004baf8b07390462213988373f4eef 100644 --- a/src/surface.cpp +++ b/src/surface.cpp @@ -164,12 +164,12 @@ void Surface::initPlane() } -// bool test = false; -// while (!test) -// { -// test = subdiveMap(); -//// CGoGNout<<"subdiv effectuée ? " <> startingPoints, st sim_->envMap_.FirstRegistrationSegment(o); } sim_->objects.push_back(this); +// CGoGNout<<" segment dans :"<< belonging_cells[0][0]<updateData(simul.envMap_.map, simul.envMap_.position, 0.8f, 0.8f, 0.8f); for (ArticulatedObject * o : simul.objects) { - CGoGNout<<" size belong :"<< o->belonging_cells.size()<< " || nbseg :"<nbEdges << CGoGNendl; +// CGoGNout<<" size belong :"<< o->belonging_cells.size()<< " || nbseg :"<nbEdges << CGoGNendl; for(auto vect : o->belonging_cells) { - CGoGNout<<" size vector :"<< vect.size() << CGoGNendl; +// CGoGNout<<" size vector :"<< vect.size() << CGoGNendl; // m_topo_render->overdrawDart(simul.aiguille->parts_[i]->d,10.0f,1.0f,0,0); for(Dart it : vect) {