Commit 059b23c9 authored by Pierre Kraemer's avatar Pierre Kraemer

deleteVertex pour les 2-G-cartes

parent 3bb52406
......@@ -26,7 +26,7 @@
#include "Utils/glutwin_atb.h"
#include "Topology/map/map2.h"
#include "Topology/gmap/gmap2.h"
#include "Topology/generic/embeddedMap2.h"
#include "Geometry/matrix.h"
......@@ -49,7 +49,7 @@ using namespace CGoGN ;
struct PFP
{
// definition of the map
typedef EmbeddedMap2<Map2> MAP;
typedef EmbeddedMap2<GMap2> MAP;
// definition of the type of real value
typedef float REAL;
......@@ -552,7 +552,6 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
break ;
}
case 'v':
{
srand(time(NULL)) ;
......@@ -566,6 +565,8 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
updateVBOdata(Algo::Render::VBO::POSITIONS | Algo::Render::VBO::NORMALS) ;
topo_render->updateData<PFP>(myMap, position, 0.9f, 0.9f) ;
}
glutPostRedisplay() ;
break ;
}
case 'x':
......
......@@ -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) ;
......
......@@ -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
*/
......
......@@ -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 ;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment