Commit 0cc54bd5 authored by Pierre Kraemer's avatar Pierre Kraemer

everything seems OK for now..

parent 57a22f4b
This diff is collapsed.
...@@ -61,38 +61,38 @@ class MyQT: public Utils::QT::SimpleQT ...@@ -61,38 +61,38 @@ class MyQT: public Utils::QT::SimpleQT
bool render_vectors; bool render_vectors;
bool render_topo; bool render_topo;
Algo::Render::GL2::MapRender* m_render; // Algo::Render::GL2::MapRender* m_render;
Algo::Render::GL2::Topo3RenderMapD* m_render_topo; // Algo::Render::GL2::Topo3RenderMapD* m_render_topo;
//
// Utils::VBO* m_positionVBO;
// Utils::VBO* m_dataVBO;
Utils::VBO* m_positionVBO; // Utils::ShaderSimpleColor* m_shader;
Utils::VBO* m_dataVBO; // Utils::ShaderVectorPerVertex* m_lines;
// Utils::Strings3D* m_strings;
Utils::ShaderSimpleColor* m_shader; // Utils::PointSprite* m_sprite;
Utils::ShaderVectorPerVertex* m_lines;
Utils::Strings3D* m_strings;
Utils::PointSprite* m_sprite;
QTimer *m_timer; QTimer *m_timer;
public: public:
MyQT(): MyQT():
render_text(true), render_text(false),
render_balls(true), render_balls(false),
render_vectors(true), render_vectors(false),
render_topo(true), render_topo(true),
m_render(NULL), // m_render(NULL),
m_render_topo(NULL), // m_render_topo(NULL),
m_positionVBO(NULL), // m_positionVBO(NULL),
m_dataVBO(NULL), // m_dataVBO(NULL),
m_shader(NULL), // m_shader(NULL),
m_lines(NULL), // m_lines(NULL),
m_strings(NULL), // m_strings(NULL),
m_sprite(NULL), // m_sprite(NULL),
m_timer(NULL) m_timer(NULL)
{} {}
protected: protected:
void storeVerticesInfo(); // void storeVerticesInfo();
void cb_redraw(); void cb_redraw();
...@@ -104,14 +104,14 @@ protected: ...@@ -104,14 +104,14 @@ protected:
// slots locaux // slots locaux
public slots: public slots:
void balls_onoff(bool x); // void balls_onoff(bool x);
void vectors_onoff(bool x); // void vectors_onoff(bool x);
void text_onoff(bool x); // void text_onoff(bool x);
void topo_onoff(bool x); void topo_onoff(bool x);
void slider_balls(int x); // void slider_balls(int x);
void slider_vectors(int x); // void slider_vectors(int x);
void slider_text(int x); // void slider_text(int x);
void animate(); void animate();
}; };
......
...@@ -39,56 +39,54 @@ class EmbeddedGMap3 : public GMap3 ...@@ -39,56 +39,54 @@ class EmbeddedGMap3 : public GMap3
public: public:
typedef GMap3 TOPO_MAP; typedef GMap3 TOPO_MAP;
/*!
*
*/
virtual Dart deleteVertex(Dart d);
//! Cut the edge of d //! Cut the edge of d
/*! @param d a dart of the edge to cut /*! @param d a dart of the edge to cut
*/ */
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 vertices of the edge of d are kept on the vertices of the resulting edge * @param d a dart of the edge to cut
* The attributes attached to the edge of d are kept on the resulting edge
* The attributes attached to the volume of d are kept on the resulting volume
*/ */
void sewFaces(Dart d, Dart e, bool withBoundary = true); virtual bool uncutEdge(Dart d);
/** /*!
* The attributes attached to the vertices of the old edge of d are duplicated on the vertices of both resulting edges *
* The attributes attached to the old edge are duplicated on both resulting edges
* The attributes attached to the old volume are duplicated on both volume if a new one is created
*/
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); 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 edges of the face of d are kept on the resulting face
* The attributes attached to the face of d are kept on the resulting face
*/ */
virtual void sewVolumes(Dart d, Dart e); virtual void sewVolumes(Dart d, Dart e, bool withBoundary = true);
/** /*!
* The attributes attached to the vertices of the old face of d are duplicated on the vertices of both resulting faces *
* The attributes attached to the old edges of the old face of d are duplicated on the edges of both resulting faces
* The attributes attached to the old face d are duplicated on both resulting faces
*/ */
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);
virtual unsigned int closeHole(Dart d); /*!
*
*/
virtual void splitVolume(std::vector<Dart>& vd);
// virtual void closeMap(DartMarker &marker); /**
* No attribute is attached to the new volume
*/
virtual unsigned int closeHole(Dart d, bool forboundary = true);
/*!
*
*/
virtual bool check(); virtual bool check();
} ; } ;
......
...@@ -114,6 +114,11 @@ public: ...@@ -114,6 +114,11 @@ public:
*/ */
void cutEdge(Dart d); void cutEdge(Dart d);
//! Undo the cut of the edge of d
/*! @param d a dart of the edge to uncut
*/
void uncutEdge(Dart d);
//! Collapse an edge of a face //! Collapse an edge of a face
/*! \warning Dart d no longer exists after the call /*! \warning Dart d no longer exists after the call
* @param d the edge * @param d the edge
......
...@@ -149,13 +149,31 @@ inline void GMap1::beta1unsew(Dart d) ...@@ -149,13 +149,31 @@ inline void GMap1::beta1unsew(Dart d)
inline void GMap1::cutEdge(Dart d) inline void GMap1::cutEdge(Dart d)
{ {
Dart dd = beta0(d) ; Dart dd = beta0(d) ;
Dart e = newDart(); Dart e = newDart();
Dart f = newDart(); Dart f = newDart();
beta1sew(e, f) ; beta1sew(e, f) ;
beta0unsew(d) ; beta0unsew(d) ;
beta0sew(e, d) ; beta0sew(e, d) ;
beta0sew(f, dd) ; beta0sew(f, dd) ;
if (isBoundaryMarked(d))
{
boundaryMark(e);
boundaryMark(f);
}
}
inline void GMap1::uncutEdge(Dart d)
{
Dart d0 = beta0(d) ;
Dart d1 = phi1(d) ;
Dart d10 = beta0(d1) ;
beta0unsew(d) ;
beta0unsew(d10) ;
beta0sew(d, d10) ;
deleteDart(d0) ;
deleteDart(d1) ;
} }
inline void GMap1::collapseEdge(Dart d) inline void GMap1::collapseEdge(Dart d)
......
...@@ -139,12 +139,12 @@ public: ...@@ -139,12 +139,12 @@ public:
//! unsew two oriented volumes along their faces. //! unsew two oriented volumes along their faces.
/*! @param d a dart of one volume /*! @param d a dart of one volume
*/ */
void unsewVolumes(Dart d); virtual void unsewVolumes(Dart d);
//! merge to volume sewed by one face //! merge to volume sewed by one face
/*! @param d a dart of common face /*! @param d a dart of common face
*/ */
bool mergeVolumes(Dart d); virtual bool mergeVolumes(Dart d);
//! Split a volume into two volumes along a edge path //! Split a volume into two volumes along a edge path
/*! @param vd a vector of darts /*! @param vd a vector of darts
......
...@@ -48,7 +48,6 @@ public: ...@@ -48,7 +48,6 @@ 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
* @param d a dart of the edge to cut * @param d a dart of the edge to cut
*/ */
......
...@@ -128,6 +128,11 @@ public: ...@@ -128,6 +128,11 @@ public:
*/ */
void cutEdge(Dart d); void cutEdge(Dart d);
//! Undo the cut of the edge of d
/*! @param d a dart of the edge to uncut
*/
void uncutEdge(Dart d);
//! Collapse an edge of a cycle //! Collapse an edge of a cycle
/*! \warning Dart d no longer exists after the call /*! \warning Dart d no longer exists after the call
* @param d the edge * @param d the edge
......
...@@ -139,6 +139,13 @@ inline void Map1::cutEdge(Dart d) ...@@ -139,6 +139,13 @@ inline void Map1::cutEdge(Dart d)
boundaryMark(e); boundaryMark(e);
} }
inline void Map1::uncutEdge(Dart d)
{
Dart d1 = phi1(d) ;
phi1unsew(d) ; // Dart d is linked to the successor of its successor
deleteDart(d1) ; // Dart d1 is erased
}
inline void Map1::collapseEdge(Dart d) inline void Map1::collapseEdge(Dart d)
{ {
phi1unsew(phi_1(d)) ; // Dart before d is linked to its successor phi1unsew(phi_1(d)) ; // Dart before d is linked to its successor
......
...@@ -39,12 +39,11 @@ void EmbeddedGMap2::splitVertex(Dart d, Dart e) ...@@ -39,12 +39,11 @@ void EmbeddedGMap2::splitVertex(Dart d, Dart e)
if (isOrbitEmbedded(VERTEX)) if (isOrbitEmbedded(VERTEX))
{ {
unsigned int v1Emb = getEmbedding(VERTEX, d) ; unsigned int vEmb = getEmbedding(VERTEX, d) ;
setDartEmbedding(VERTEX, phi1(dd), v1Emb) ; setDartEmbedding(VERTEX, phi1(dd), vEmb) ;
setDartEmbedding(VERTEX, beta2(phi1(dd)), v1Emb) ; setDartEmbedding(VERTEX, beta2(phi1(dd)), vEmb) ;
unsigned int v2Emb = getEmbedding(VERTEX, e) ; setDartEmbedding(VERTEX, beta0(dd), vEmb) ;
setDartEmbedding(VERTEX, phi1(ee), v2Emb) ;
setDartEmbedding(VERTEX, beta2(phi1(ee)), v2Emb) ;
embedNewCell(VERTEX, e) ; embedNewCell(VERTEX, e) ;
copyCell(VERTEX, e, d) ; copyCell(VERTEX, e, d) ;
} }
...@@ -81,10 +80,10 @@ void EmbeddedGMap2::cutEdge(Dart d) ...@@ -81,10 +80,10 @@ void EmbeddedGMap2::cutEdge(Dart d)
if (isOrbitEmbedded(EDGE)) if (isOrbitEmbedded(EDGE))
{ {
embedNewCell(EDGE, nd) ;
unsigned int eEmb = getEmbedding(EDGE, d) ; unsigned int eEmb = getEmbedding(EDGE, d) ;
setDartEmbedding(EDGE, phi2(d), eEmb) ; setDartEmbedding(EDGE, phi2(d), eEmb) ;
setDartEmbedding(EDGE, beta0(d), eEmb) ; setDartEmbedding(EDGE, beta0(d), eEmb) ;
embedNewCell(EDGE, nd) ;
copyCell(EDGE, nd, d) ; copyCell(EDGE, nd, d) ;
} }
...@@ -373,12 +372,17 @@ void EmbeddedGMap2::splitFace(Dart d, Dart e) ...@@ -373,12 +372,17 @@ void EmbeddedGMap2::splitFace(Dart d, Dart e)
unsigned int v1Emb = getEmbedding(VERTEX, d) ; unsigned int v1Emb = getEmbedding(VERTEX, d) ;
copyDartEmbedding(VERTEX, phi_1(e), v1Emb) ; copyDartEmbedding(VERTEX, phi_1(e), v1Emb) ;
copyDartEmbedding(VERTEX, beta1(d), v1Emb) ; copyDartEmbedding(VERTEX, beta1(d), v1Emb) ;
copyDartEmbedding(VERTEX, beta1(phi_1(e)), v1Emb) ;
unsigned int v2Emb = getEmbedding(VERTEX, e) ; unsigned int v2Emb = getEmbedding(VERTEX, e) ;
copyDartEmbedding(VERTEX, phi_1(d), v2Emb) ; copyDartEmbedding(VERTEX, phi_1(d), v2Emb) ;
copyDartEmbedding(VERTEX, beta1(e), v2Emb) ; copyDartEmbedding(VERTEX, beta1(e), v2Emb) ;
copyDartEmbedding(VERTEX, beta1(phi_1(d)), v2Emb) ;
} }
if (isOrbitEmbedded(FACE)) if (isOrbitEmbedded(FACE))
{ {
unsigned int fEmb = getEmbedding(FACE, d) ;
setDartEmbedding(FACE, phi_1(d), fEmb) ;
setDartEmbedding(FACE, beta1(phi_1(d)), fEmb) ;
embedNewCell(FACE, e) ; embedNewCell(FACE, e) ;
copyCell(FACE, e, d) ; copyCell(FACE, e, d) ;
} }
......
This diff is collapsed.
...@@ -117,12 +117,22 @@ void GMap2::fillHole(Dart d) ...@@ -117,12 +117,22 @@ void GMap2::fillHole(Dart d)
void GMap2::splitVertex(Dart d, Dart e) void GMap2::splitVertex(Dart d, Dart e)
{ {
assert(sameVertex(d, e)); assert(sameVertex(d, e));
if(!sameOrientedVertex(d, e))
e = beta2(e) ;
Dart dd = phi2(d) ; Dart dd = phi2(d) ;
Dart ee = phi2(e) ; Dart ee = phi2(e) ;
beta2unsew(d) ;
beta2unsew(e) ;
GMap1::cutEdge(dd); // Cut the edge of dd (make a new edge) GMap1::cutEdge(dd); // Cut the edge of dd (make a new edge)
GMap1::cutEdge(ee); // Cut the edge of ee (make a new edge) GMap1::cutEdge(ee); // Cut the edge of ee (make a new edge)
beta2sew(phi1(dd), beta0(phi1(ee))); // Sew the two faces along the new edge beta2sew(phi1(dd), beta0(phi1(ee))); // Sew the two faces along the new edge
beta2sew(phi1(ee), beta0(phi1(dd))); beta2sew(phi1(ee), beta0(phi1(dd)));
beta2sew(d, beta0(dd)) ;
beta2sew(e, beta0(ee)) ;
} }
Dart GMap2::deleteVertex(Dart d) Dart GMap2::deleteVertex(Dart d)
...@@ -172,17 +182,8 @@ bool GMap2::uncutEdge(Dart d) ...@@ -172,17 +182,8 @@ bool GMap2::uncutEdge(Dart d)
{ {
if(vertexDegree(phi1(d)) == 2) if(vertexDegree(phi1(d)) == 2)
{ {
Dart ne = phi2(d) ; GMap1::uncutEdge(d) ;
Dart nd = phi1(d) ; GMap1::uncutEdge(beta2(d)) ;
Dart e = phi_1(ne) ;
beta2unsew(d) ;
beta2unsew(ne) ;
beta2unsew(e) ;
beta2unsew(nd) ;
GMap1::collapseEdge(nd) ;
GMap1::collapseEdge(ne) ;
beta2sew(d, beta0(e)) ;
beta2sew(e, beta0(d)) ;
return true ; return true ;
} }
return false ; return false ;
...@@ -429,11 +430,20 @@ void GMap2::splitFace(Dart d, Dart e) ...@@ -429,11 +430,20 @@ void GMap2::splitFace(Dart d, Dart e)
if(!sameOrientedFace(d, e)) if(!sameOrientedFace(d, e))
e = beta1(e) ; e = beta1(e) ;
Dart dprev = phi_1(d) ;
Dart eprev = phi_1(e) ;
beta2unsew(beta1(d)) ;
beta2unsew(beta1(e)) ;
GMap1::cutEdge(phi_1(d)) ; GMap1::cutEdge(phi_1(d)) ;
GMap1::cutEdge(phi_1(e)) ; GMap1::cutEdge(phi_1(e)) ;
GMap1::splitFace(phi_1(d), phi_1(e)) ; GMap1::splitFace(phi_1(d), phi_1(e)) ;
beta2sew(phi_1(d), beta1(e)) ; beta2sew(phi_1(d), beta1(e)) ;
beta2sew(phi_1(e), beta1(d)) ; beta2sew(phi_1(e), beta1(d)) ;
beta2sew(beta0(dprev), beta0(beta2(dprev))) ;
beta2sew(beta0(eprev), beta0(beta2(eprev))) ;
} }
bool GMap2::mergeFaces(Dart d) bool GMap2::mergeFaces(Dart d)
...@@ -830,7 +840,7 @@ bool GMap2::foreach_dart_of_oriented_volume(Dart d, FunctorType& f, unsigned int ...@@ -830,7 +840,7 @@ bool GMap2::foreach_dart_of_oriented_volume(Dart d, FunctorType& f, unsigned int
{ {
mark.mark(e); // Mark mark.mark(e); // Mark
Dart adj = phi2(e); // Get adjacent face Dart adj = phi2(e); // Get adjacent face
if (!mark.isMarked(e)) if (!mark.isMarked(adj))
visitedFaces.push_back(adj); // Add it visitedFaces.push_back(adj); // Add it
e = phi1(e); e = phi1(e);
} while(e != *it); } while(e != *it);
......
...@@ -39,7 +39,6 @@ void GMap3::deleteVolume(Dart d) ...@@ -39,7 +39,6 @@ void GMap3::deleteVolume(Dart d)
std::vector<Dart> visitedFaces; // Faces that are traversed std::vector<Dart> visitedFaces; // Faces that are traversed
visitedFaces.reserve(512); visitedFaces.reserve(512);
visitedFaces.push_back(d); // Start with the face of d visitedFaces.push_back(d); // Start with the face of d
mark.markOrbit(FACE, d) ; mark.markOrbit(FACE, d) ;
// For every face added to the list // For every face added to the list
...@@ -154,12 +153,11 @@ void GMap3::cutEdge(Dart d) ...@@ -154,12 +153,11 @@ void GMap3::cutEdge(Dart d)
Dart d3 = beta3(prev); Dart d3 = beta3(prev);
beta3sew(beta0(prev), beta0(d3)); beta3sew(beta0(prev), beta0(d3));
beta3sew(phi1(prev), phi1(d3)); beta3sew(phi1(prev), phi1(d3));
} }
Dart d3 = beta3(d); Dart d3 = beta3(d);
beta3sew(beta0(d), beta0(d3)); beta3sew(beta0(d), beta0(d3));
beta3sew(phi1(prev), phi1(d3)); beta3sew(phi1(d), phi1(d3));
} }
bool GMap3::uncutEdge(Dart d) bool GMap3::uncutEdge(Dart d)
...@@ -173,6 +171,7 @@ bool GMap3::uncutEdge(Dart d) ...@@ -173,6 +171,7 @@ bool GMap3::uncutEdge(Dart d)
{ {
prev = dd; prev = dd;
dd = alpha2(dd); dd = alpha2(dd);
GMap2::uncutEdge(prev); GMap2::uncutEdge(prev);
} while (dd != d) ; } while (dd != d) ;
...@@ -188,13 +187,27 @@ void GMap3::splitFace(Dart d, Dart e) ...@@ -188,13 +187,27 @@ void GMap3::splitFace(Dart d, Dart e)
Dart dd = beta1(beta3(d)); Dart dd = beta1(beta3(d));
Dart ee = beta1(beta3(e)); Dart ee = beta1(beta3(e));
Dart dprev = phi_1(d) ;
Dart eprev = phi_1(e) ;
Dart ddprev = phi_1(dd) ;
Dart eeprev = phi_1(ee) ;
beta3unsew(beta1(d)) ;
beta3unsew(beta1(e)) ;
beta3unsew(beta1(dd)) ;
beta3unsew(beta1(ee)) ;
GMap2::splitFace(d, e); GMap2::splitFace(d, e);
GMap2::splitFace(dd, ee); GMap2::splitFace(dd, ee);
beta3sew(beta1(d), phi_1(ee)); beta3sew(beta1(d), phi_1(ee));
beta3sew(phi_1(d), beta1(ee)); beta3sew(phi_1(d), beta1(ee));
beta3sew(beta1(e), phi_1(dd)); beta3sew(beta1(e), phi_1(dd));
beta3sew(phi_1(e), beta1(dd)); beta3sew(phi_1(e), beta1(dd));
beta3sew(beta0(dprev), beta0(beta3(dprev))) ;
beta3sew(beta0(eprev), beta0(beta3(eprev))) ;
beta3sew(beta0(ddprev), beta0(beta3(ddprev))) ;
beta3sew(beta0(eeprev), beta0(beta3(eeprev))) ;
} }
void GMap3::sewVolumes(Dart d, Dart e, bool withBoundary) void GMap3::sewVolumes(Dart d, Dart e, bool withBoundary)
...@@ -230,6 +243,8 @@ void GMap3::sewVolumes(Dart d, Dart e, bool withBoundary) ...@@ -230,6 +243,8 @@ void GMap3::sewVolumes(Dart d, Dart e, bool withBoundary)
{ {
beta2unsew(fitD) ; beta2unsew(fitD) ;
beta2unsew(fitE) ; beta2unsew(fitE) ;
beta2unsew(beta0(fitD)) ;
beta2unsew(beta0(fitE)) ;
beta2sew(fitD2, beta0(fitE2)) ; beta2sew(fitD2, beta0(fitE2)) ;
beta2sew(beta0(fitD2), fitE2) ; beta2sew(beta0(fitD2), fitE2) ;
beta2sew(fitD, beta0(fitE)) ; beta2sew(fitD, beta0(fitE)) ;
...@@ -327,7 +342,7 @@ void GMap3::splitVolume(std::vector<Dart>& vd) ...@@ -327,7 +342,7 @@ void GMap3::splitVolume(std::vector<Dart>& vd)
GMap2::fillHole(e2) ; GMap2::fillHole(e2) ;
//sew the two connected components //sew the two connected components
GMap3::sewVolumes(phi2(e), phi2(e2), false); GMap3::sewVolumes(beta2(e), beta2(e2), false);
} }
/*! @name Topological Queries /*! @name Topological Queries
......
...@@ -73,8 +73,8 @@ void EmbeddedMap2::cutEdge(Dart d) ...@@ -73,8 +73,8 @@ void EmbeddedMap2::cutEdge(Dart d)
if (isOrbitEmbedded(EDGE)) if (isOrbitEmbedded(EDGE))
{ {
embedNewCell(EDGE, nd) ;
copyDartEmbedding(EDGE, phi2(d), d) ; copyDartEmbedding(EDGE, phi2(d), d) ;
embedNewCell(EDGE, nd) ;
copyCell(EDGE, nd, d) ; copyCell(EDGE, nd, d) ;
} }
......
...@@ -114,13 +114,14 @@ void EmbeddedMap3::splitFace(Dart d, Dart e) ...@@ -114,13 +114,14 @@ void EmbeddedMap3::splitFace(Dart d, Dart e)
Map3::splitFace(d, e); Map3::splitFace(d, e);