Commit 20f4b60f authored by untereiner's avatar untereiner

Merge cgogn:~jund/CGoGN

parents 98ead99e 40ce1350
...@@ -54,7 +54,7 @@ public: ...@@ -54,7 +54,7 @@ public:
// * No attribute is attached to the new edge // * No attribute is attached to the new edge
// * The attributes attached to the face of dart d are kept on the resulting face // * The attributes attached to the face of dart d are kept on the resulting face
// */ // */
// virtual void linkVertices(Dart d, Dart e) ; virtual void linkVertices(Dart d, Dart e) ;
/** /**
* No attribute is attached to the new vertex * No attribute is attached to the new vertex
...@@ -62,10 +62,10 @@ public: ...@@ -62,10 +62,10 @@ public:
*/ */
virtual void cutEdge(Dart d) ; virtual void cutEdge(Dart d) ;
// /** /**
// * The attributes attached to the edge of d are kept on the resulting edge * The attributes attached to the edge of d are kept on the resulting edge
// */ */
// virtual void uncutEdge(Dart d) ; virtual void uncutEdge(Dart d) ;
/** /**
* Check if the edge of d can be collapsed or not based on some topological conditions * Check if the edge of d can be collapsed or not based on some topological conditions
...@@ -91,17 +91,17 @@ public: ...@@ -91,17 +91,17 @@ public:
*/ */
virtual bool flipBackEdge(Dart d) ; virtual bool flipBackEdge(Dart d) ;
// /** /**
// * The attributes attached to the vertex of dart d are kept on the resulting vertex * The attributes attached to the vertex of dart d are kept on the resulting vertex
// * The attributes attached to the face of dart d are overwritten on the face of dart e * The attributes attached to the face of dart d are overwritten on the face of dart e
// */ */
// virtual void insertEdgeInVertex(Dart d, Dart e); virtual void insertEdgeInVertex(Dart d, Dart e);
// /** /**
// * The attributes attached to the vertex of dart d are kept on the resulting vertex * The attributes attached to the vertex of dart d are kept on the resulting vertex
// * The attributes attached to the face of dart d are overwritten on the face of dart e * The attributes attached to the face of dart d are overwritten on the face of dart e
// */ */
// virtual void removeEdgeFromVertex(Dart d); virtual void removeEdgeFromVertex(Dart d);
/** /**
* The attributes attached to the vertices of the edge of d are kept on the vertices of the resulting edge * The attributes attached to the vertices of the edge of d are kept on the vertices of the resulting edge
......
...@@ -39,6 +39,11 @@ class EmbeddedGMap3 : public GMap3 ...@@ -39,6 +39,11 @@ class EmbeddedGMap3 : public GMap3
public: public:
typedef GMap3 TOPO_MAP; typedef GMap3 TOPO_MAP;
//! Cut the edge of d
/*! @param d a dart of the edge to cut
*/
virtual void cutEdge(Dart d);
/** /**
* The attributes attached to the vertices of the edge of d are kept on the vertices of the resulting edge * The attributes attached to the vertices of the edge of d are kept on the vertices of the resulting edge
* The attributes attached to the edge of d are kept on the resulting edge * The attributes attached to the edge of d are kept on the resulting edge
...@@ -53,6 +58,14 @@ public: ...@@ -53,6 +58,14 @@ public:
*/ */
virtual void unsewFaces(Dart d); virtual void unsewFaces(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
* @param e dart of second vertex
* @return the dart of the new edge lying in the vertex of d after the cut
*/
virtual void splitFace(Dart d, Dart e);
/** /**
* The attributes attached to the vertices of the vertices of the face of d are kept on the vertices of the resulting face * The attributes attached to the vertices of the vertices of the face of d are kept on the vertices of the resulting face
* The attributes attached to the edges of the face of d are kept on the resulting face * The attributes attached to the edges of the face of d are kept on the resulting face
...@@ -67,50 +80,11 @@ public: ...@@ -67,50 +80,11 @@ public:
*/ */
virtual void unsewVolumes(Dart d); virtual void unsewVolumes(Dart d);
//! /**
/*! * The attributes attached to the volume of the old volume of d are kept on the resulting volume
*
*/ */
virtual bool mergeVolumes(Dart d); virtual bool mergeVolumes(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
* @param e dart of second vertex
* @return the dart of the new edge lying in the vertex of d after the cut
*/
virtual void splitFace(Dart d, Dart e);
//! Cut the edge of d
/*! @param d a dart of the edge to cut
*/
virtual void cutEdge(Dart d);
// //!
// /*!
// *
// */
// virtual Dart cutSpike(Dart d);
// //! Collapse an edge (that is deleted) possibly merging its vertices
// /*! If delDegenerateFaces is true, the method checks that no degenerate
// * faces are build (faces with less than 3 edges). If it occurs the faces
// * are deleted and the adjacencies are updated (see deleteIfDegenerated).
// * \warning This may produce two distinct vertices if the edge
// * was the only link between two border faces
// * @param d a dart in the deleted edge
// * @param delDegenerateFaces a boolean (default to true)
// */
// virtual int collapseEdge(Dart d, bool delDegenerateFaces = true,
// bool delDegenerateVolumes = true);
// //!
// /*!
// *
// */
// virtual void collapseFace(Dart d, bool delDegenerateFaces = true,
// bool delDegenerateVolumes = true);
virtual unsigned int closeHole(Dart d); virtual unsigned int closeHole(Dart d);
virtual void closeMap(DartMarker &marker); virtual void closeMap(DartMarker &marker);
......
...@@ -115,11 +115,6 @@ public: ...@@ -115,11 +115,6 @@ public:
*/ */
virtual void splitFace(Dart d, Dart e); virtual void splitFace(Dart d, Dart e);
//! Unsew the "ear" of the vertex of d
/*! @param d a dart
*/
virtual Dart cutSpike(Dart d);
//! Sew two oriented volumes along their faces. //! Sew two oriented volumes along their faces.
/*! The oriented faces should not be phi3-linked and have the same length /*! The oriented faces should not be phi3-linked and have the same length
* @param d a dart of the first volume * @param d a dart of the first volume
......
...@@ -70,23 +70,25 @@ bool EmbeddedGMap2::deleteVertex(Dart d) ...@@ -70,23 +70,25 @@ bool EmbeddedGMap2::deleteVertex(Dart d)
return false ; return false ;
} }
//void EmbeddedGMap2::linkVertices(Dart d, Dart e) void EmbeddedGMap2::linkVertices(Dart d, Dart e)
//{ {
// Dart dNext = phi1(d) ; Dart dNext = phi1(d) ;
//
// GMap2::linkVertices(d,e); GMap2::linkVertices(d,e);
//
// if (isOrbitEmbedded(VERTEX)) if (isOrbitEmbedded(VERTEX))
// { {
// copyDartEmbedding(VERTEX, phi_1(e), d) ; copyDartEmbedding(VERTEX, phi_1(e), d) ;
// copyDartEmbedding(VERTEX, phi_1(d), e) ; copyDartEmbedding(VERTEX, beta2(phi_1(e)), d) ;
// } copyDartEmbedding(VERTEX, phi_1(d), e) ;
// copyDartEmbedding(VERTEX, beta2(phi_1(d)), e) ;
// if (isOrbitEmbedded(FACE)) }
// {
// embedOrbit(FACE, dNext, getEmbedding(FACE, dNext)) ; if (isOrbitEmbedded(FACE))
// } {
//} embedOrbit(FACE, dNext, getEmbedding(FACE, dNext)) ;
}
}
void EmbeddedGMap2::cutEdge(Dart d) void EmbeddedGMap2::cutEdge(Dart d)
{ {
...@@ -113,18 +115,16 @@ void EmbeddedGMap2::cutEdge(Dart d) ...@@ -113,18 +115,16 @@ void EmbeddedGMap2::cutEdge(Dart d)
} }
} }
//void EmbeddedGMap2::uncutEdge(Dart d) void EmbeddedGMap2::uncutEdge(Dart d)
//{ {
// bool doSomethg = (d != phi2(d)) ; bool doSomethg = (d != phi2(d)) ;
//
// GMap2::uncutEdge(d) ; GMap2::uncutEdge(d) ;
//
// if(doSomethg) if(doSomethg)
// { if(isOrbitEmbedded(EDGE))
// if(isOrbitEmbedded(EDGE)) embedOrbit(EDGE, d, getEmbedding(EDGE, d)) ;
// copyDartEmbedding(EDGE, phi2(d), d) ; }
// }
//}
bool EmbeddedGMap2::edgeCanCollapse(Dart d) bool EmbeddedGMap2::edgeCanCollapse(Dart d)
{ {
...@@ -247,54 +247,55 @@ bool EmbeddedGMap2::flipBackEdge(Dart d) ...@@ -247,54 +247,55 @@ bool EmbeddedGMap2::flipBackEdge(Dart d)
return false ; return false ;
} }
//void EmbeddedGMap2::insertEdgeInVertex(Dart d, Dart e) void EmbeddedGMap2::insertEdgeInVertex(Dart d, Dart e)
//{ {
// GMap2::insertEdgeInVertex(d, e); GMap2::insertEdgeInVertex(d, e);
//
// if (isOrbitEmbedded(VERTEX)) if (isOrbitEmbedded(VERTEX))
// { {
// copyDartEmbedding(VERTEX, e, d) ; copyDartEmbedding(VERTEX, e, d) ;
// } copyDartEmbedding(VERTEX, beta2(e), d) ;
// }
// if (isOrbitEmbedded(FACE))
// { if (isOrbitEmbedded(FACE))
// if(!sameFace(d,e)) {
// { if(!sameFace(d,e))
// embedNewCell(FACE, e); {
// copyCell(FACE, e, d) ; embedNewCell(FACE, e);
// } copyCell(FACE, e, d) ;
// else }
// { else
// embedOrbit(FACE, d, getEmbedding(FACE, d)) ; {
// } embedOrbit(FACE, d, getEmbedding(FACE, d)) ;
// } }
//} }
}
//void EmbeddedGMap2::removeEdgeFromVertex(Dart d)
//{ void EmbeddedGMap2::removeEdgeFromVertex(Dart d)
// Dart dPrev = alpha_1(d); {
// Dart dPrev = alpha_1(d);
// GMap2::removeEdgeFromVertex(d);
// GMap2::removeEdgeFromVertex(d);
// if (isOrbitEmbedded(VERTEX))
// { if (isOrbitEmbedded(VERTEX))
// embedNewCell(VERTEX, d); {
// copyCell(VERTEX, d, dPrev); embedNewCell(VERTEX, d);
// } copyCell(VERTEX, d, dPrev);
// }
// if (isOrbitEmbedded(FACE))
// { if (isOrbitEmbedded(FACE))
// if(!sameFace(d, dPrev)) {
// { if(!sameFace(d, dPrev))
// embedNewCell(FACE, d); {
// copyCell(FACE, d, dPrev) ; embedNewCell(FACE, d);
// } copyCell(FACE, d, dPrev) ;
// else }
// { else
// embedOrbit(FACE, d, getEmbedding(FACE, d)) ; {
// } embedOrbit(FACE, d, getEmbedding(FACE, d)) ;
// } }
//} }
}
void EmbeddedGMap2::sewFaces(Dart d, Dart e) void EmbeddedGMap2::sewFaces(Dart d, Dart e)
{ {
......
...@@ -30,6 +30,58 @@ ...@@ -30,6 +30,58 @@
namespace CGoGN namespace CGoGN
{ {
void EmbeddedGMap3::cutEdge(Dart d)
{
GMap3::cutEdge(d);
if(isOrbitEmbedded(EDGE))
{
Dart nd = phi1(d);
embedNewCell(EDGE, nd);
copyCell(EDGE, nd, d);
unsigned int vEmb = getEmbedding(EDGE, d);
embedOrbit(EDGE, d, vEmb);
}
if(isOrbitEmbedded(FACE))
{
Dart f = d;
do
{
Dart nd = phi1(f);
unsigned int fEmb = getEmbedding(FACE, f);
embedOrbit(FACE, nd, fEmb);
Dart f2 = phi2(nd);
if(f2!=nd)
{
Dart nd2 = phi2(f);
unsigned int fEmb2 = getEmbedding(FACE, f2);
embedOrbit(FACE, nd2, fEmb2);
}
f = alpha2(f);
} while(f != d);
}
if(isOrbitEmbedded(VOLUME))
{
Dart f = d;
do
{
Dart nd = phi1(f);
copyDartEmbedding(VOLUME, nd, f);
copyDartEmbedding(VOLUME, beta1(nd), f);
copyDartEmbedding(VOLUME, beta2(nd), f);
copyDartEmbedding(VOLUME, beta1(beta2(nd)), f);
f = alpha2(f);
} while(f != d);
}
}
void EmbeddedGMap3::sewFaces(Dart d, Dart e) void EmbeddedGMap3::sewFaces(Dart d, Dart e)
{ {
GMap3::sewFaces(d,e); GMap3::sewFaces(d,e);
...@@ -96,6 +148,50 @@ void EmbeddedGMap3::unsewFaces(Dart d) ...@@ -96,6 +148,50 @@ void EmbeddedGMap3::unsewFaces(Dart d)
} }
} }
void EmbeddedGMap3::splitFace(Dart d, Dart e)
{
GMap3::splitFace(d,e);
if(isOrbitEmbedded(VERTEX))
{
unsigned int vEmb = getEmbedding(VERTEX, d);
embedOrbit(VERTEX,phi2(phi_1(d)),vEmb);
vEmb = getEmbedding(VERTEX, e);
embedOrbit(VERTEX,phi2(phi_1(e)),vEmb);
}
if(isOrbitEmbedded(FACE))
{
embedNewCell(FACE, phi2(phi_1(d)));
copyCell(FACE, phi2(phi_1(d)), d);
copyDartEmbedding(FACE, phi_1(d), d);
copyDartEmbedding(FACE, beta0(phi_1(d)), beta0(d));
copyDartEmbedding(FACE, beta3(phi_1(d)), beta3(d));
copyDartEmbedding(FACE, beta3(beta0(phi_1(d))), beta3(beta0(d)));
}
if(isOrbitEmbedded(VOLUME))
{
copyDartEmbedding(VOLUME, phi_1(d), d);
copyDartEmbedding(VOLUME, beta0(phi_1(d)), beta0(d));
copyDartEmbedding(VOLUME, phi2(phi_1(d)), d);
copyDartEmbedding(VOLUME, beta0(phi2(phi_1(d))), beta0(d));
if(phi3(d) != d)
{
Dart d3 = phi3(d);
copyDartEmbedding(VOLUME, phi1(d3), d3);
copyDartEmbedding(VOLUME, beta0(phi1(d3)), beta0(d3));
copyDartEmbedding(VOLUME, phi2(phi1(d3)), d3);
copyDartEmbedding(VOLUME, beta0(phi2(phi1(d3))), beta0(d3));
}
}
}
void EmbeddedGMap3::sewVolumes(Dart d, Dart e) void EmbeddedGMap3::sewVolumes(Dart d, Dart e)
{ {
//topological sewing //topological sewing
...@@ -197,138 +293,6 @@ bool EmbeddedGMap3::mergeVolumes(Dart d) ...@@ -197,138 +293,6 @@ bool EmbeddedGMap3::mergeVolumes(Dart d)
return false; return false;
} }
void EmbeddedGMap3::splitFace(Dart d, Dart e)
{
GMap3::splitFace(d,e);
if(isOrbitEmbedded(VERTEX))
{
unsigned int vEmb = getEmbedding(VERTEX, d);
embedOrbit(VERTEX,phi2(phi_1(d)),vEmb);
vEmb = getEmbedding(VERTEX, e);
embedOrbit(VERTEX,phi2(phi_1(e)),vEmb);
}
if(isOrbitEmbedded(FACE))
{
embedNewCell(FACE, phi2(phi_1(d)));
copyCell(FACE, phi2(phi_1(d)), d);
copyDartEmbedding(FACE, phi_1(d), d);
copyDartEmbedding(FACE, beta0(phi_1(d)), beta0(d));
copyDartEmbedding(FACE, beta3(phi_1(d)), beta3(d));
copyDartEmbedding(FACE, beta3(beta0(phi_1(d))), beta3(beta0(d)));
}
if(isOrbitEmbedded(VOLUME))
{
copyDartEmbedding(VOLUME, phi_1(d), d);
copyDartEmbedding(VOLUME, beta0(phi_1(d)), beta0(d));
copyDartEmbedding(VOLUME, phi2(phi_1(d)), d);
copyDartEmbedding(VOLUME, beta0(phi2(phi_1(d))), beta0(d));
if(phi3(d) != d)
{
Dart d3 = phi3(d);
copyDartEmbedding(VOLUME, phi1(d3), d3);
copyDartEmbedding(VOLUME, beta0(phi1(d3)), beta0(d3));
copyDartEmbedding(VOLUME, phi2(phi1(d3)), d3);
copyDartEmbedding(VOLUME, beta0(phi2(phi1(d3))), beta0(d3));
}
}
}
void EmbeddedGMap3::cutEdge(Dart d)
{
GMap3::cutEdge(d);
if(isOrbitEmbedded(EDGE))
{
Dart nd = phi1(d);
embedNewCell(EDGE, nd);
copyCell(EDGE, nd, d);
unsigned int vEmb = getEmbedding(EDGE, d);
embedOrbit(EDGE, d, vEmb);
}
if(isOrbitEmbedded(FACE))
{
Dart f = d;
do
{
Dart nd = phi1(f);
unsigned int fEmb = getEmbedding(FACE, f);
embedOrbit(FACE, nd, fEmb);
Dart f2 = phi2(nd);
if(f2!=nd)
{
Dart nd2 = phi2(f);
unsigned int fEmb2 = getEmbedding(FACE, f2);
embedOrbit(FACE, nd2, fEmb2);
}
f = alpha2(f);
} while(f != d);
}
if(isOrbitEmbedded(VOLUME))
{
// Dart f = d;
// do
// {
// unsigned int fEmb2 = getEmbedding(VOLUME, d);
// embedOrbit(VOLUME, d, fEmb2);
// f = alpha2(f);
// } while(f != d);
Dart f = d;
do
{
Dart nd = phi1(f);
copyDartEmbedding(VOLUME, nd, f);
copyDartEmbedding(VOLUME, beta1(nd), f);
copyDartEmbedding(VOLUME, beta2(nd), f);
copyDartEmbedding(VOLUME, beta1(beta2(nd)), f);
// Dart nd2 = beta2(nd);
// if(f!=nd2)
// {
// copyDartEmbedding(VOLUME, nd2, f);
// copyDartEmbedding(VOLUME, beta0(nd2), f);
// }
f = alpha2(f);
} while(f != d);
}
}
//int EmbeddedGMap3::collapseEdge(Dart d, bool delDegenerateFaces,
// bool delDegenerateVolumes)
//{
// int nbCol = GMap3::collapseEdge(d,delDegenerateFaces,delDegenerateVolumes);
//
// return nbCol;
//}
//void EmbeddedGMap3::collapseFace(Dart d, bool delDegenerateFaces,
// bool delDegenerateVolumes)
//{
// GMap3::collapseFace(d,delDegenerateFaces,delDegenerateVolumes);
//
//// if(isOrbitEmbedded(VERTEX))
//// {
//// embedOrbit(VERTEX,dsave,vEmb);
//// }
//}
//TODO collapseVolume
unsigned int EmbeddedGMap3::closeHole(Dart d) unsigned int EmbeddedGMap3::closeHole(Dart d)
{ {
unsigned int nbE = GMap3::closeHole(d); unsigned int nbE = GMap3::closeHole(d);
......
...@@ -135,68 +135,6 @@ void GMap3::splitFace(Dart d, Dart e) ...@@ -135,68 +135,6 @@ void GMap3::splitFace(Dart d, Dart e)
} }
} }
Dart GMap3::cutSpike(Dart d)
{
Dart e=d;
int nb=0;
Dart dNew;
int tet=0;
//count the valence of the vertex
do {
nb++;
e=phi1(phi2(e));
} while (nb<3 && e!=d);
if(nb<3)
{
CGoGNout << "Warning : cannot cut 2 volumes without creating a degenerated face " << CGoGNendl;
return d;
}
else
{
//triangulate around the vertex
do {
if(phi1(phi1(phi1(e)))!=e)
{
splitFace(phi_1(e),phi1(e));
//CGoGNout << "split" << CGoGNendl;
}
else