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
bool render_vectors;
bool render_topo;
Algo::Render::GL2::MapRender* m_render;
Algo::Render::GL2::Topo3RenderMapD* m_render_topo;
// Algo::Render::GL2::MapRender* m_render;
// Algo::Render::GL2::Topo3RenderMapD* m_render_topo;
//
// Utils::VBO* m_positionVBO;
// Utils::VBO* m_dataVBO;
Utils::VBO* m_positionVBO;
Utils::VBO* m_dataVBO;
Utils::ShaderSimpleColor* m_shader;
Utils::ShaderVectorPerVertex* m_lines;
Utils::Strings3D* m_strings;
Utils::PointSprite* m_sprite;
// Utils::ShaderSimpleColor* m_shader;
// Utils::ShaderVectorPerVertex* m_lines;
// Utils::Strings3D* m_strings;
// Utils::PointSprite* m_sprite;
QTimer *m_timer;
public:
MyQT():
render_text(true),
render_balls(true),
render_vectors(true),
render_text(false),
render_balls(false),
render_vectors(false),
render_topo(true),
m_render(NULL),
m_render_topo(NULL),
m_positionVBO(NULL),
m_dataVBO(NULL),
m_shader(NULL),
m_lines(NULL),
m_strings(NULL),
m_sprite(NULL),
// m_render(NULL),
// m_render_topo(NULL),
// m_positionVBO(NULL),
// m_dataVBO(NULL),
// m_shader(NULL),
// m_lines(NULL),
// m_strings(NULL),
// m_sprite(NULL),
m_timer(NULL)
{}
protected:
void storeVerticesInfo();
// void storeVerticesInfo();
void cb_redraw();
......@@ -104,14 +104,14 @@ protected:
// slots locaux
public slots:
void balls_onoff(bool x);
void vectors_onoff(bool x);
void text_onoff(bool x);
// void balls_onoff(bool x);
// void vectors_onoff(bool x);
// void text_onoff(bool x);
void topo_onoff(bool x);
void slider_balls(int x);
void slider_vectors(int x);
void slider_text(int x);
// void slider_balls(int x);
// void slider_vectors(int x);
// void slider_text(int x);
void animate();
};
......
......@@ -39,56 +39,54 @@ class EmbeddedGMap3 : public GMap3
public:
typedef GMap3 TOPO_MAP;
/*!
*
*/
virtual Dart deleteVertex(Dart d);
//! 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 edge of d are kept on the resulting edge
* The attributes attached to the volume of d are kept on the resulting volume
/*! The attributes attached to the edge of d are kept on the resulting edge
* @param d a dart of the edge to cut
*/
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);
/**
* 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);
/**
* The attributes attached to the volume of the old volume of d are kept on the resulting volume
/*!
*
*/
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();
} ;
......
......@@ -114,6 +114,11 @@ public:
*/
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
/*! \warning Dart d no longer exists after the call
* @param d the edge
......
......@@ -156,6 +156,24 @@ inline void GMap1::cutEdge(Dart d)
beta0unsew(d) ;
beta0sew(e, d) ;
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)
......
......@@ -139,12 +139,12 @@ public:
//! unsew two oriented volumes along their faces.
/*! @param d a dart of one volume
*/
void unsewVolumes(Dart d);
virtual void unsewVolumes(Dart d);
//! merge to volume sewed by one 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
/*! @param vd a vector of darts
......
......@@ -48,7 +48,6 @@ public:
*/
virtual void cutEdge(Dart d);
/*! The attributes attached to the edge of d are kept on the resulting edge
* @param d a dart of the edge to cut
*/
......
......@@ -128,6 +128,11 @@ public:
*/
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
/*! \warning Dart d no longer exists after the call
* @param d the edge
......
......@@ -139,6 +139,13 @@ inline void Map1::cutEdge(Dart d)
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)
{
phi1unsew(phi_1(d)) ; // Dart before d is linked to its successor
......
......@@ -39,12 +39,11 @@ void EmbeddedGMap2::splitVertex(Dart d, Dart e)
if (isOrbitEmbedded(VERTEX))
{
unsigned int v1Emb = getEmbedding(VERTEX, d) ;
setDartEmbedding(VERTEX, phi1(dd), v1Emb) ;
setDartEmbedding(VERTEX, beta2(phi1(dd)), v1Emb) ;
unsigned int v2Emb = getEmbedding(VERTEX, e) ;
setDartEmbedding(VERTEX, phi1(ee), v2Emb) ;
setDartEmbedding(VERTEX, beta2(phi1(ee)), v2Emb) ;
unsigned int vEmb = getEmbedding(VERTEX, d) ;
setDartEmbedding(VERTEX, phi1(dd), vEmb) ;
setDartEmbedding(VERTEX, beta2(phi1(dd)), vEmb) ;
setDartEmbedding(VERTEX, beta0(dd), vEmb) ;
embedNewCell(VERTEX, e) ;
copyCell(VERTEX, e, d) ;
}
......@@ -81,10 +80,10 @@ void EmbeddedGMap2::cutEdge(Dart d)
if (isOrbitEmbedded(EDGE))
{
embedNewCell(EDGE, nd) ;
unsigned int eEmb = getEmbedding(EDGE, d) ;
setDartEmbedding(EDGE, phi2(d), eEmb) ;
setDartEmbedding(EDGE, beta0(d), eEmb) ;
embedNewCell(EDGE, nd) ;
copyCell(EDGE, nd, d) ;
}
......@@ -373,12 +372,17 @@ void EmbeddedGMap2::splitFace(Dart d, Dart e)
unsigned int v1Emb = getEmbedding(VERTEX, d) ;
copyDartEmbedding(VERTEX, phi_1(e), v1Emb) ;
copyDartEmbedding(VERTEX, beta1(d), v1Emb) ;
copyDartEmbedding(VERTEX, beta1(phi_1(e)), v1Emb) ;
unsigned int v2Emb = getEmbedding(VERTEX, e) ;
copyDartEmbedding(VERTEX, phi_1(d), v2Emb) ;
copyDartEmbedding(VERTEX, beta1(e), v2Emb) ;
copyDartEmbedding(VERTEX, beta1(phi_1(d)), v2Emb) ;
}
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) ;
copyCell(FACE, e, d) ;
}
......
This diff is collapsed.
......@@ -117,12 +117,22 @@ void GMap2::fillHole(Dart d)
void GMap2::splitVertex(Dart d, Dart e)
{
assert(sameVertex(d, e));
if(!sameOrientedVertex(d, e))
e = beta2(e) ;
Dart dd = phi2(d) ;
Dart ee = phi2(e) ;
beta2unsew(d) ;
beta2unsew(e) ;
GMap1::cutEdge(dd); // Cut the edge of dd (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(ee), beta0(phi1(dd)));
beta2sew(d, beta0(dd)) ;
beta2sew(e, beta0(ee)) ;
}
Dart GMap2::deleteVertex(Dart d)
......@@ -172,17 +182,8 @@ bool GMap2::uncutEdge(Dart d)
{
if(vertexDegree(phi1(d)) == 2)
{
Dart ne = phi2(d) ;
Dart nd = phi1(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)) ;
GMap1::uncutEdge(d) ;
GMap1::uncutEdge(beta2(d)) ;
return true ;
}
return false ;
......@@ -429,11 +430,20 @@ void GMap2::splitFace(Dart d, Dart e)
if(!sameOrientedFace(d, 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(e)) ;
GMap1::splitFace(phi_1(d), phi_1(e)) ;
beta2sew(phi_1(d), beta1(e)) ;
beta2sew(phi_1(e), beta1(d)) ;
beta2sew(beta0(dprev), beta0(beta2(dprev))) ;
beta2sew(beta0(eprev), beta0(beta2(eprev))) ;
}
bool GMap2::mergeFaces(Dart d)
......@@ -830,7 +840,7 @@ bool GMap2::foreach_dart_of_oriented_volume(Dart d, FunctorType& f, unsigned int
{
mark.mark(e); // Mark
Dart adj = phi2(e); // Get adjacent face
if (!mark.isMarked(e))
if (!mark.isMarked(adj))
visitedFaces.push_back(adj); // Add it
e = phi1(e);
} while(e != *it);
......
......@@ -39,7 +39,6 @@ void GMap3::deleteVolume(Dart d)
std::vector<Dart> visitedFaces; // Faces that are traversed
visitedFaces.reserve(512);
visitedFaces.push_back(d); // Start with the face of d
mark.markOrbit(FACE, d) ;
// For every face added to the list
......@@ -154,12 +153,11 @@ void GMap3::cutEdge(Dart d)
Dart d3 = beta3(prev);
beta3sew(beta0(prev), beta0(d3));
beta3sew(phi1(prev), phi1(d3));
}
Dart d3 = beta3(d);
beta3sew(beta0(d), beta0(d3));
beta3sew(phi1(prev), phi1(d3));
beta3sew(phi1(d), phi1(d3));
}
bool GMap3::uncutEdge(Dart d)
......@@ -173,6 +171,7 @@ bool GMap3::uncutEdge(Dart d)
{
prev = dd;
dd = alpha2(dd);
GMap2::uncutEdge(prev);
} while (dd != d) ;
......@@ -188,13 +187,27 @@ void GMap3::splitFace(Dart d, Dart e)
Dart dd = beta1(beta3(d));
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(dd, ee);
beta3sew(beta1(d), phi_1(ee));
beta3sew(phi_1(d), beta1(ee));
beta3sew(beta1(e), phi_1(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)
......@@ -230,6 +243,8 @@ void GMap3::sewVolumes(Dart d, Dart e, bool withBoundary)
{
beta2unsew(fitD) ;
beta2unsew(fitE) ;
beta2unsew(beta0(fitD)) ;
beta2unsew(beta0(fitE)) ;
beta2sew(fitD2, beta0(fitE2)) ;
beta2sew(beta0(fitD2), fitE2) ;
beta2sew(fitD, beta0(fitE)) ;
......@@ -327,7 +342,7 @@ void GMap3::splitVolume(std::vector<Dart>& vd)
GMap2::fillHole(e2) ;
//sew the two connected components
GMap3::sewVolumes(phi2(e), phi2(e2), false);
GMap3::sewVolumes(beta2(e), beta2(e2), false);
}
/*! @name Topological Queries
......
......@@ -73,8 +73,8 @@ void EmbeddedMap2::cutEdge(Dart d)
if (isOrbitEmbedded(EDGE))
{
embedNewCell(EDGE, nd) ;
copyDartEmbedding(EDGE, phi2(d), d) ;
embedNewCell(EDGE, nd) ;
copyCell(EDGE, nd, d) ;
}
......
......@@ -114,13 +114,14 @@ void EmbeddedMap3::splitFace(Dart d, Dart e)
Map3::splitFace(d, e);
//copy the vertex embedding to new darts (same vertex embedding for all darts)
if(isOrbitEmbedded(VERTEX))
{
copyDartEmbedding(VERTEX, phi_1(e), d);
copyDartEmbedding(VERTEX, phi_1(d), e);
copyDartEmbedding(VERTEX, phi_1(ee), dd);
copyDartEmbedding(VERTEX, phi_1(dd), ee);
unsigned int vEmb1 = getEmbedding(VERTEX, d) ;
unsigned int vEmb2 = getEmbedding(VERTEX, e) ;
setDartEmbedding(VERTEX, phi_1(e), vEmb1);
setDartEmbedding(VERTEX, phi_1(ee), vEmb1);
setDartEmbedding(VERTEX, phi_1(d), vEmb2);
setDartEmbedding(VERTEX, phi_1(dd), vEmb2);
}
if(isOrbitEmbedded(ORIENTED_FACE))
......@@ -134,17 +135,15 @@ void EmbeddedMap3::splitFace(Dart d, Dart e)
copyCell(ORIENTED_FACE, ee, dd) ;
}
//add a new face embedding to the created face
if(isOrbitEmbedded(FACE))
{
unsigned int fEmb = getEmbedding(FACE, d) ;
setDartEmbedding(FACE, phi_1(d), fEmb) ;
setDartEmbedding(FACE, phi3(phi_1(d)), fEmb) ;
setDartEmbedding(FACE, phi_1(ee), fEmb) ;
embedNewCell(FACE, e);
copyCell(FACE, e, d);
}
//copy the volume embedding to new darts (same volume embedding for all darts on the faces)
if(isOrbitEmbedded(VOLUME))
{
unsigned int vEmb1 = getEmbedding(VOLUME, d) ;
......@@ -159,34 +158,34 @@ void EmbeddedMap3::splitFace(Dart d, Dart e)
void EmbeddedMap3::sewVolumes(Dart d, Dart e, bool withBoundary)
{
//topological sewing
// topological sewing
Map3::sewVolumes(d, e, withBoundary);
//embed the vertex orbits from the oriented face with dart e
//with vertex orbits value from oriented face with dart d
// embed the vertex orbits from the oriented face with dart e
// with vertex orbits value from oriented face with dart d
if (isOrbitEmbedded(VERTEX))
{
Dart dd = d ;
Dart it = d ;
do
{
embedOrbit(VERTEX, dd, getEmbedding(VERTEX, dd)) ;
dd = phi1(dd) ;
} while(dd != d) ;
embedOrbit(VERTEX, it, getEmbedding(VERTEX, it)) ;
it = phi1(it) ;
} while(it != d) ;
}
//embed the new edge orbit with the old edge orbit value
//for all the face
// embed the new edge orbit with the old edge orbit value
// for all the face
if (isOrbitEmbedded(EDGE))
{
Dart dd = d ;
Dart it = d ;
do
{
embedOrbit(EDGE, d, getEmbedding(EDGE, d)) ;
dd = phi1(dd) ;
} while(dd != d) ;
embedOrbit(EDGE, it, getEmbedding(EDGE, it)) ;
it = phi1(it) ;
} while(it != d) ;
}
//embed the face orbit from the volume sewn
// embed the face orbit from the volume sewn
if (isOrbitEmbedded(FACE))
{
embedOrbit(FACE, e, getEmbedding(FACE, d)) ;
......@@ -197,12 +196,12 @@ void EmbeddedMap3::unsewVolumes(Dart d)
{
Dart dd = alpha1(d);
Map3::unsewVolumes(d);
unsigned int fEmb = EMBNULL ;
if(isOrbitEmbedded(FACE))
fEmb = getEmbedding(FACE, d) ;
Map3::unsewVolumes(d);
Dart dit = d;
do
{
......@@ -211,15 +210,13 @@ void EmbeddedMap3::unsewVolumes(Dart d)
{
if(!sameVertex(dit, dd))
{
embedOrbit(VERTEX, dit, getEmbedding(VERTEX, dit)) ;
embedNewCell(VERTEX, dd);
copyCell(VERTEX, dd, dit);
copyDartEmbedding(VERTEX, alpha1(dit), dit) ;
}
else
{
unsigned int vEmb = getEmbedding(VERTEX, dit) ;
setDartEmbedding(VERTEX, alpha_2(dit), vEmb) ;
setDartEmbedding(VERTEX, alpha_2(dd), vEmb) ;
embedOrbit(VERTEX, dit, getEmbedding(VERTEX, dit)) ;
}
}
......@@ -365,6 +362,7 @@ bool EmbeddedMap3::check()
return false ;
std::cout << "Check: embedding begin" << std::endl ;
for(Dart d = begin(); d != end(); next(d))
{
if(isOrbitEmbedded(VERTEX))
......@@ -416,6 +414,7 @@ bool EmbeddedMap3::check()
}
}
}
std::cout << "Check: embedding ok" << std::endl ;
return true ;
}
......
......@@ -144,7 +144,6 @@ void Map2::cutEdge(Dart d)
phi2unsew(d); // remove old phi2 links
Map1::cutEdge(d); // Cut the 1-edge of d
Map1::cutEdge(e); // Cut the 1-edge of phi2(d)
phi2sew(d, phi1(e)); // Correct the phi2 links
phi2sew(e, phi1(d));
}
......@@ -153,13 +152,11 @@ bool Map2::uncutEdge(Dart d)
{
if(vertexDegree(phi1(d)) == 2)
{
Dart ne = phi2(d) ;
Dart nd = phi1(d) ;
Dart e = phi_1(ne) ;
Dart e = phi2(phi1(d)) ;
phi2unsew(e) ;
phi2unsew(d) ;
Map1::collapseEdge(nd) ;
Map1::collapseEdge(ne) ;
Map1::uncutEdge(d) ;
Map1::uncutEdge(e) ;
phi2sew(d, e) ;
return true ;
}
......
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