]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
Mantis issue 0020422: EDF 1070 GEOM: Partition anomaly - REGRESSION from 4.1.x.
authorjfa <jfa@opencascade.com>
Wed, 21 Apr 2010 12:46:40 +0000 (12:46 +0000)
committerjfa <jfa@opencascade.com>
Wed, 21 Apr 2010 12:46:40 +0000 (12:46 +0000)
src/StdMeshers/StdMeshers_CompositeSegment_1D.cxx

index eee3ef0129ad367f4d04ada26b2458d713e0fb04..a3a78e6ec0ff362868ff0b24924023a1e21745d3 100644 (file)
@@ -81,7 +81,16 @@ namespace {
     TopTools_MapOfShape edgeCounter;
     edgeCounter.Add( edge );
     TopoDS_Vertex v;
-    v = forward ? TopExp::LastVertex( edge,1 ) : TopExp::FirstVertex( edge,1 );
+    if (edge.Orientation() <= TopAbs_REVERSED) // FORWARD || REVERSED
+      v = forward ? TopExp::LastVertex(edge,true) : TopExp::FirstVertex(edge,true);
+    else {
+      TopoDS_Iterator vIt (edge);
+      if (forward)
+        for (; vIt.More(); vIt.Next())
+          v = TopoDS::Vertex(vIt.Value()); // last
+      else if (vIt.More())
+        v = TopoDS::Vertex(vIt.Value()); // first
+    }
     TopTools_ListIteratorOfListOfShape ancestIt = aMesh.GetAncestors( v );
     for ( ; ancestIt.More(); ancestIt.Next() )
     {
@@ -92,11 +101,19 @@ namespace {
     if ( edgeCounter.Extent() < 3 && !eNext.IsNull() ) {
       if ( SMESH_Algo::IsContinuous( edge, eNext )) {
         // care of orientation
-        bool reverse;
-        if ( forward )
-          reverse = ( !v.IsSame( TopExp::FirstVertex( eNext, true )));
-        else
-          reverse = ( !v.IsSame( TopExp::LastVertex( eNext, true )));
+        TopoDS_Vertex vn;
+        if (eNext.Orientation() <= TopAbs_REVERSED) // FORWARD || REVERSED
+          vn = forward ? TopExp::FirstVertex(eNext,true) : TopExp::LastVertex(eNext,true);
+        else {
+          TopoDS_Iterator vIt (eNext);
+          if (forward)
+            vn = TopoDS::Vertex(vIt.Value()); // first
+          else if (vIt.More())
+            for (; vIt.More(); vIt.Next())
+              vn = TopoDS::Vertex(vIt.Value()); // last
+        }
+
+        bool reverse = (!v.IsSame(vn));
         if ( reverse )
           eNext.Reverse();
         return eNext;