diff --git a/Apps/Examples/miniTest.cpp b/Apps/Examples/miniTest.cpp index d66bd6ab4c602e27e4035d92ff9bc0cc741ec8b6..1968dd5e7b99a32cbdeeb58d804497a1bfd0aeab 100644 --- a/Apps/Examples/miniTest.cpp +++ b/Apps/Examples/miniTest.cpp @@ -540,7 +540,6 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y) break ; } - case 'v': { srand(time(NULL)) ; @@ -554,6 +553,8 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y) updateVBOdata(Algo::Render::VBO::POSITIONS | Algo::Render::VBO::NORMALS) ; topo_render->updateData(myMap, position, 0.9f, 0.9f) ; } + glutPostRedisplay() ; + break ; } case 'x': diff --git a/include/Algo/ImplicitHierarchicalMesh/subdivision.hpp b/include/Algo/ImplicitHierarchicalMesh/subdivision.hpp index 4e94800d161c1b9ac60fcb561c3052a7f3c2b399..1f1f5c03940e2c854a5075546b2cd3a69d968e93 100644 --- a/include/Algo/ImplicitHierarchicalMesh/subdivision.hpp +++ b/include/Algo/ImplicitHierarchicalMesh/subdivision.hpp @@ -160,7 +160,7 @@ void coarsenFace(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position) do { map.setCurrentLevel(cur + 1) ; - map.removeVertex(map.phi1(map.phi1(fit))) ; + map.deleteVertex(map.phi1(map.phi1(fit))) ; map.setCurrentLevel(cur) ; fit = map.phi1(fit) ; } while(fit != d) ; diff --git a/include/Topology/gmap/gmap2.h b/include/Topology/gmap/gmap2.h index 914079041aaab9d63593479a3f20e6e4bcd0317d..9a6e7ec0f88cf3df5420ab12c73c8ca36a4eaa77 100644 --- a/include/Topology/gmap/gmap2.h +++ b/include/Topology/gmap/gmap2.h @@ -100,6 +100,13 @@ public: */ virtual void splitVertex(Dart d, Dart e); + //! Delete the vertex of d (works only for internal vertices) + /*! All the faces around the vertex are merged into one face + * @param d a dart of the vertex to delete + * @return true if the deletion has been executed, false otherwise + */ + virtual bool deleteVertex(Dart d) ; + //! Cut the edge of d and its opposite edge if it exists /*! @param d a dart of the edge to cut */ diff --git a/src/Topology/gmap/gmap2.cpp b/src/Topology/gmap/gmap2.cpp index c96a3dbbc194bf480c1a34a05b2e0865fc431b16..f738f0ecdb3c0024d00c5905aba50d8599984bae 100644 --- a/src/Topology/gmap/gmap2.cpp +++ b/src/Topology/gmap/gmap2.cpp @@ -56,6 +56,23 @@ void GMap2::splitVertex(Dart d, Dart e) phi2sew(phi1(dd),phi1(ee)); // Sew the two faces along the new edge } +bool GMap2::deleteVertex(Dart d) +{ + if(isBoundaryVertex(d)) + return false ; + + Dart vit = d ; + do + { + Dart f = phi_1(phi2(vit)) ; + phi1sew(vit, f) ; + vit = alpha1(vit) ; + } while(vit != d) ; + GMap1::deleteFace(d) ; + + return true ; +} + void GMap2::cutEdge(Dart d) { GMap1::cutEdge(d); // Cut the edge of d @@ -396,7 +413,7 @@ bool GMap2::isBoundaryVertex(Dart d) { if(beta2(dNext) == dNext) return true ; - dNext = alpha1(d) ; + dNext = alpha1(dNext) ; } while (dNext != d) ; return false ; }