Commit 156f13bd authored by untereiner's avatar untereiner

Map3 / GMap3 : deleteVertex + deleteEdge

parent 6b963c6a
......@@ -105,9 +105,9 @@ public:
//@{
//! Delete the vertex of d
/*! All the faces around the vertex are merged into one face
/*! All the volumes around the vertex are merged into one volume
* @param d a dart of the vertex to delete
* @return true if the deletion has been executed, false otherwise
* @return a Dart of the resulting volume
*/
virtual Dart deleteVertex(Dart d);
......@@ -122,6 +122,13 @@ public:
*/
virtual bool uncutEdge(Dart d);
//! Delete the edge of d
/*! All the volumes around the edge are merged into one volume
* @param d a dart of the edge to delete
* @return a Dart of the resulting volume
*/
virtual Dart deleteEdge(Dart d);
//! Split a face inserting an edge between two vertices
/*! \pre Dart d and e should belong to the same face and be distinct
* @param d dart of first vertex
......
......@@ -124,9 +124,9 @@ public:
//@{
//! Delete the vertex of d
/*! All the faces around the vertex are merged into one face
/*! All the volumes around the vertex are merged into one volume
* @param d a dart of the vertex to delete
* @return true if the deletion has been executed, false otherwise
* @return a Dart of the resulting volume
*/
virtual Dart deleteVertex(Dart d);
......@@ -141,8 +141,10 @@ public:
*/
virtual bool uncutEdge(Dart d);
//! Delete an edge and all the faces aroud this edge
/*! @param d a dart of the edge to delete
//! Delete the edge of d
/*! All the volumes around the edge are merged into one volume
* @param d a dart of the edge to delete
* @return a Dart of the resulting volume
*/
virtual Dart deleteEdge(Dart d);
......
......@@ -129,12 +129,14 @@ Dart GMap3::deleteVertex(Dart d)
beta2sew(beta0(d2), d32) ;
beta2sew(fit, beta0(d3)) ;
beta2sew(beta0(fit), d3) ;
fit = phi1(fit) ;
}
}
GMap2::deleteCC(d) ;
return res ;
return NIL ;
}
Dart GMap3::cutEdge(Dart d)
......@@ -182,6 +184,47 @@ bool GMap3::uncutEdge(Dart d)
return false;
}
Dart GMap3::deleteEdge(Dart d)
{
if(isBoundaryEdge(d))
return NIL ;
Dart res = NIL ;
Dart dit = d ;
do
{
Dart fit = dit ;
Dart end = fit ;
fit = phi1(fit) ;
while(fit != end)
{
Dart d2 = phi2(fit) ;
Dart d3 = phi3(fit) ;
Dart d32 = phi2(d3) ;
if(res == NIL)
res = d2 ;
beta2unsew(d2) ;
beta2unsew(beta0(d2)) ;
beta2unsew(d32) ;
beta2unsew(beta0(d32)) ;
beta2sew(d2, beta0(d32)) ;
beta2sew(beta0(d2), d32) ;
beta2sew(fit, beta0(d3)) ;
beta2sew(beta0(fit), d3) ;
fit = phi1(fit) ;
}
dit = alpha2(dit) ;
} while(dit != d) ;
GMap2::deleteCC(d) ;
return res ;
}
void GMap3::splitFace(Dart d, Dart e)
{
assert(d != e && GMap2::sameOrientedFace(d, e)) ;
......
......@@ -122,8 +122,11 @@ Dart Map3::deleteVertex(Dart d)
phi2unsew(d32) ;
phi2sew(d2, d32) ;
phi2sew(fit, d3) ;
fit = phi1(fit) ;
}
}
Map2::deleteCC(d) ;
return res ;
......@@ -185,37 +188,32 @@ Dart Map3::deleteEdge(Dart d)
if(isBoundaryEdge(d))
return NIL ;
//Save the darts around the edge
//(one dart per face should be enough)
std::vector<Dart> fstore;
fstore.reserve(128);
Dart dit = d;
do
{
fstore.push_back(dit);
dit = alpha2(dit);
}while(dit != d);
Dart res = NIL ;
for(std::vector<Dart>::iterator it = fstore.begin() ; it != fstore.end() ; ++it)
Dart dit = d ;
do
{
Dart fit = *it ;
Dart end = phi_1(fit) ;
Dart fit = dit ;
Dart end = fit ;
fit = phi1(fit) ;
while(fit != end)
{
Dart d2 = phi2(fit) ;
Dart d3 = phi3(fit) ;
Dart d32 = phi2(d3) ;
if(res == NIL)
res = d2 ;
phi2unsew(d2) ;
phi2unsew(d32) ;
phi2sew(d2, d32) ;
phi2sew(fit, d3) ;
fit = phi1(fit) ;
}
}
dit = alpha2(dit) ;
} while(dit != d) ;
Map2::deleteCC(d) ;
return res ;
......@@ -241,7 +239,7 @@ Dart Map3::collapseEdge(Dart d, bool delDegenerateVolumes)
{
//un brin d'une face adjacente a l'arrete contracte
Dart d = phi2(phi_1(*it));
Map2::collapseEdge(*it,false);
Map2::collapseEdge(*it, false);
//test de la degeneresence
//impossible d'avoir un volume de moins de 4 faces sans avoir de phi2 en points fixe donc on les vire
......@@ -275,7 +273,6 @@ Dart Map3::collapseEdge(Dart d, bool delDegenerateVolumes)
}
}
return resV;
}
......
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