Commit b6a9b24e authored by Thomas's avatar Thomas

correcting embedding error for edge orbit on splitFace on 3gmap, replacing...

correcting embedding error for edge orbit on splitFace on 3gmap, replacing name functions in gmap1 to use cycle
parent c34c0578
......@@ -58,6 +58,7 @@ SimpleGMap3::SimpleGMap3()
Geom::Plane3D<PFP::REAL> pl(VEC3(-1,-0.5,-0.5),VEC3(-1,-0.5,0.5),VEC3(1,0.5,0.5));
Algo::Modelisation::sliceConvexVolume<PFP>(myMap, position, d, pl);
myMap.check();
for(unsigned int i = position.begin() ; i != position.end() ; position.next(i))
position[i] += VEC3(2,0,0);
......@@ -80,8 +81,6 @@ SimpleGMap3::SimpleGMap3()
myMap.cutEdge(d);
position[myMap.phi1(d)] = mid;
myMap.check();
//
myMap.splitFace(d,myMap.phi1(myMap.phi1(myMap.phi1(d))));
myMap.check();
......@@ -125,11 +124,11 @@ void SimpleGMap3::cb_redraw()
Algo::Render::GL1::renderTopoGMD3<PFP>(myMap, position, true, true, true, true, 0.9f, 0.9f, 0.9f, 0.9f);
// Algo::Render::GL1::renderTopoMD3<PFP>(myMap, position, true, true, true, 0.9f, 0.9f, 0.9f);
glDisable(GL_LIGHTING);
glColor3f(1.0f, 1.0f, 1.0f);
glLineWidth(1.0f);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
Algo::Render::GL1::renderTriQuadPoly<PFP>(myMap, Algo::Render::GL1::LINE, 1.0,position, normal);
// glDisable(GL_LIGHTING);
// glColor3f(1.0f, 1.0f, 1.0f);
// glLineWidth(1.0f);
// glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
// Algo::Render::GL1::renderTriQuadPoly<PFP>(myMap, Algo::Render::GL1::LINE, 1.0,position, normal);
}
......
......@@ -93,18 +93,18 @@ public:
* @param nbEdges the number of sides of face
* @return a dart of the edge
*/
Dart newFace(unsigned int nbEdges);
Dart newCycle(unsigned int nbEdges);
//! Create an new face for boundary (marked)
/*! @param nbEdges the number of edges
* @return return a dart of the face
*/
Dart newBoundaryFace(unsigned int nbEdges);
Dart newBoundaryCycle(unsigned int nbEdges);
//! Delete a face erasing all its darts
/*! @param d a dart of the face
*/
void deleteFace(Dart d) ;
void deleteCycle(Dart d) ;
//@}
/*! @name Topological Operators
......@@ -135,7 +135,7 @@ public:
* @param d first dart in the face
* @param e second dart in the face
*/
void splitFace(Dart d, Dart e);
void splitCycle(Dart d, Dart e);
//! Merge the two faces of d and e, darts d & e disappear
/*! \pre Dart d and e MUST belong to distinct faces
......@@ -143,14 +143,14 @@ public:
* @param d a dart in the first face
* @param e a dart in the second face
*/
void mergeFaces(Dart d, Dart e);
void mergeCycles(Dart d, Dart e);
//! Link two faces by adding an edge between two vertices
/*! \pre Dart d and e MUST be different and belong to distinct face
* @param d first dart in the face
* @param e second dart in the face
*/
void linkFaces(Dart d, Dart e);
void linkCycles(Dart d, Dart e);
//@}
/*! @name Topological Queries
......@@ -162,25 +162,25 @@ public:
/*! @param d a dart
* @param e a dart
*/
bool sameOrientedFace(Dart d, Dart e) ;
bool sameOrientedCycle(Dart d, Dart e) ;
//! Test if dart d and e belong to the same face
/*! @param d a dart
* @param e a dart
*/
bool sameFace(Dart d, Dart e) ;
bool sameCycle(Dart d, Dart e) ;
//! Length of a face (its number of oriented edges)
/*! @param d a dart of the face
* @return the length of the face
*/
unsigned int faceDegree(Dart d);
unsigned int cycleDegree(Dart d);
/**
* check if the face of d is a triangle
* @return a boolean indicating if the face is a triangle
*/
bool isFaceTriangle(Dart d);
bool isCycleTriangle(Dart d);
//@}
/*! @name Cell Functors
......
......@@ -195,11 +195,11 @@ inline void GMap1::collapseEdge(Dart d)
deleteEdge(d) ;
}
inline void GMap1::splitFace(Dart d, Dart e)
inline void GMap1::splitCycle(Dart d, Dart e)
{
assert(d != e && sameFace(d, e)) ;
assert(d != e && sameCycle(d, e)) ;
if(!sameOrientedFace(d, e))
if(!sameOrientedCycle(d, e))
e = beta1(e) ;
Dart d1 = beta1(d) ;
......@@ -210,9 +210,9 @@ inline void GMap1::splitFace(Dart d, Dart e)
beta1sew(e, d1) ;
}
inline void GMap1::mergeFaces(Dart d, Dart e)
inline void GMap1::mergeCycles(Dart d, Dart e)
{
assert(!sameFace(d, e)) ;
assert(!sameCycle(d, e)) ;
Dart d1 = beta1(d) ;
Dart e1 = beta1(e) ;
......@@ -222,9 +222,9 @@ inline void GMap1::mergeFaces(Dart d, Dart e)
beta1sew(e, d1) ;
}
inline void GMap1::linkFaces(Dart d, Dart e)
inline void GMap1::linkCycles(Dart d, Dart e)
{
assert(d != e && !sameFace(d, e)) ;
assert(d != e && !sameCycle(d, e)) ;
Dart d1 = beta1(d) ;
Dart e1 = beta1(e) ;
Dart dd = newEdge() ;
......@@ -241,7 +241,7 @@ inline void GMap1::linkFaces(Dart d, Dart e)
* Return or set various topological information
*************************************************************************/
inline bool GMap1::sameOrientedFace(Dart d, Dart e)
inline bool GMap1::sameOrientedCycle(Dart d, Dart e)
{
Dart it = d ;
do
......@@ -253,7 +253,7 @@ inline bool GMap1::sameOrientedFace(Dart d, Dart e)
return false ;
}
inline bool GMap1::sameFace(Dart d, Dart e)
inline bool GMap1::sameCycle(Dart d, Dart e)
{
Dart it = d ;
do
......@@ -268,7 +268,7 @@ inline bool GMap1::sameFace(Dart d, Dart e)
return false ;
}
inline unsigned int GMap1::faceDegree(Dart d)
inline unsigned int GMap1::cycleDegree(Dart d)
{
unsigned int count = 0 ;
Dart it = d ;
......@@ -280,7 +280,7 @@ inline unsigned int GMap1::faceDegree(Dart d)
return count ;
}
inline bool GMap1::isFaceTriangle(Dart d)
inline bool GMap1::isCycleTriangle(Dart d)
{
return (phi1(d) != d) && (phi1(phi1(phi1(d))) == d) ;
}
......
......@@ -174,17 +174,17 @@ inline bool GMap2::isBoundaryEdge(Dart d)
inline bool GMap2::sameOrientedFace(Dart d, Dart e)
{
return GMap1::sameOrientedFace(d, e) ;
return GMap1::sameOrientedCycle(d, e) ;
}
inline bool GMap2::sameFace(Dart d, Dart e)
{
return GMap1::sameFace(d, e) ;
return GMap1::sameCycle(d, e) ;
}
inline unsigned int GMap2::faceDegree(Dart d)
{
return GMap1::faceDegree(d) ;
return GMap1::cycleDegree(d) ;
}
inline bool GMap2::sameVolume(Dart d, Dart e)
......
......@@ -136,6 +136,11 @@ public:
*/
virtual bool uncutEdge(Dart d);
/**
* Precondition for deleting edge
*/
bool deleteEdgePreCond(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
......@@ -143,6 +148,11 @@ public:
*/
virtual Dart deleteEdge(Dart d);
/**
* Precondition for splitting face
*/
bool splitFacePreCond(Dart d, Dart e);
//! 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
......
......@@ -50,17 +50,19 @@ Dart EmbeddedGMap3::cutEdge(Dart d)
if(isOrbitEmbedded(EDGE))
{
// embed the new darts created in the cut edge
unsigned int eEmb = getEmbedding(EDGE, d) ;
Dart e = d ;
do
{
setDartEmbedding(EDGE, beta0(e), eEmb) ;
e = alpha2(e) ;
} while(e != d) ;
embedOrbit(EDGE, d, getEmbedding(EDGE, d)) ;
// unsigned int eEmb = getEmbedding(EDGE, d) ;
// Dart e = d ;
// do
// {
// setDartEmbedding(EDGE, beta0(e), eEmb) ;
// e = alpha2(e) ;
// } while(e != d) ;
// embed a new cell for the new edge and copy the attributes' line (c) Lionel
embedNewCell(EDGE, phi1(d)) ;
copyCell(EDGE, phi1(d), d) ;
embedNewCell(EDGE, nd) ;
copyCell(EDGE, nd, d) ;
embedOrbit(EDGE, nd, getEmbedding(EDGE, nd)) ;
}
if(isOrbitEmbedded(FACE))
......@@ -148,6 +150,17 @@ void EmbeddedGMap3::splitFace(Dart d, Dart e)
setDartEmbedding(VERTEX, beta1(beta2(beta1(ee))), vEmb2);
}
if(isOrbitEmbedded(EDGE))
{
embedOrbit(EDGE, beta1(d), getEmbedding(EDGE, beta1(d))) ;
embedOrbit(EDGE, beta1(e), getEmbedding(EDGE, beta1(e))) ;
embedOrbit(EDGE, d, getEmbedding(EDGE, d)) ;
embedOrbit(EDGE, e, getEmbedding(EDGE, e)) ;
embedOrbit(EDGE, beta1(beta2(beta1(d))), getEmbedding(EDGE, beta1(beta2(beta1(d))))) ;
embedOrbit(EDGE, beta1(beta2(beta1(e))), getEmbedding(EDGE, beta1(beta2(beta1(e))))) ;
}
if(isOrbitEmbedded(FACE))
{
unsigned int fEmb = getEmbedding(FACE, d) ;
......
......@@ -50,8 +50,10 @@ void GMap1::compactTopoRelations(const std::vector<unsigned int>& oldnew)
* To generate or delete faces in a 1-G-map
*************************************************************************/
Dart GMap1::newFace(unsigned int nbEdges)
Dart GMap1::newCycle(unsigned int nbEdges)
{
assert(nbEdges > 0 || !"Cannot create a face with no edge") ;
Dart d0 = GMap0::newEdge(); // create the first edge
Dart dp = beta0(d0); // store an extremity
for (unsigned int i = 1; i < nbEdges; ++i)
......@@ -64,8 +66,10 @@ Dart GMap1::newFace(unsigned int nbEdges)
return d0;
}
Dart GMap1::newBoundaryFace(unsigned int nbEdges)
Dart GMap1::newBoundaryCycle(unsigned int nbEdges)
{
assert(nbEdges > 0 || !"Cannot create a face with no edge") ;
Dart d0 = GMap0::newEdge(); // create the first edge
boundaryMark(d0);
boundaryMark(beta0(d0));
......@@ -82,7 +86,7 @@ Dart GMap1::newBoundaryFace(unsigned int nbEdges)
return d0;
}
void GMap1::deleteFace(Dart d)
void GMap1::deleteCycle(Dart d)
{
Dart e = phi1(d);
while (e != d)
......
......@@ -59,10 +59,10 @@ void GMap2::compactTopoRelations(const std::vector<unsigned int>& oldnew)
Dart GMap2::newFace(unsigned int nbEdges, bool withBoundary)
{
Dart d = GMap1::newFace(nbEdges);
Dart d = GMap1::newCycle(nbEdges);
if (withBoundary)
{
Dart e = GMap1::newBoundaryFace(nbEdges);
Dart e = GMap1::newBoundaryCycle(nbEdges);
Dart it = d;
do
......@@ -87,8 +87,8 @@ void GMap2::deleteFace(Dart d)
it = phi1(it) ;
} while(it != d) ;
Dart dd = phi2(d) ;
GMap1::deleteFace(d) ;
GMap1::deleteFace(dd) ;
GMap1::deleteCycle(d) ;
GMap1::deleteCycle(dd) ;
}
void GMap2::deleteCC(Dart d)
......@@ -183,7 +183,7 @@ Dart GMap2::deleteVertex(Dart d)
vit = alpha1(vit) ;
} while(vit != d) ;
GMap1::deleteFace(d) ;
GMap1::deleteCycle(d) ;
return res ;
}
......@@ -366,7 +366,7 @@ void GMap2::sewFaces(Dart d, Dart e, bool withBoundary)
beta1sew(beta0(dd), ee) ;
beta1sew(ddN, ee1) ;
}
GMap1::deleteFace(dd) ;
GMap1::deleteCycle(dd) ;
beta2sew(d, beta0(e)) ; // sew the faces
beta2sew(e, beta0(d)) ;
......@@ -378,7 +378,7 @@ void GMap2::unsewFaces(Dart d)
Dart dd = phi2(d);
Dart e = newBoundaryFace(2);
Dart e = GMap1::newBoundaryCycle(2);
Dart ee = phi1(e) ;
Dart f = findBoundaryEdgeOfVertex(d) ;
......@@ -436,9 +436,9 @@ bool GMap2::collapseDegeneratedFace(Dart d)
beta1unsew(d2N) ;
beta1sew(d21, d2N) ;
beta1sew(d2, beta0(d2)) ;
GMap1::deleteFace(d2) ;
GMap1::deleteCycle(d2) ;
}
GMap1::deleteFace(d) ;
GMap1::deleteCycle(d) ;
return true ;
}
return false ;
......@@ -454,12 +454,14 @@ void GMap2::splitFace(Dart d, Dart e)
Dart dprev = phi_1(d) ;
Dart eprev = phi_1(e) ;
//required to unsew and resew because we use GMap1 cutEdge
//which insert new darts within the cut edge
beta2unsew(beta1(d)) ;
beta2unsew(beta1(e)) ;
Dart dd = GMap1::cutEdge(phi_1(d)) ;
Dart ee = GMap1::cutEdge(phi_1(e)) ;
GMap1::splitFace(dd, ee) ;
GMap1::splitCycle(dd, ee) ;
beta2sew(dd, beta1(e)) ;
beta2sew(ee, beta1(d)) ;
......@@ -474,9 +476,9 @@ bool GMap2::mergeFaces(Dart d)
Dart e = phi2(d) ;
beta2unsew(d) ;
beta2unsew(e) ;
GMap1::mergeFaces(d, phi1(e)) ;
GMap1::mergeFaces(e, phi1(d)) ;
GMap1::deleteFace(d) ;
GMap1::mergeCycles(d, phi1(e)) ;
GMap1::mergeCycles(e, phi1(d)) ;
GMap1::deleteCycle(d) ;
return true ;
}
return false ;
......@@ -578,8 +580,8 @@ bool GMap2::mergeVolumes(Dart d, Dart e)
beta2sew(d2, beta0(e2)); // Link the two adjacent faces together
beta2sew(e2, beta0(d2));
}
GMap1::deleteFace(d); // Delete the two alone faces
GMap1::deleteFace(e);
GMap1::deleteCycle(d); // Delete the two alone faces
GMap1::deleteCycle(e);
return true ;
}
......
......@@ -215,8 +215,17 @@ bool GMap3::uncutEdge(Dart d)
return false;
}
bool GMap3::deleteEdgePreCond(Dart d)
{
unsigned int nb1 = vertexDegree(d);
unsigned int nb2 = vertexDegree(phi1(d));
return (nb1!=2) && (nb2!=2);
}
Dart GMap3::deleteEdge(Dart d)
{
assert(deleteEdgePreCond(d));
if(isBoundaryEdge(d))
return NIL ;
......@@ -256,9 +265,17 @@ Dart GMap3::deleteEdge(Dart d)
return res ;
}
bool GMap3::splitFacePreCond(Dart d, Dart e)
{
return (d != e && GMap2::sameFace(d, e)) ;
}
void GMap3::splitFace(Dart d, Dart e)
{
assert(d != e && GMap2::sameOrientedFace(d, e)) ;
assert(splitFacePreCond(d, e));
if(!sameOrientedFace(d, e))
e = beta1(e) ;
Dart dd = beta1(beta3(d));
Dart ee = beta1(beta3(e));
......@@ -353,8 +370,8 @@ void GMap3::unsewVolumes(Dart d)
unsigned int nbE = faceDegree(d) ;
Dart d3 = phi3(d);
Dart b1 = newBoundaryFace(nbE) ;
Dart b2 = newBoundaryFace(nbE) ;
Dart b1 = newBoundaryCycle(nbE) ;
Dart b2 = newBoundaryCycle(nbE) ;
Dart fit1 = d ;
Dart fit2 = d3 ;
......@@ -906,7 +923,7 @@ unsigned int GMap3::closeHole(Dart d, bool forboundary)
{
Dart f = visitedFaces[i] ;
unsigned int degree = faceDegree(f) ;
Dart b = newBoundaryFace(degree) ;
Dart b = newBoundaryCycle(degree) ;
++count ;
Dart bit = b ;
......
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