Commit 156f13bd authored by untereiner's avatar untereiner

Map3 / GMap3 : deleteVertex + deleteEdge

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