Salome HOME
Merge remote-tracking branch 'origin/master' into gni/documentation
[modules/smesh.git] / src / SMESHUtils / SMESH_Slot.cxx
index 00521c0b52968e20360b775ed56656a4a95f186f..33c16aa277fe2ce57655b8d710e2d195ca04d32e 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018-2019  OPEN CASCADE
+// Copyright (C) 2018-2020  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -483,7 +483,7 @@ namespace
 
   const Segment* findTooCloseSegment( const IntPoint&        p,
                                       const double           minDist,
-                                      const double           tol,
+                                      const double           /*tol*/,
                                       const Segment*         curSegment,
                                       const SMDS_MeshNode*   curNode,
                                       const TSegmentsOfNode& segmentsOfNode )
@@ -836,20 +836,22 @@ SMESH_MeshAlgos::MakeSlot( SMDS_ElemIteratorPtr             theSegmentIt,
             // 2)
             double minCutDist = theWidth;
             gp_XYZ projection, closestProj;
-            int    iCut;
-            for ( size_t iC = 0; iC < closeSeg[iP]->myCuts.size(); ++iC )
+            int    iCut = -1;
+            for ( size_t iC2 = 0; iC2 < closeSeg[iP]->myCuts.size(); ++iC2 )
             {
-              double cutDist = closeSeg[iP]->myCuts[iC].SquareDistance( intPnt[iP].myNode,
+              double cutDist = closeSeg[iP]->myCuts[iC2].SquareDistance( intPnt[iP].myNode,
                                                                         projection );
               if ( cutDist < minCutDist )
               {
                 closestProj = projection;
                 minCutDist  = cutDist;
-                iCut        = iC;
+                iCut        = iC2;
+                if ( minCutDist < tol * tol )
+                  break;
               }
-              if ( minCutDist < tol * tol )
-                break;
             }
+            if ( iCut < 0 )
+              continue; // ???
             double d1 = SMESH_MeshAlgos::GetDistance( neighborSeg->myEdge,
                                                       closeSeg[iP]->myCuts[iCut][0].myNode );
             double d2 = SMESH_MeshAlgos::GetDistance( neighborSeg->myEdge,