0024195: Use of uninitialized data in IntCurve_IntPolyPolyGen.gxx
authorifv <ifv@opencascade.com>
Thu, 3 Oct 2013 12:30:51 +0000 (16:30 +0400)
committerbugmaster <bugmaster@opencascade.com>
Thu, 3 Oct 2013 12:31:43 +0000 (16:31 +0400)
Fix for regressions
Modified test cases de/iges_1/R8 and de/iges_2/I7 according to new data

src/IntCurve/IntCurve_ExactIntersectionPoint.gxx
src/IntCurve/IntCurve_IntPolyPolyGen.gxx
tests/de/iges_1/R8
tests/de/iges_2/I7

index 4b4d522..c5b940a 100755 (executable)
@@ -41,135 +41,137 @@ IntCurve_ExactIntersectionPoint::IntCurve_ExactIntersectionPoint(const TheCurve&
       StartingPoint(1,2),
       Root(1,2),
       anErrorOccurred(Standard_False)
-    {
-      ToleranceVector.Value(1) = TheCurveTool::EpsX(C1);
-      ToleranceVector.Value(2) = TheCurveTool::EpsX(C2);
-    }
+{
+  ToleranceVector.Value(1) = TheCurveTool::EpsX(C1);
+  ToleranceVector.Value(2) = TheCurveTool::EpsX(C2);
+}
   //----------------------------------------------------------------------
 void IntCurve_ExactIntersectionPoint::Perform( const IntCurve_ThePolygon2d& Poly1
                                              ,const IntCurve_ThePolygon2d& Poly2
                                              ,Standard_Integer&            NumSegOn1
                                              ,Standard_Integer&            NumSegOn2
                                              ,Standard_Real&               ParamOnSeg1
-                                             ,Standard_Real&               ParamOnSeg2) {
-    //----------------------------------------------------------------------
-    //-- On prend comme bornes de recherches  : 
-    //--
-    //--   Segment      :      i-1        i           i+1        i+2      
-    //--
-    //--                  |---------|-----X-------|---------|----------|
-    //--                Inf                                Sup
-    //--                  
-    if(NumSegOn1 >= Poly1.NbSegments() && ParamOnSeg1==0.0) { 
-      NumSegOn1--; ParamOnSeg1 = 1.0;
-    }
-    if(NumSegOn2 >= Poly2.NbSegments() && ParamOnSeg2==0.0) { 
-      NumSegOn2--; ParamOnSeg2 = 1.0;
-    }
-    if(NumSegOn1 <=0) { 
-      NumSegOn1=1; ParamOnSeg1 = 0.0;
-    }
-    if(NumSegOn2 <=0) { 
-      NumSegOn2=1; ParamOnSeg2 = 0.0;
-    }
-    
-    StartingPoint.Value(1) = Poly1.ApproxParamOnCurve(NumSegOn1,ParamOnSeg1);
-    if(NumSegOn1<=2) BInfVector.Value(1)= Poly1.InfParameter(); 
-    else  BInfVector.Value(1)= Poly1.ApproxParamOnCurve(NumSegOn1-1,(Standard_Real)0.0); 
-    if(NumSegOn1 >= (Poly1.NbSegments() -2)) BSupVector.Value(1)= Poly1.SupParameter();
-    else BSupVector.Value(1)= Poly1.ApproxParamOnCurve(NumSegOn1+2,(Standard_Real)0.0);
-    
-    StartingPoint.Value(2) = Poly2.ApproxParamOnCurve(NumSegOn2,ParamOnSeg2);
-    if(NumSegOn2<=2) BInfVector.Value(2)= Poly2.InfParameter();
-    else BInfVector.Value(2)= Poly2.ApproxParamOnCurve(NumSegOn2-1,(Standard_Real)0.0);
-    if(NumSegOn2 >= (Poly2.NbSegments() -2)) BSupVector.Value(2)= Poly2.SupParameter();
-    else BSupVector.Value(2)= Poly2.ApproxParamOnCurve(NumSegOn2+2,(Standard_Real)0.0);
-    
+                                             ,Standard_Real&               ParamOnSeg2) 
+{
+  //----------------------------------------------------------------------
+  //-- On prend comme bornes de recherches  : 
+  //--
+  //--   Segment      :      i-1        i           i+1        i+2      
+  //--
+  //--                  |---------|-----X-------|---------|----------|
+  //--                Inf                                Sup
+  //--                  
+  if(NumSegOn1 >= Poly1.NbSegments() && ParamOnSeg1==0.0) { 
+    NumSegOn1--; ParamOnSeg1 = 1.0;
+  }
+  if(NumSegOn2 >= Poly2.NbSegments() && ParamOnSeg2==0.0) { 
+    NumSegOn2--; ParamOnSeg2 = 1.0;
+  }
+  if(NumSegOn1 <=0) { 
+    NumSegOn1=1; ParamOnSeg1 = 0.0;
+  }
+  if(NumSegOn2 <=0) { 
+    NumSegOn2=1; ParamOnSeg2 = 0.0;
+  }
 
-    IntCurve_ExactIntersectionPoint::MathPerform();
-    if(nbroots == 0) { 
-//      Standard_Real DeflectionOn1 = Poly1.DeflectionOverEstimation();
-      Poly1.DeflectionOverEstimation();
-//      Standard_Real DeflectionOn2 = Poly2.DeflectionOverEstimation();
-      Poly2.DeflectionOverEstimation();
-      // if(DeflectionOn2 > Poly1.BeginOfSeg(NumSegOn1).Distance(Poly1.EndOfSeg(NumSegOn1))) {
-       {
-       //-- On risque de donner des bornes sur la courbe 1 trop etroites. 
-       Standard_Integer diff=1;
-       Standard_Real AnBinfVector = BInfVector.Value(1);
-       Standard_Real AnBsupVector = BSupVector.Value(1);
-       //---------------- On elargit les bornes par la gauche --------------------
-       do { 
-         diff++;
-         if((NumSegOn1-diff)<=1) { 
-           BInfVector.Value(1)= Poly1.InfParameter(); 
-           diff=0;
-         }
-         else BInfVector.Value(1)= Poly1.ApproxParamOnCurve(NumSegOn1-diff,(Standard_Real)0.0); 
-         IntCurve_ExactIntersectionPoint::MathPerform();
-         //-- le 18 nov 97 
-         if(diff>3) diff+=NumSegOn1/2;   
-       }
-       while( nbroots==0 && diff!=0);
-       //---------------- On elargit les bornes par la droite --------------------     
-       if(nbroots==0) { 
-         BInfVector.Value(1) = AnBinfVector;
-         diff=1;
-         do { 
-           diff++;
-           if((NumSegOn1+diff) >= (Poly1.NbSegments() -1)) { 
-             BSupVector.Value(1)= Poly1.SupParameter();
-             diff=0;
-           }
-           else BSupVector.Value(1)= Poly1.ApproxParamOnCurve(NumSegOn1+1+diff,(Standard_Real)0.0);
-           IntCurve_ExactIntersectionPoint::MathPerform();
-           //-- le 18 nov 97 
-           if(diff>3) diff+=1+(Poly1.NbSegments()-NumSegOn1)/2;
-         }
-         while( nbroots==0 && diff!=0);
-       }
-       BSupVector.Value(1) = AnBsupVector;
+  StartingPoint.Value(1) = Poly1.ApproxParamOnCurve(NumSegOn1,ParamOnSeg1);
+  if(NumSegOn1<=2) BInfVector.Value(1)= Poly1.InfParameter(); 
+  else  BInfVector.Value(1)= Poly1.ApproxParamOnCurve(NumSegOn1-1,(Standard_Real)0.0); 
+  if(NumSegOn1 >= (Poly1.NbSegments() -2)) BSupVector.Value(1)= Poly1.SupParameter();
+  else BSupVector.Value(1)= Poly1.ApproxParamOnCurve(NumSegOn1+2,(Standard_Real)0.0);
+
+  StartingPoint.Value(2) = Poly2.ApproxParamOnCurve(NumSegOn2,ParamOnSeg2);
+  if(NumSegOn2<=2) BInfVector.Value(2)= Poly2.InfParameter();
+  else BInfVector.Value(2)= Poly2.ApproxParamOnCurve(NumSegOn2-1,(Standard_Real)0.0);
+  if(NumSegOn2 >= (Poly2.NbSegments() -2)) BSupVector.Value(2)= Poly2.SupParameter();
+  else BSupVector.Value(2)= Poly2.ApproxParamOnCurve(NumSegOn2+2,(Standard_Real)0.0);
+
+
+  IntCurve_ExactIntersectionPoint::MathPerform();
+  if(nbroots == 0) { 
+    //      Standard_Real DeflectionOn1 = Poly1.DeflectionOverEstimation();
+    Poly1.DeflectionOverEstimation();
+    //      Standard_Real DeflectionOn2 = Poly2.DeflectionOverEstimation();
+    Poly2.DeflectionOverEstimation();
+    // if(DeflectionOn2 > Poly1.BeginOfSeg(NumSegOn1).Distance(Poly1.EndOfSeg(NumSegOn1))) {
+    {
+      //-- On risque de donner des bornes sur la courbe 1 trop etroites. 
+      Standard_Integer diff=1;
+      Standard_Real AnBinfVector = BInfVector.Value(1);
+      Standard_Real AnBsupVector = BSupVector.Value(1);
+      //---------------- On elargit les bornes par la gauche --------------------
+      do { 
+        diff++;
+        if((NumSegOn1-diff)<=1) { 
+          BInfVector.Value(1)= Poly1.InfParameter(); 
+          diff=0;
+        }
+        else BInfVector.Value(1)= Poly1.ApproxParamOnCurve(NumSegOn1-diff,(Standard_Real)0.0); 
+        IntCurve_ExactIntersectionPoint::MathPerform();
+        //-- le 18 nov 97 
+        if(diff>3) diff+=NumSegOn1/2;    
       }
-    
+      while( nbroots==0 && diff!=0);
+      //---------------- On elargit les bornes par la droite --------------------      
       if(nbroots==0) { 
-       //-- On risque de donner des bornes sur la courbe 1 trop etroites. 
-       Standard_Integer diff=1;
-       Standard_Real AnBinfVector = BInfVector.Value(2);
-       Standard_Real AnBsupVector = BSupVector.Value(2);
-       //---------------- On elargit les bornes par la gauche --------------------
-       do { 
-         diff++;
-         if((NumSegOn2-diff)<=1) { 
-           BInfVector.Value(2)= Poly2.InfParameter(); 
-           diff=0;
-         }
-         else BInfVector.Value(2)= Poly2.ApproxParamOnCurve(NumSegOn2-diff,(Standard_Real)0.0); 
-         IntCurve_ExactIntersectionPoint::MathPerform();
-         //-- le 18 nov 97 
-         if(diff>3) diff+=NumSegOn2/2;
-       }
-       while( nbroots==0 && diff!=0);
-       //---------------- On elargit les bornes par la droite --------------------     
-       if(nbroots==0) { 
-         BInfVector.Value(2) = AnBinfVector;
-         diff=1;
-         do { 
-           diff++;
-           if((NumSegOn2+diff) >= (Poly2.NbSegments() -1)) { 
-             BSupVector.Value(2)= Poly2.SupParameter();
-             diff=0;
-           }
-           else BSupVector.Value(2)= Poly2.ApproxParamOnCurve(NumSegOn2+1+diff,(Standard_Real)0.0);
-           IntCurve_ExactIntersectionPoint::MathPerform();
-           //-- le 18 nov 97 
-           if(diff>3) diff+=1+(Poly2.NbSegments()-NumSegOn2)/2;
-         }
-         while( nbroots==0 && diff!=0);
-       }
-       BSupVector.Value(2) = AnBsupVector;
+        BInfVector.Value(1) = AnBinfVector;
+        diff=1;
+        do { 
+          diff++;
+          if((NumSegOn1+diff) >= (Poly1.NbSegments() -1)) { 
+            BSupVector.Value(1)= Poly1.SupParameter();
+            diff=0;
+          }
+          else BSupVector.Value(1)= Poly1.ApproxParamOnCurve(NumSegOn1+1+diff,(Standard_Real)0.0);
+          IntCurve_ExactIntersectionPoint::MathPerform();
+          //-- le 18 nov 97 
+          if(diff>3) diff+=1+(Poly1.NbSegments()-NumSegOn1)/2;
+        }
+        while( nbroots==0 && diff!=0);
+      }
+      BSupVector.Value(1) = AnBsupVector;
+    }
+
+    if(nbroots==0) { 
+      //-- On risque de donner des bornes sur la courbe 1 trop etroites. 
+      Standard_Integer diff=1;
+      Standard_Real AnBinfVector = BInfVector.Value(2);
+      Standard_Real AnBsupVector = BSupVector.Value(2);
+      //---------------- On elargit les bornes par la gauche --------------------
+      do { 
+        diff++;
+        if((NumSegOn2-diff)<=1) { 
+          BInfVector.Value(2)= Poly2.InfParameter(); 
+          diff=0;
+        }
+        else BInfVector.Value(2)= Poly2.ApproxParamOnCurve(NumSegOn2-diff,(Standard_Real)0.0); 
+        IntCurve_ExactIntersectionPoint::MathPerform();
+        //-- le 18 nov 97 
+        if(diff>3) diff+=NumSegOn2/2;
+      }
+      while( nbroots==0 && diff!=0);
+      //---------------- On elargit les bornes par la droite --------------------      
+      if(nbroots==0) 
+      { 
+        BInfVector.Value(2) = AnBinfVector;
+        diff=1;
+        do { 
+          diff++;
+          if((NumSegOn2+diff) >= (Poly2.NbSegments() -1)) { 
+            BSupVector.Value(2)= Poly2.SupParameter();
+            diff=0;
+          }
+          else BSupVector.Value(2)= Poly2.ApproxParamOnCurve(NumSegOn2+1+diff,(Standard_Real)0.0);
+          IntCurve_ExactIntersectionPoint::MathPerform();
+          //-- le 18 nov 97 
+          if(diff>3) diff+=1+(Poly2.NbSegments()-NumSegOn2)/2;
+        }
+        while( nbroots==0 && diff!=0);
       }
+      BSupVector.Value(2) = AnBsupVector;
     }
   }
+}
   //----------------------------------------------------------------------
 void IntCurve_ExactIntersectionPoint::Perform( const Standard_Real Uo
               ,const Standard_Real Vo
@@ -200,26 +202,30 @@ void IntCurve_ExactIntersectionPoint::Roots(Standard_Real& U,Standard_Real& V) {
   }
   //----------------------------------------------------------------------
 
-void IntCurve_ExactIntersectionPoint::MathPerform(void) {
-    math_FunctionSetRoot Fct( FctDist
-                            ,StartingPoint
-                            ,ToleranceVector
-                            ,BInfVector
-                            ,BSupVector
-                            ,50);
-    
-    if(Fct.IsDone()) { 
-      Fct.Root(Root); nbroots = 1; 
-      math_Vector XY(1,2);
-      FctDist.Value(Root,XY);
-      Standard_Real dist2 = ((XY(1)*XY(1)+XY(2)*XY(2)));
-      if(dist2 > myTol) nbroots = 0;
-    }
-    else { 
-      anErrorOccurred = Standard_True;
-      nbroots = 0; 
+void IntCurve_ExactIntersectionPoint::MathPerform(void)
+{
+  math_FunctionSetRoot Fct( FctDist
+    ,StartingPoint
+    ,ToleranceVector
+    ,BInfVector
+    ,BSupVector
+    ,50);
+
+  if(Fct.IsDone()) { 
+    Fct.Root(Root); nbroots = 1; 
+    math_Vector XY(1,2);
+    FctDist.Value(Root,XY);
+    Standard_Real dist2 = ((XY(1)*XY(1)+XY(2)*XY(2)));
+    if(dist2 > myTol) 
+    {
+      nbroots = 0;
     }
   }
+  else { 
+    anErrorOccurred = Standard_True;
+    nbroots = 0; 
+  }
+}
     
 //======================================================================
 
index 2d6eace..0272917 100755 (executable)
@@ -93,9 +93,6 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
                                      ,const Standard_Real TheTolConf
                                      ,const Standard_Real TheTol)
 {
-
-  Standard_Boolean AnErrorOccurred = Standard_False;
-
   this->ResetFields();
   DomainOnCurve1=D1;
   DomainOnCurve2=D2; 
@@ -127,8 +124,6 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
   //--------------------------------------------------------------------
   Standard_Integer PosSegment = 0;
 
-
-
   for(i=1;i<=n;i++) { 
     IntRes2d_Position Pos1 = this->Point(i).TransitionOfFirst().PositionOnCurve();
     if(Pos1 == IntRes2d_Head) HeadOn1 = Standard_True;
@@ -185,15 +180,10 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
     }
   }
 
-
-
   Standard_Real U0 = D1.FirstParameter();
   Standard_Real U1 = D1.LastParameter();
   Standard_Real V0 = D2.FirstParameter();
   Standard_Real V1 = D2.LastParameter();
-  Standard_Real v,u;
-  Standard_Real EpsX1 = TheCurveTool::EpsX(C1);
-  Standard_Real EpsX2 = TheCurveTool::EpsX(C2);
   IntRes2d_IntersectionPoint IntPt;
   
   if(D1.FirstTolerance() || D2.FirstTolerance()) { 
@@ -212,50 +202,9 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
     if(HeadOrEndPoint(D1,C1,U1,D2,C2,V1,TheTolConf,IntPt,HeadOn1,HeadOn2,EndOn1,EndOn2,PosSegment)) 
       this->Insert(IntPt);
   }
-  if(AnErrorOccurred) {
-    //----------------------------------------------------------------------------------
-    //-- On a donne un point approche a la recherche du point exact, et cette recherche 
-    //-- a echoue. 
-    //-- Soit le point n'existe pas, soit c'est un point en bout dont un des parameteres
-    //-- est en dehors du domaine de la courbe. 
-    //--
-    //-- Dans le cas contraire, on suppose que les points en bouts ont ete trouves par 
-    //-- les interferences des polygones
-    //--
-    if(!HeadOn1)  {
-      u = U0;
-      v = TheProjPCur::FindParameter( C2,D1.FirstPoint(),V0,V1,EpsX2);
-      if(HeadOrEndPoint(D1,C1,u,D2,C2,v,TheTolConf,IntPt,HeadOn1,HeadOn2,EndOn1,EndOn2,PosSegment))
-       this->Insert(IntPt);
-    }
-    
-    if(!EndOn1)  {  
-      u = U1;
-      v = TheProjPCur::FindParameter( C2,D1.LastPoint(),V0,V1,EpsX2);
-      if(HeadOrEndPoint(D1,C1,u,D2,C2,v,TheTolConf,IntPt,HeadOn1,HeadOn2,EndOn1,EndOn2,PosSegment))
-       this->Insert(IntPt);
-    }
-    
-    if(!HeadOn2)  {  
-      u = TheProjPCur::FindParameter( C1,D2.FirstPoint(),U0,U1,EpsX1);
-      v = V0;
-      if(HeadOrEndPoint(D1,C1,u,D2,C2,v,TheTolConf,IntPt,HeadOn1,HeadOn2,EndOn1,EndOn2,PosSegment))
-       this->Insert(IntPt);
-    }
-    
-    if(!EndOn2)  {  
-      u = TheProjPCur::FindParameter( C1,D2.LastPoint(),U0,U1,EpsX1);
-      v = V1;
-      if(HeadOrEndPoint(D1,C1,u,D2,C2,v,TheTolConf,IntPt,HeadOn1,HeadOn2,EndOn1,EndOn2,PosSegment))
-       this->Insert(IntPt);
-    } 
-  }
 }
 
 
-
-
-
 //======================================================================
 //==      A u t o   I n t e r s e c t i o  n 
 //======================================================================
@@ -282,7 +231,6 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
   Standard_Integer i;
   Standard_Integer n=this->NbPoints();
 
-
   //--------------------------------------------------------------------
   //-- On ne rejette les points Head Head ... End End 
   //-- si ils figurent deja dans un bout de segment 
@@ -295,8 +243,6 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
   //--------------------------------------------------------------------
   Standard_Integer PosSegment = 0;
 
-
-
   for(i=1;i<=n;i++) { 
     IntRes2d_Position Pos1 = this->Point(i).TransitionOfFirst().PositionOnCurve();
     if(Pos1 == IntRes2d_Head) HeadOn1 = Standard_True;
@@ -355,8 +301,6 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
 }
 //======================================================================
 
-
-
 void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
                                      ,const IntRes2d_Domain& D1
                                      ,const Standard_Real TolConf
@@ -369,8 +313,6 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
   gp_Pnt2d P1,P2;
   Standard_Integer nbsamples;
   done = Standard_False;
-  Standard_Boolean AnErrorOccurred = Standard_False;
-  
   
   nbsamples = TheCurveTool::NbSamples(C1,D1.FirstParameter(),D1.LastParameter());
 
@@ -382,7 +324,7 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
                   //--   polygones assez loin de la courbe a parametre ct.
 
   if(NbIter>0) { 
-      nbsamples=(3*(nbsamples*NbIter))/2;
+    nbsamples=(3*(nbsamples*NbIter))/2;
   }
   IntCurve_ThePolygon2d Poly1(C1,nbsamples,D1,Tol);
   if(!Poly1.AutoIntersectionIsPossible()) { 
@@ -433,26 +375,26 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
       Triok=Standard_True;
 
       for(Standard_Integer tr=1;tr<Nbsp;tr++) { 
-       SegIndex1=PtrSegIndex1[TriIndex[tr]];
-       SegIndex_1=PtrSegIndex1[TriIndex[tr+1]];
-
-       SegIndex2=PtrSegIndex2[TriIndex[tr]];
-       SegIndex_2=PtrSegIndex2[TriIndex[tr+1]];
-
-       if(SegIndex1 > SegIndex_1) { 
-         Standard_Integer q=TriIndex[tr]; 
-         TriIndex[tr]=TriIndex[tr+1];
-         TriIndex[tr+1]=q;
-         Triok=Standard_False;
-       }
-       else if(SegIndex1 == SegIndex_1) { 
-         if(SegIndex2 > SegIndex_2) { 
-           Standard_Integer q=TriIndex[tr]; 
-           TriIndex[tr]=TriIndex[tr+1];
-           TriIndex[tr+1]=q;
-           Triok=Standard_False;
-         }
-       }
+             SegIndex1=PtrSegIndex1[TriIndex[tr]];
+             SegIndex_1=PtrSegIndex1[TriIndex[tr+1]];
+
+             SegIndex2=PtrSegIndex2[TriIndex[tr]];
+             SegIndex_2=PtrSegIndex2[TriIndex[tr+1]];
+
+             if(SegIndex1 > SegIndex_1) { 
+               Standard_Integer q=TriIndex[tr]; 
+               TriIndex[tr]=TriIndex[tr+1];
+               TriIndex[tr+1]=q;
+               Triok=Standard_False;
+             }
+             else if(SegIndex1 == SegIndex_1) { 
+               if(SegIndex2 > SegIndex_2) { 
+                 Standard_Integer q=TriIndex[tr]; 
+                 TriIndex[tr]=TriIndex[tr+1];
+                 TriIndex[tr+1]=q;
+                 Triok=Standard_False;
+               }
+             }
       }
     }
     while(Triok==Standard_False);
@@ -460,9 +402,8 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
     //-- supression des doublons Si Si !
     for(i=1; i<Nbsp;i++) { 
       if(   (PtrSegIndex1[TriIndex[i]] == PtrSegIndex1[TriIndex[i+1]])
-        && (PtrSegIndex2[TriIndex[i]] == PtrSegIndex2[TriIndex[i+1]])) { 
-       TriIndex[i]=-i;
-
+               && (PtrSegIndex2[TriIndex[i]] == PtrSegIndex2[TriIndex[i+1]])) { 
+             TriIndex[i]=-i;
       }
     }
 
@@ -471,96 +412,94 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
 
     for(Standard_Integer sp=1; sp <= Nbsp; sp++) {
       if(TriIndex[sp]>0) { 
-       const Intf_SectionPoint& SPnt = InterPP.PntValue(TriIndex[sp]);
-       
-       SPnt.InfoFirst(Type,SegIndex1,ParamOn1);
-       SPnt.InfoSecond(Type,SegIndex2,ParamOn2);
-       
-       if(Abs(SegIndex1-SegIndex2)>1) { 
+             const Intf_SectionPoint& SPnt = InterPP.PntValue(TriIndex[sp]);
+       
+             SPnt.InfoFirst(Type,SegIndex1,ParamOn1);
+             SPnt.InfoSecond(Type,SegIndex2,ParamOn2);
+       
+             if(Abs(SegIndex1-SegIndex2)>1) { 
          
-         EIP.Perform(Poly1,Poly1,SegIndex1,SegIndex2,ParamOn1,ParamOn2);
-         AnErrorOccurred = EIP.AnErrorOccurred();
-         if(EIP.NbRoots()==0) {
-           //-- On supprime tous les segments voisins 
-           for(Standard_Integer k=sp+1;k<=Nbsp;k++) { 
-             Standard_Integer kk=TriIndex[k];
-             // modified by OFV OCC2502  Tue Apr 29 15:07:45 2003 .Begin
-             // --- avoid negative indicies as well as in outer done
-             if( kk > 0 ) {
-               if(   Abs(SegIndex1-PtrSegIndex1[kk])< Nelarg
-                  && Abs(SegIndex2-PtrSegIndex2[kk])< Nelarg) { 
-                 TriIndex[k]=-k;
-               }
-             }
-             // modified by OFV OCC2502  Tue Apr 29 15:11:34 2003 .End
-           }
-         }       
-         else if(EIP.NbRoots()>=1) { 
-           //--------------------------------------------------------------------
-           //-- On verifie que le point trouve est bien une racine
-           //--------------------------------------------------------------------
-           EIP.Roots(U,V);
-
-           TheCurveTool::D1(C1,U,P1,Tan1);
-           TheCurveTool::D1(C1,V,P2,Tan2);
-           Standard_Real Dist = P1.Distance(P2);
-           Standard_Real EpsX1 = 10.0*TheCurveTool::EpsX(C1);
-           
-           if(Abs(U-V)<=EpsX1) { 
-             //-----------------------------------------
-             //-- Solution non valide 
-             //-- Les maths ont du converger vers une 
-             //-- solution triviale ( point U = V )
-             //-----------------------------------------
-             Dist = TolConf+1.0;
-           }
-           
-           //-----------------------------------------------------------------
-           //-- On verifie que le point (u,v) n existe pas deja 
-           //--
-           done = Standard_True;
-           Standard_Integer nbp=NbPoints();
-           
-           for(Standard_Integer p=1; p<=nbp; p++) { 
-             const IntRes2d_IntersectionPoint& P=Point(p);
-             if(Abs(U-P.ParamOnFirst()) <= EpsX1) { 
-               if(Abs(V-P.ParamOnSecond()) <= EpsX1) { 
-                 Dist = TolConf+1.0;  p+=nbp;
-               }
+               EIP.Perform(Poly1,Poly1,SegIndex1,SegIndex2,ParamOn1,ParamOn2);
+               if(EIP.NbRoots()==0) {
+                 //-- On supprime tous les segments voisins 
+                 for(Standard_Integer k=sp+1;k<=Nbsp;k++) { 
+                   Standard_Integer kk=TriIndex[k];
+                   // --- avoid negative indicies as well as in outer done
+                   if( kk > 0 ) {
+                           if(   Abs(SegIndex1-PtrSegIndex1[kk])< Nelarg
+                              && Abs(SegIndex2-PtrSegIndex2[kk])< Nelarg) { 
+                             TriIndex[k]=-k;
+                           }
+              }
+                 }
+               }         
+               else if(EIP.NbRoots()>=1) { 
+                 //--------------------------------------------------------------------
+                 //-- On verifie que le point trouve est bien une racine
+                 //--------------------------------------------------------------------
+                 EIP.Roots(U,V);
+
+                 TheCurveTool::D1(C1,U,P1,Tan1);
+                 TheCurveTool::D1(C1,V,P2,Tan2);
+                 Standard_Real Dist = P1.Distance(P2);
+                 Standard_Real EpsX1 = 10.0*TheCurveTool::EpsX(C1);
+           
+                 if(Abs(U-V)<=EpsX1) { 
+                   //-----------------------------------------
+                   //-- Solution non valide 
+                   //-- Les maths ont du converger vers une 
+                   //-- solution triviale ( point U = V )
+                   //-----------------------------------------
+                   Dist = TolConf+1.0;
+                 }
+           
+                 //-----------------------------------------------------------------
+                 //-- On verifie que le point (u,v) n existe pas deja 
+                 //--
+                 done = Standard_True;
+                 Standard_Integer nbp=NbPoints();
+           
+                 for(Standard_Integer p=1; p<=nbp; p++) { 
+                   const IntRes2d_IntersectionPoint& P=Point(p);
+                   if(Abs(U-P.ParamOnFirst()) <= EpsX1) { 
+                           if(Abs(V-P.ParamOnSecond()) <= EpsX1) { 
+                             Dist = TolConf+1.0;  p+=nbp;
+                           }
+                   }
+                 }
+           
+                 if(Dist <= TolConf) {    //-- Ou le point est deja present
+                   IntRes2d_Position Pos1 = IntRes2d_Middle;
+                   IntRes2d_Position Pos2 = IntRes2d_Middle;
+                   IntRes2d_Transition  Trans1,Trans2;
+                   //-----------------------------------------------------------------
+                   //-- Calcul des Positions des Points sur la courbe
+                   //--
+                   if(P1.Distance(DomainOnCurve1.FirstPoint())<=DomainOnCurve1.FirstTolerance())    
+                           Pos1 = IntRes2d_Head;
+                   else if(P1.Distance(DomainOnCurve1.LastPoint())<=DomainOnCurve1.LastTolerance()) 
+                           Pos1 = IntRes2d_End;
+             
+                   if(P2.Distance(DomainOnCurve2.FirstPoint())<=DomainOnCurve2.FirstTolerance())    
+                           Pos2 = IntRes2d_Head;
+                   else if(P2.Distance(DomainOnCurve2.LastPoint())<=DomainOnCurve2.LastTolerance()) 
+                           Pos2 = IntRes2d_End;
+                   //-----------------------------------------------------------------
+                   if(IntImpParGen::DetermineTransition( Pos1,Tan1,Trans1
+                                                        ,Pos2,Tan2,Trans2
+                                                        ,TolConf) == Standard_False) 
+              {
+                           TheCurveTool::D2(C1,U,P1,Tan1,Norm1);
+                           TheCurveTool::D2(C1,V,P2,Tan2,Norm2);
+                           IntImpParGen::DetermineTransition( Pos1,Tan1,Norm1,Trans1
+                                                             ,Pos2,Tan2,Norm2,Trans2
+                                                             ,TolConf);
+                   }
+                   IntRes2d_IntersectionPoint IP(P1,U,V,Trans1,Trans2,Standard_False);
+                   Insert(IP);
+                 }
+               }
              }
-           }
-           
-           if(Dist <= TolConf) {    //-- Ou le point est deja present
-             IntRes2d_Position Pos1 = IntRes2d_Middle;
-             IntRes2d_Position Pos2 = IntRes2d_Middle;
-             IntRes2d_Transition  Trans1,Trans2;
-             //-----------------------------------------------------------------
-             //-- Calcul des Positions des Points sur la courbe
-             //--
-             if(P1.Distance(DomainOnCurve1.FirstPoint())<=DomainOnCurve1.FirstTolerance())    
-               Pos1 = IntRes2d_Head;
-             else if(P1.Distance(DomainOnCurve1.LastPoint())<=DomainOnCurve1.LastTolerance()) 
-               Pos1 = IntRes2d_End;
-             
-             if(P2.Distance(DomainOnCurve2.FirstPoint())<=DomainOnCurve2.FirstTolerance())    
-               Pos2 = IntRes2d_Head;
-             else if(P2.Distance(DomainOnCurve2.LastPoint())<=DomainOnCurve2.LastTolerance()) 
-               Pos2 = IntRes2d_End;
-             //-----------------------------------------------------------------
-             if(IntImpParGen::DetermineTransition( Pos1,Tan1,Trans1
-                                                  ,Pos2,Tan2,Trans2
-                                                  ,TolConf) == Standard_False) {
-               TheCurveTool::D2(C1,U,P1,Tan1,Norm1);
-               TheCurveTool::D2(C1,V,P2,Tan2,Norm2);
-               IntImpParGen::DetermineTransition( Pos1,Tan1,Norm1,Trans1
-                                                 ,Pos2,Tan2,Norm2,Trans2
-                                                 ,TolConf);
-             }
-             IntRes2d_IntersectionPoint IP(P1,U,V,Trans1,Trans2,Standard_False);
-             Insert(IP);
-           }
-         }
-       }
       }
     }
     delete [] TriIndex;
@@ -616,7 +555,6 @@ Standard_Boolean HeadOrEndPoint( const IntRes2d_Domain& D1
     u = D1.LastParameter();
   }
 
-
   //----------------------------------------------------------------------
   //-- Head On 2   :        Head2 <-> P1
   else if(P1.Distance(D2.FirstPoint())<=D2.FirstTolerance())    { 
@@ -637,18 +575,17 @@ Standard_Boolean HeadOrEndPoint( const IntRes2d_Domain& D1
   Standard_Real EpsX1 = TheCurveTool::EpsX(C1);
   Standard_Real EpsX2 = TheCurveTool::EpsX(C2);
 
-  
   if((Pos1 != IntRes2d_Middle)||(Pos2 !=  IntRes2d_Middle)) { 
     if(Pos1 == IntRes2d_Middle) {
       if(Abs(u-D1.FirstParameter()) <= EpsX1) { 
-       Pos1 = IntRes2d_Head;
-       P1 = D1.FirstPoint();
-       HeadOn1 = Standard_True;
+             Pos1 = IntRes2d_Head;
+             P1 = D1.FirstPoint();
+             HeadOn1 = Standard_True;
       }
       else if(Abs(u-D1.LastParameter()) <= EpsX1) { 
-       Pos1 = IntRes2d_End;
-       P1 = D1.LastPoint();
-       EndOn1 = Standard_True;
+             Pos1 = IntRes2d_End;
+             P1 = D1.LastPoint();
+             EndOn1 = Standard_True;
       }
     }
     else if(u!=tu) {
@@ -658,30 +595,29 @@ Standard_Boolean HeadOrEndPoint( const IntRes2d_Domain& D1
     
     if(Pos2 == IntRes2d_Middle) { 
       if(Abs(v-D2.FirstParameter()) <= EpsX2) { 
-       Pos2 = IntRes2d_Head;
-       HeadOn2 = Standard_True;
-       P2 = D2.FirstPoint();   
-       if(Pos1 != IntRes2d_Middle) {
-         P1.SetCoord(0.5*(P1.X()+P2.X()),0.5*(P1.Y()+P2.Y()));
-       }
-       else { 
-         P2 = P1; 
-       }
+             Pos2 = IntRes2d_Head;
+             HeadOn2 = Standard_True;
+             P2 = D2.FirstPoint();     
+             if(Pos1 != IntRes2d_Middle) {
+               P1.SetCoord(0.5*(P1.X()+P2.X()),0.5*(P1.Y()+P2.Y()));
+             }
+             else { 
+               P2 = P1; 
+             }
       }
       else if(Abs(v-D2.LastParameter()) <= EpsX2) { 
-       Pos2 = IntRes2d_End;
-       EndOn2 = Standard_True;
-       P2 = D2.LastPoint();
-       if(Pos1 != IntRes2d_Middle) {
-         P1.SetCoord(0.5*(P1.X()+P2.X()),0.5*(P1.Y()+P2.Y()));
-       }
-       else { 
-         P2 = P1; 
-       }
+             Pos2 = IntRes2d_End;
+             EndOn2 = Standard_True;
+             P2 = D2.LastPoint();
+             if(Pos1 != IntRes2d_Middle) {
+               P1.SetCoord(0.5*(P1.X()+P2.X()),0.5*(P1.Y()+P2.Y()));
+             }
+             else { 
+               P2 = P1; 
+             }
       }
     }
 
-
     //--------------------------------------------------------------------
     //-- On Teste si un point de bout de segment a deja ces trnasitions 
     //-- Si Oui, on ne cree pas de nouveau point
@@ -716,11 +652,6 @@ Standard_Boolean HeadOrEndPoint( const IntRes2d_Domain& D1
 }
 
 
-
-
-
-
-
 //======================================================================
 void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
                                      ,const IntRes2d_Domain& D1
@@ -739,30 +670,28 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
 
   nbsamplesOnC1 = TheCurveTool::NbSamples(C1,D1.FirstParameter(),D1.LastParameter());      
 
-  //// modified by jgv, 5.12.02 for OCC935 ////
   if (NbIter == 0) // first time
-    {
-      if (nbsamplesOnC1 < 20)
-       nbsamplesOnC1 = 20;
-    }
+  {
+    if (nbsamplesOnC1 < 20)
+      nbsamplesOnC1 = 20;
+  }
   else // NbIter > 0
-    {
-           nbsamplesOnC1=(5*(nbsamplesOnC1*NbIter))/4;
-    }
+  {
+    nbsamplesOnC1=(5*(nbsamplesOnC1*NbIter))/4;
+  }
   /////////////////////////////////////////////
 
   nbsamplesOnC2 = TheCurveTool::NbSamples(C2,D2.FirstParameter(),D2.LastParameter());
   
-  //// modified by jgv, 5.12.02 for OCC935 ////
   if (NbIter == 0) // first time
-    {
-      if (nbsamplesOnC2 < 20)
-       nbsamplesOnC2 = 20;
-    }
+  {
+    if (nbsamplesOnC2 < 20)
+      nbsamplesOnC2 = 20;
+  }
   else // NbIter > 0
-    {
-           nbsamplesOnC2=(5*(nbsamplesOnC2*NbIter))/4;
-    }
+  {
+    nbsamplesOnC2=(5*(nbsamplesOnC2*NbIter))/4;
+  }
   /////////////////////////////////////////////
 
   
@@ -815,56 +744,56 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
   if( !findIntersect( C1, D1, C2, D2, TolConf, Tol, NbIter,
          DeltaU, DeltaV, *aPoly1, *aPoly2, isFullRepresentation ) && !isFullRepresentation ) 
   {
-       if(aPoly1->NbSegments() < nbsamplesOnC1)
-       {
-         aPoly1 = new IntCurve_ThePolygon2d(C1,nbsamplesOnC1,D1,Tol);
-       }
-       if(aPoly2->NbSegments() < nbsamplesOnC2)
-       {
-         aPoly2 = new IntCurve_ThePolygon2d(C2,nbsamplesOnC2,D2,Tol);
-       }
-       
-       findIntersect( C1, D1, C2, D2, TolConf, Tol, NbIter,
-         DeltaU, DeltaV, *aPoly1, *aPoly2, 
-         Standard_True);       
-       
+    if(aPoly1->NbSegments() < nbsamplesOnC1)
+    {
+      aPoly1 = new IntCurve_ThePolygon2d(C1,nbsamplesOnC1,D1,Tol);
+    }
+    if(aPoly2->NbSegments() < nbsamplesOnC2)
+    {
+      aPoly2 = new IntCurve_ThePolygon2d(C2,nbsamplesOnC2,D2,Tol);
+    }
+
+    findIntersect( C1, D1, C2, D2, TolConf, Tol, NbIter,
+      DeltaU, DeltaV, *aPoly1, *aPoly2, 
+      Standard_True);  
+
   }
  
   done = Standard_True;
 }
 
 //======================================================================
-// Purpose :
+// Purpose : findIntersect
 //======================================================================
 
 Standard_Boolean IntCurve_IntPolyPolyGen::findIntersect( 
     const TheCurve& C1,
-       const IntRes2d_Domain& D1,
-       const TheCurve& C2,
-       const IntRes2d_Domain& D2,
-       const Standard_Real TolConf,
-       const Standard_Real Tol,
-       const Standard_Integer NbIter,
-       const Standard_Real DeltaU,
-       const Standard_Real DeltaV,
-       const IntCurve_ThePolygon2d& thePoly1,
-       const IntCurve_ThePolygon2d& thePoly2,
-       Standard_Boolean isFullPolygon )
+         const IntRes2d_Domain& D1,
+         const TheCurve& C2,
+         const IntRes2d_Domain& D2,
+         const Standard_Real TolConf,
+         const Standard_Real Tol,
+         const Standard_Integer NbIter,
+         const Standard_Real DeltaU,
+         const Standard_Real DeltaV,
+         const IntCurve_ThePolygon2d& thePoly1,
+         const IntCurve_ThePolygon2d& thePoly2,
+         Standard_Boolean isFullPolygon )
 {
 
   gp_Vec2d Tan1,Tan2,Norm1,Norm2;
   gp_Pnt2d P1,P2;
   Intf_InterferencePolygon2d InterPP(thePoly1,thePoly2);  
   IntCurve_ExactIntersectionPoint  EIP(C1,C2,TolConf);
-  Standard_Real U,V;
-  
+  Standard_Real U = 0., V = 0.;
+  Standard_Boolean AnErrorOccurred = Standard_False;
+  done = Standard_True; // To prevent exception in nbp=NbPoints();
   //----------------------------------------------------------------------
   //-- Traitement des SectionPoint 
   //----------------------------------------------------------------------
   Standard_Integer Nbsp = InterPP.NbSectionPoints();
-    
   for(Standard_Integer sp=1; sp <= Nbsp; sp++) {
-       const Intf_SectionPoint& SPnt = InterPP.PntValue(sp);
+    const Intf_SectionPoint& SPnt = InterPP.PntValue(sp);
     Standard_Integer SegIndex1,SegIndex2;
     Standard_Real    ParamOn1,ParamOn2;
     Intf_PIType      Type;
@@ -872,67 +801,65 @@ Standard_Boolean IntCurve_IntPolyPolyGen::findIntersect(
     SPnt.InfoFirst(Type,SegIndex1,ParamOn1);
     SPnt.InfoSecond(Type,SegIndex2,ParamOn2);
     EIP.Perform(thePoly1,thePoly2,SegIndex1,SegIndex2,ParamOn1,ParamOn2);
-    //AnErrorOccurred = EIP.AnErrorOccurred();
+    AnErrorOccurred = EIP.AnErrorOccurred();
+
     if( !EIP.NbRoots() && !isFullPolygon)
       return Standard_False;
-      
-     
-       //--------------------------------------------------------------------
-       //-- On verifie que le point trouve est bien une racine
-       //--------------------------------------------------------------------
-       EIP.Roots(U,V);
-       TheCurveTool::D1(C1,U,P1,Tan1);
-       TheCurveTool::D1(C2,V,P2,Tan2);
-       Standard_Real Dist = P1.Distance(P2);
-       //-----------------------------------------------------------------
-       //-- On verifie que le point (u,v) n existe pas deja 
-       //--
-       done = Standard_True;
-       Standard_Integer nbp=NbPoints();
-       Standard_Real EpsX1 = 10.0*TheCurveTool::EpsX(C1);
-       Standard_Real EpsX2 = 10.0*TheCurveTool::EpsX(C2);
-
-       for(Standard_Integer p=1; p<=nbp; p++) { 
-         const IntRes2d_IntersectionPoint& P=Point(p);
-         if(Abs(U-P.ParamOnFirst()) <= EpsX1) { 
-           if(Abs(V-P.ParamOnSecond()) <= EpsX2) { 
-             Dist = TolConf+1.0;  p+=nbp;
-           }
-         }
-       }
-
-       if(Dist <= TolConf) {    //-- Ou le point est deja present
-         IntRes2d_Position Pos1 = IntRes2d_Middle;
-         IntRes2d_Position Pos2 = IntRes2d_Middle;
-         IntRes2d_Transition  Trans1,Trans2;
-         //-----------------------------------------------------------------
-         //-- Calcul des Positions des Points sur la courbe
-         //--
-         if(P1.Distance(DomainOnCurve1.FirstPoint())<=DomainOnCurve1.FirstTolerance())    
-           Pos1 = IntRes2d_Head;
-         else if(P1.Distance(DomainOnCurve1.LastPoint())<=DomainOnCurve1.LastTolerance()) 
-           Pos1 = IntRes2d_End;
-         
-         if(P2.Distance(DomainOnCurve2.FirstPoint())<=DomainOnCurve2.FirstTolerance())    
-           Pos2 = IntRes2d_Head;
-         else if(P2.Distance(DomainOnCurve2.LastPoint())<=DomainOnCurve2.LastTolerance()) 
-           Pos2 = IntRes2d_End;
-         //-----------------------------------------------------------------
-         //-- Calcul des Transitions (Voir IntImpParGen.cxx)
-         //--
-         if(IntImpParGen::DetermineTransition( Pos1,Tan1,Trans1
-                                              ,Pos2,Tan2,Trans2
-                                              ,TolConf)==Standard_False) { 
-           
-           TheCurveTool::D2(C1,U,P1,Tan1,Norm1);
-           TheCurveTool::D2(C2,V,P2,Tan2,Norm2);
-           IntImpParGen::DetermineTransition( Pos1,Tan1,Norm1,Trans1
-                                             ,Pos2,Tan2,Norm2,Trans2
-                                             ,TolConf);
-         }
-         IntRes2d_IntersectionPoint IP(P1,U,V,Trans1,Trans2,Standard_False);
-         Insert(IP);
-       }
+
+    if(AnErrorOccurred) 
+    {
+      continue;
+    }
+
+    //--------------------------------------------------------------------
+    //-- On verifie que le point trouve est bien une racine
+    //--------------------------------------------------------------------
+    EIP.Roots(U,V);
+    TheCurveTool::D1(C1,U,P1,Tan1);
+    TheCurveTool::D1(C2,V,P2,Tan2);
+    Standard_Real Dist = P1.Distance(P2);
+    //-----------------------------------------------------------------
+    //-- On verifie que le point (u,v) n existe pas deja 
+    //--
+    Standard_Integer nbp=NbPoints();
+    Standard_Real EpsX1 = 10.0*TheCurveTool::EpsX(C1);
+    Standard_Real EpsX2 = 10.0*TheCurveTool::EpsX(C2);
+    for(Standard_Integer p=1; p<=nbp; p++) { 
+      const IntRes2d_IntersectionPoint& P=Point(p);
+      if(Abs(U-P.ParamOnFirst()) <= EpsX1) { 
+        if(Abs(V-P.ParamOnSecond()) <= EpsX2) { 
+          Dist = TolConf+1.0;  p+=nbp;
+        }
+      }
+    }
+
+    if(Dist <= TolConf) {    //-- Ou le point est deja present
+      IntRes2d_Position Pos1 = IntRes2d_Middle;
+      IntRes2d_Position Pos2 = IntRes2d_Middle;
+      IntRes2d_Transition  Trans1,Trans2;
+      //-----------------------------------------------------------------
+      //-- Calcul des Positions des Points sur la courbe
+      //--
+      if(P1.Distance(DomainOnCurve1.FirstPoint())<=DomainOnCurve1.FirstTolerance())    
+        Pos1 = IntRes2d_Head;
+      else if(P1.Distance(DomainOnCurve1.LastPoint())<=DomainOnCurve1.LastTolerance()) 
+        Pos1 = IntRes2d_End;
+
+      if(P2.Distance(DomainOnCurve2.FirstPoint())<=DomainOnCurve2.FirstTolerance())    
+        Pos2 = IntRes2d_Head;
+      else if(P2.Distance(DomainOnCurve2.LastPoint())<=DomainOnCurve2.LastTolerance()) 
+        Pos2 = IntRes2d_End;
+      //-----------------------------------------------------------------
+      //-- Calcul des Transitions (Voir IntImpParGen.cxx)
+      //--
+      if(IntImpParGen::DetermineTransition (Pos1, Tan1, Trans1, Pos2, Tan2, Trans2, TolConf) == Standard_False) { 
+        TheCurveTool::D2(C1,U,P1,Tan1,Norm1);
+        TheCurveTool::D2(C2,V,P2,Tan2,Norm2);
+        IntImpParGen::DetermineTransition (Pos1, Tan1, Norm1, Trans1, Pos2, Tan2, Norm2, Trans2, TolConf);
+      }
+      IntRes2d_IntersectionPoint IP(P1,U,V,Trans1,Trans2,Standard_False);
+      Insert(IP);
+    }
   }
   
   //----------------------------------------------------------------------
@@ -983,7 +910,6 @@ Standard_Boolean IntCurve_IntPolyPolyGen::findIntersect(
 
       if(ParamSupOnCurve1 < _PolyUInf) ParamSupOnCurve1=_PolyUInf;
       if(ParamSupOnCurve2 < _PolyVInf) ParamSupOnCurve2=_PolyVInf;
-
     }
 
     PolyUInf= ParamInfOnCurve1;
@@ -1000,11 +926,9 @@ Standard_Boolean IntCurve_IntPolyPolyGen::findIntersect(
       Standard_Real qwerty=PolyVInf; PolyVInf=PolyVSup; PolyVSup=qwerty;
     }
 
-    
-
     if(  (  (thePoly1.DeflectionOverEstimation() > TolConf)
            ||(thePoly2.DeflectionOverEstimation() > TolConf))
-        &&(NbIter<NBITER_MAX_POLYGON)) {
+           &&(NbIter<NBITER_MAX_POLYGON)) {
       
       IntRes2d_Domain RecursD1( TheCurveTool::Value(C1,ParamInfOnCurve1)
                               ,ParamInfOnCurve1,TolConf
@@ -1032,101 +956,102 @@ Standard_Boolean IntCurve_IntPolyPolyGen::findIntersect(
       TheCurveTool::D1(C2,PolyVInf,P2,Tan2);
       
       if(P1.Distance(DomainOnCurve1.FirstPoint())<=DomainOnCurve1.FirstTolerance())    { 
-       Pos1 = IntRes2d_Head;
+             Pos1 = IntRes2d_Head;
       }
       else if(P1.Distance(DomainOnCurve1.LastPoint())<=DomainOnCurve1.LastTolerance()) { 
-       Pos1 = IntRes2d_End;  
+             Pos1 = IntRes2d_End;  
       }
       if(P2.Distance(DomainOnCurve2.FirstPoint())<=DomainOnCurve2.FirstTolerance())    { 
-       Pos2 = IntRes2d_Head; 
+             Pos2 = IntRes2d_Head; 
       }
       else if(P2.Distance(DomainOnCurve2.LastPoint())<=DomainOnCurve2.LastTolerance()) { 
-       Pos2 = IntRes2d_End;  
+             Pos2 = IntRes2d_End;  
       }
 
       if(Pos1==IntRes2d_Middle && Pos2!=IntRes2d_Middle) { 
-       PolyUInf=TheProjPCur::FindParameter( C1,P2,D1.FirstParameter(),D1.LastParameter(),TheCurveTool::EpsX(C1));
+             PolyUInf=TheProjPCur::FindParameter( C1,P2,D1.FirstParameter(),D1.LastParameter(),TheCurveTool::EpsX(C1));
       }
       else if(Pos1!=IntRes2d_Middle && Pos2==IntRes2d_Middle) { 
-       PolyVInf=TheProjPCur::FindParameter( C2,P1,D2.FirstParameter(),D2.LastParameter(),TheCurveTool::EpsX(C2));
+             PolyVInf=TheProjPCur::FindParameter( C2,P1,D2.FirstParameter(),D2.LastParameter(),TheCurveTool::EpsX(C2));
       }
       else if(Abs(ParamInfOnCurve1-ParamSupOnCurve1) > Abs(ParamInfOnCurve2-ParamSupOnCurve2)) { 
-       PolyVInf=TheProjPCur::FindParameter( C2,P1,D2.FirstParameter(),D2.LastParameter(),TheCurveTool::EpsX(C2));
+             PolyVInf=TheProjPCur::FindParameter( C2,P1,D2.FirstParameter(),D2.LastParameter(),TheCurveTool::EpsX(C2));
       }
       else { 
-       PolyUInf=TheProjPCur::FindParameter( C1,P2,D1.FirstParameter(),D1.LastParameter(),TheCurveTool::EpsX(C1));
+             PolyUInf=TheProjPCur::FindParameter( C1,P2,D1.FirstParameter(),D1.LastParameter(),TheCurveTool::EpsX(C1));
       }
       
 
 
       if(IntImpParGen::DetermineTransition( Pos1,Tan1,Trans1,Pos2,Tan2,Trans2,TolConf) 
-        == Standard_False) {
-       TheCurveTool::D2(C1,PolyUInf,P1,Tan1,Norm1);
-       TheCurveTool::D2(C2,PolyVInf,P2,Tan2,Norm2);
-       IntImpParGen::DetermineTransition(Pos1,Tan1,Norm1,Trans1,
-                                         Pos2,Tan2,Norm2,Trans2,TolConf);
+              == Standard_False)
+      {
+             TheCurveTool::D2(C1,PolyUInf,P1,Tan1,Norm1);
+             TheCurveTool::D2(C2,PolyVInf,P2,Tan2,Norm2);
+             IntImpParGen::DetermineTransition(Pos1,Tan1,Norm1,Trans1,
+                                               Pos2,Tan2,Norm2,Trans2,TolConf);
       }
       IntRes2d_IntersectionPoint PtSeg1(P1,PolyUInf,PolyVInf
                                        ,Trans1,Trans2,Standard_False);
       //----------------------------------------------------------------------
       
       if((Abs(PolyUInf-PolyUSup) <= TheCurveTool::EpsX(C1)) 
-        || (Abs(PolyVInf-PolyVSup) <= TheCurveTool::EpsX(C2))) { 
-       Insert(PtSeg1);
+             || (Abs(PolyVInf-PolyVSup) <= TheCurveTool::EpsX(C2)))
+      { 
+             Insert(PtSeg1);
       }
-      else { 
-       TheCurveTool::D1(C1,PolyUSup,P1,Tan1);
-       TheCurveTool::D1(C2,PolyVSup,P2,Tan2);
-       Pos1 = IntRes2d_Middle; Pos2 = IntRes2d_Middle;
+      else 
+      { 
+             TheCurveTool::D1(C1,PolyUSup,P1,Tan1);
+             TheCurveTool::D1(C2,PolyVSup,P2,Tan2);
+             Pos1 = IntRes2d_Middle; Pos2 = IntRes2d_Middle;
          
-       if(P1.Distance(DomainOnCurve1.FirstPoint())<=DomainOnCurve1.FirstTolerance())    { 
-         Pos1 = IntRes2d_Head; 
-       }
-       else if(P1.Distance(DomainOnCurve1.LastPoint())<=DomainOnCurve1.LastTolerance()) { 
-         Pos1 = IntRes2d_End;  
-       }
-       if(P2.Distance(DomainOnCurve2.FirstPoint())<=DomainOnCurve2.FirstTolerance())    { 
-         Pos2 = IntRes2d_Head; 
-       }
-       else if(P2.Distance(DomainOnCurve2.LastPoint())<=DomainOnCurve2.LastTolerance()) { 
-         Pos2 = IntRes2d_End;  
-       }
-
-
-       if(Pos1==IntRes2d_Middle && Pos2!=IntRes2d_Middle) { 
-         PolyUSup=TheProjPCur::FindParameter( C1,P2,D1.FirstParameter(),D1.LastParameter(),TheCurveTool::EpsX(C1));
-       }
-       else if(Pos1!=IntRes2d_Middle && Pos2==IntRes2d_Middle) { 
-         PolyVSup=TheProjPCur::FindParameter( C2,P1,D2.FirstParameter(),D2.LastParameter(),TheCurveTool::EpsX(C2));
-       }
-       else if(Abs(ParamInfOnCurve1-ParamSupOnCurve1) > Abs(ParamInfOnCurve2-ParamSupOnCurve2)) { 
-         PolyVSup=TheProjPCur::FindParameter( C2,P1,D2.FirstParameter(),D2.LastParameter(),TheCurveTool::EpsX(C2));
-       }
-       else { 
-         PolyUSup=TheProjPCur::FindParameter( C1,P2,D1.FirstParameter(),D1.LastParameter(),TheCurveTool::EpsX(C1));
-       }
-       
-       if(IntImpParGen::DetermineTransition( Pos1,Tan1,Trans1,Pos2,Tan2,Trans2,TolConf)
-          ==Standard_False) { 
-         TheCurveTool::D2(C1,PolyUSup,P1,Tan1,Norm1);
-         TheCurveTool::D2(C2,PolyVSup,P2,Tan2,Norm2);
-         IntImpParGen::DetermineTransition(Pos1,Tan1,Norm1,Trans1,
-                                           Pos2,Tan2,Norm2,Trans2,TolConf);
-       }
-       IntRes2d_IntersectionPoint PtSeg2(P1,PolyUSup,PolyVSup
-                                         ,Trans1,Trans2,Standard_False);
-       
+             if(P1.Distance(DomainOnCurve1.FirstPoint())<=DomainOnCurve1.FirstTolerance())    { 
+               Pos1 = IntRes2d_Head; 
+             }
+             else if(P1.Distance(DomainOnCurve1.LastPoint())<=DomainOnCurve1.LastTolerance()) { 
+               Pos1 = IntRes2d_End;  
+             }
+             if(P2.Distance(DomainOnCurve2.FirstPoint())<=DomainOnCurve2.FirstTolerance())    { 
+               Pos2 = IntRes2d_Head; 
+             }
+             else if(P2.Distance(DomainOnCurve2.LastPoint())<=DomainOnCurve2.LastTolerance()) { 
+               Pos2 = IntRes2d_End;  
+             }
+
+
+             if(Pos1==IntRes2d_Middle && Pos2!=IntRes2d_Middle) { 
+               PolyUSup=TheProjPCur::FindParameter( C1,P2,D1.FirstParameter(),D1.LastParameter(),TheCurveTool::EpsX(C1));
+             }
+             else if(Pos1!=IntRes2d_Middle && Pos2==IntRes2d_Middle) { 
+               PolyVSup=TheProjPCur::FindParameter( C2,P1,D2.FirstParameter(),D2.LastParameter(),TheCurveTool::EpsX(C2));
+             }
+             else if(Abs(ParamInfOnCurve1-ParamSupOnCurve1) > Abs(ParamInfOnCurve2-ParamSupOnCurve2)) { 
+               PolyVSup=TheProjPCur::FindParameter( C2,P1,D2.FirstParameter(),D2.LastParameter(),TheCurveTool::EpsX(C2));
+             }
+             else { 
+               PolyUSup=TheProjPCur::FindParameter( C1,P2,D1.FirstParameter(),D1.LastParameter(),TheCurveTool::EpsX(C1));
+             }
        
+        if(IntImpParGen::DetermineTransition( Pos1,Tan1,Trans1,Pos2,Tan2,Trans2,TolConf)
+           ==Standard_False) { 
+          TheCurveTool::D2(C1,PolyUSup,P1,Tan1,Norm1);
+          TheCurveTool::D2(C2,PolyVSup,P2,Tan2,Norm2);
+          IntImpParGen::DetermineTransition(Pos1,Tan1,Norm1,Trans1,
+                                           Pos2,Tan2,Norm2,Trans2,TolConf);
+        }
+        IntRes2d_IntersectionPoint PtSeg2(P1,PolyUSup,PolyVSup
+                                         ,Trans1,Trans2,Standard_False);
        
-       Standard_Boolean Oppos = (Tan1.Dot(Tan2) > 0.0)? Standard_False : Standard_True;
-       if(ParamInfOnCurve1 > ParamSupOnCurve1) {
-         IntRes2d_IntersectionSegment Seg(PtSeg2,PtSeg1,Oppos,Standard_False);
-         Append(Seg);
-       }
-       else { 
-         IntRes2d_IntersectionSegment Seg(PtSeg1,PtSeg2,Oppos,Standard_False);
-         Append(Seg);
-       }
+             Standard_Boolean Oppos = (Tan1.Dot(Tan2) > 0.0)? Standard_False : Standard_True;
+             if(ParamInfOnCurve1 > ParamSupOnCurve1) {
+               IntRes2d_IntersectionSegment Seg(PtSeg2,PtSeg1,Oppos,Standard_False);
+               Append(Seg);
+             }
+             else { 
+               IntRes2d_IntersectionSegment Seg(PtSeg1,PtSeg2,Oppos,Standard_False);
+               Append(Seg);
+             }
       }
     }
   }
index bdb6e9a..76052f0 100644 (file)
@@ -11,9 +11,9 @@ set ref_data {
 DATA        : Faulties = 0  ( 2 )  Warnings = 0  ( 0 )  Summary  = 0  ( 2 )
 TPSTAT      : Faulties = 3  ( 59 )  Warnings = 2203  ( 4654 )  Summary  = 2206  ( 4713 )
 CHECKSHAPE  : Wires    = 8  ( 17 )  Faces    = 6  ( 11 )  Shells   = 0  ( 0 )   Solids   = 0 ( 0 )
-NBSHAPES    : Solid    = 0  ( 0 )  Shell    = 0  ( 0 )  Face     = 3349  ( 2837 )   Summary  = 45820  ( 39081 )
-STATSHAPE   : Solid    = 0  ( 0 )  Shell    = 0  ( 0 )  Face     = 3349  ( 3349 )   FreeWire = 6  ( 6 )   FreeEdge  = 67 ( 67 )   SharedEdge = 19534  ( 16688 )
-TOLERANCE   : MaxTol   =    4.854604894  (    5.769095076 )  AvgTol   =   0.01657799259  (   0.01735277012 )
+NBSHAPES    : Solid    = 0  ( 0 )  Shell    = 0  ( 0 )  Face     = 3349  ( 2837 )   Summary  = 45817  ( 39081 )
+STATSHAPE   : Solid    = 0  ( 0 )  Shell    = 0  ( 0 )  Face     = 3349  ( 3349 )   FreeWire = 6  ( 6 )   FreeEdge  = 67 ( 67 )   SharedEdge = 19532  ( 16688 )
+TOLERANCE   : MaxTol   =    4.854604894  (    5.769095076 )  AvgTol   =   0.01656957183  (   0.01735277012 )
 LABELS      : N0Labels = 11  ( 11 )  N1Labels = 2891  ( 6257 )  N2Labels = 0  ( 0 )   TotalLabels = 2902  ( 6268 )   NameLabels = 2900  ( 5879 )   ColorLabels = 2891  ( 6257 )   LayerLabels = 2411  ( 5261 )
 PROPS       : Centroid = 0  ( 0 )  Volume   = 0  ( 0 )  Area     = 0  ( 0 )
 NCOLORS     : NColors  = 4  ( 4 )
index e62b60a..e8c2481 100644 (file)
@@ -1,5 +1,5 @@
 # !!!! This file is generated automatically, do not edit manually! See end script
-puts "TODO CR23096 ALL: CHECKSHAPE : Faulty" 
+puts "TODO CR23096 ALL: NBSHAPES : Faulty" 
 puts "TODO CR23096 ALL: LABELS : Faulty" 
 puts "TODO CR23096 ALL: COLORS : Faulty" 
 
@@ -8,12 +8,12 @@ set filename ims016.igs
 
 set ref_data {
 DATA        : Faulties = 0  ( 0 )  Warnings = 0  ( 0 )  Summary  = 0  ( 0 )
-TPSTAT      : Faulties = 0  ( 0 )  Warnings = 130  ( 402 )  Summary  = 130  ( 402 )
-CHECKSHAPE  : Wires    = 4  ( 0 )  Faces    = 2  ( 0 )  Shells   = 0  ( 0 )   Solids   = 0 ( 0 )
-NBSHAPES    : Solid    = 0  ( 0 )  Shell    = 0  ( 0 )  Face     = 138  ( 138 )   Summary  = 10599  ( 10569 )
-STATSHAPE   : Solid    = 0  ( 0 )  Shell    = 0  ( 0 )  Face     = 138  ( 138 )   FreeWire = 6  ( 6 )   FreeEdge  = 353 ( 353 )   SharedEdge = 4953  ( 4953 )
-TOLERANCE   : MaxTol   =   0.2092687841  (   0.2092687804 )  AvgTol   =  0.0008878122295  (  0.0009749254626 )
-LABELS      : N0Labels = 503  ( 503 )  N1Labels = 0  ( 200 )  N2Labels = 0  ( 0 )   TotalLabels = 503  ( 703 )   NameLabels = 503  ( 503 )   ColorLabels = 470  ( 703 )   LayerLabels = 313  ( 344 )
+TPSTAT      : Faulties = 0  ( 0 )  Warnings = 120  ( 402 )  Summary  = 120  ( 402 )
+CHECKSHAPE  : Wires    = 0  ( 0 )  Faces    = 0  ( 0 )  Shells   = 0  ( 0 )   Solids   = 0 ( 0 )
+NBSHAPES    : Solid    = 0  ( 0 )  Shell    = 0  ( 0 )  Face     = 138  ( 138 )   Summary  = 10561  ( 10563 )
+STATSHAPE   : Solid    = 0  ( 0 )  Shell    = 0  ( 0 )  Face     = 138  ( 138 )   FreeWire = 6  ( 6 )   FreeEdge  = 353 ( 353 )   SharedEdge = 4947  ( 4949 )
+TOLERANCE   : MaxTol   =  0.07559058774  (  0.07559058772 )  AvgTol   =  0.0006486207316  (  0.0006485487307 )
+LABELS      : N0Labels = 503  ( 503 )  N1Labels = 0  ( 196 )  N2Labels = 0  ( 0 )   TotalLabels = 503  ( 699 )   NameLabels = 503  ( 503 )   ColorLabels = 470  ( 699 )   LayerLabels = 313  ( 344 )
 PROPS       : Centroid = 0  ( 0 )  Volume   = 0  ( 0 )  Area     = 0  ( 0 )
 NCOLORS     : NColors  = 6  ( 7 )
 COLORS      : Colors   = CYAN1 GREEN MAGENTA1 RED WHITE YELLOW  ( BLACK CYAN1 GREEN MAGENTA1 RED WHITE YELLOW )