Commit 90f72548 authored by Thomas's avatar Thomas

modif gmap2 pas de sameOrientedVertex ajout sameVolume

parent f09570dd
......@@ -246,19 +246,14 @@ public:
* Return or set various topological information
*************************************************************************/
//@{
//! Test if dart d and e belong to the same oriented vertex
/*! @param d a dart
* @param e a dart
*/
bool sameOrientedVertex(Dart d, Dart e);
//! Test if dart d and e belong to the same vertex
/*! @param d a dart
* @param e a dart
*/
bool sameVertex(Dart d, Dart e);
bool sameVolume(Dart d, Dart e);
/**
* compute the number of edges of the vertex of d
*/
......
......@@ -48,7 +48,7 @@ void GMap2::deleteFace(Dart d)
void GMap2::splitVertex(Dart d, Dart e)
{
assert(sameOrientedVertex(d, e));
assert(sameVertex(d, e));
Dart dd = phi2(d) ;
Dart ee = phi2(e) ;
GMap1::cutEdge(dd); // Cut the edge of dd (make a new edge)
......@@ -272,7 +272,7 @@ void GMap2::extractTrianglePair(Dart d)
void GMap2::insertTrianglePair(Dart d, Dart v1, Dart v2)
{
assert(v1 != v2 && sameOrientedVertex(v1, v2)) ;
assert(v1 != v2 && sameVertex(v1, v2)) ;
assert(isFaceTriangle(d) && phi2(phi1(d)) == phi1(d) && phi2(phi_1(d)) == phi_1(d)) ;
Dart e = phi2(d) ;
if(e != d)
......@@ -426,28 +426,47 @@ void GMap2::closeMap(DartMarker& marker)
* Return or set various topological information
*************************************************************************/
bool GMap2::sameOrientedVertex(Dart d, Dart e)
bool GMap2::sameVertex(Dart d, Dart e)
{
Dart dNext = d; // Foreach dart dNext in the vertex of d
do
{
if (dNext == e) // Test equality with e
if (dNext == e || beta2(dNext) == e) // Test equality with e
return true;
dNext = alpha1(dNext);
} while (dNext != d);
return false; // None is equal to e => vertices are distinct
}
bool GMap2::sameVertex(Dart d, Dart e)
bool GMap2::sameVolume(Dart d, Dart e)
{
Dart dNext = d; // Foreach dart dNext in the vertex of d
do
DartMarkerStore mark(*this); // Lock a marker
bool found = false; // Last functor return value
std::list<Dart> visitedFaces; // Faces that are traversed
visitedFaces.push_back(d); // Start with the face of d
std::list<Dart>::iterator face;
// For every face added to the list
for (face = visitedFaces.begin(); !found && face != visitedFaces.end(); ++face)
{
if (dNext == e || beta2(dNext) == e) // Test equality with e
return true;
dNext = alpha1(dNext);
} while (dNext != d);
return false; // None is equal to e => vertices are distinct
if (!mark.isMarked(*face)) // Face has not been visited yet
{
Dart dNext = *face ;
do
{
if(dNext==e || beta0(dNext)==e)
return true;
mark.mark(dNext); // Mark
Dart adj = phi2(dNext); // Get adjacent face
if (adj != dNext && !mark.isMarked(adj))
visitedFaces.push_back(adj); // Add it
dNext = phi1(dNext);
} while(dNext != *face);
}
}
return false;
}
unsigned int GMap2::vertexDegree(Dart d)
......
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