Commit 90f72548 authored by Thomas's avatar Thomas
Browse files

modif gmap2 pas de sameOrientedVertex ajout sameVolume

parent f09570dd
...@@ -246,19 +246,14 @@ public: ...@@ -246,19 +246,14 @@ public:
* Return or set various topological information * 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 //! Test if dart d and e belong to the same vertex
/*! @param d a dart /*! @param d a dart
* @param e a dart * @param e a dart
*/ */
bool sameVertex(Dart d, Dart e); bool sameVertex(Dart d, Dart e);
bool sameVolume(Dart d, Dart e);
/** /**
* compute the number of edges of the vertex of d * compute the number of edges of the vertex of d
*/ */
......
...@@ -48,7 +48,7 @@ void GMap2::deleteFace(Dart d) ...@@ -48,7 +48,7 @@ void GMap2::deleteFace(Dart d)
void GMap2::splitVertex(Dart d, Dart e) void GMap2::splitVertex(Dart d, Dart e)
{ {
assert(sameOrientedVertex(d, e)); assert(sameVertex(d, e));
Dart dd = phi2(d) ; Dart dd = phi2(d) ;
Dart ee = phi2(e) ; Dart ee = phi2(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)
...@@ -272,7 +272,7 @@ void GMap2::extractTrianglePair(Dart d) ...@@ -272,7 +272,7 @@ void GMap2::extractTrianglePair(Dart d)
void GMap2::insertTrianglePair(Dart d, Dart v1, Dart v2) 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)) ; assert(isFaceTriangle(d) && phi2(phi1(d)) == phi1(d) && phi2(phi_1(d)) == phi_1(d)) ;
Dart e = phi2(d) ; Dart e = phi2(d) ;
if(e != d) if(e != d)
...@@ -426,28 +426,47 @@ void GMap2::closeMap(DartMarker& marker) ...@@ -426,28 +426,47 @@ void GMap2::closeMap(DartMarker& marker)
* Return or set various topological information * 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 Dart dNext = d; // Foreach dart dNext in the vertex of d
do do
{ {
if (dNext == e) // Test equality with e if (dNext == e || beta2(dNext) == e) // Test equality with e
return true; return true;
dNext = alpha1(dNext); dNext = alpha1(dNext);
} while (dNext != d); } while (dNext != d);
return false; // None is equal to e => vertices are distinct 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 DartMarkerStore mark(*this); // Lock a marker
do 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 if (!mark.isMarked(*face)) // Face has not been visited yet
return true; {
dNext = alpha1(dNext); Dart dNext = *face ;
} while (dNext != d); do
return false; // None is equal to e => vertices are distinct {
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) 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