0024510: Remove unused local variables
[occt.git] / src / IntPatch / IntPatch_RstInt.cxx
old mode 100755 (executable)
new mode 100644 (file)
index a90b6af..8a5ca2c
@@ -1,7 +1,18 @@
-// File:      IntPatch_RstInt.cxx
-// Created:   Fri May  7 12:45:18 1993
-// Author:    Jacques GOUSSARD
-// Copyright: Matra Datavision 1993
+// Created on: 1993-05-07
+// Created by: Jacques GOUSSARD
+// Copyright (c) 1993-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and / or modify it
+// under the terms of the GNU Lesser General Public version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
 
 // ----------------------------------------------------------------------
 //-- lbr: Modifs importantes du 16-17 Nov 95
@@ -26,7 +37,6 @@
 #include <Precision.hxx>
 
 #include <Adaptor2d_HCurve2d.hxx>
-#include <IntPatch_PolygoTool.hxx>
 #include <IntPatch_WLine.hxx>
 #include <IntPatch_RLine.hxx>
 #include <IntPatch_HInterTool.hxx>
@@ -36,6 +46,7 @@
 #include <IntPatch_CSFunction.hxx>
 #include <IntPatch_CurvIntSurf.hxx>
 
+#define myInfinite 1.e15 // the same as was in Adaptor3d_TopolTool
 
 static void Recadre(GeomAbs_SurfaceType typeS1,
                     GeomAbs_SurfaceType typeS2,
@@ -442,10 +453,10 @@ void IntPatch_RstInt::PutVertexOnLine (Handle(IntPatch_Line)& L,
 // Si OnFirst = True, c est que la surface Surf correspond a la 1ere
 // surface donnee aux algo d intersection.
 
-  static   IntPatch_SearchPnt Commun;
+  IntPatch_SearchPnt Commun;
 
   Standard_Real U,V,W;
-  Standard_Real U1,V1,U2,V2;
+  Standard_Real U1,V1,U2 = 0.,V2 = 0.;
   Standard_Real paramarc=0.,paramline=0.;
   Standard_Integer i,j,k;
   TColgp_SequenceOfPnt locpt;
@@ -543,11 +554,15 @@ void IntPatch_RstInt::PutVertexOnLine (Handle(IntPatch_Line)& L,
     Standard_Real VRes = Surf->VResolution(edgeTol);
 
     IntPatch_HInterTool::Bounds(arc,PFirst,PLast);
-    if (Precision::IsNegativeInfinite(PFirst) || 
-       Precision::IsPositiveInfinite(PLast)) { 
-      //-- cout<<" IntPatch_RstInt::PutVertexOnLine  ---> Restrictions Infinies :"<<endl;
-      return; 
-    }
+    if(Precision::IsNegativeInfinite(PFirst))
+      PFirst = -myInfinite;
+    if(Precision::IsPositiveInfinite(PLast))
+      PLast = myInfinite;
+    //if (Precision::IsNegativeInfinite(PFirst) || 
+          // Precision::IsPositiveInfinite(PLast)) { 
+    //  //-- cout<<" IntPatch_RstInt::PutVertexOnLine  ---> Restrictions Infinies :"<<endl;
+    //  return;
+    //}
 
     Standard_Boolean isVFirst = Standard_False, isVLast = Standard_False;
     gp_Pnt2d p2dFirst,p2dLast;
@@ -572,7 +587,7 @@ void IntPatch_RstInt::PutVertexOnLine (Handle(IntPatch_Line)& L,
       }
     }
 
-    Bnd_Box2d BPLin = IntPatch_PolygoTool::Bounding(PLin);
+    Bnd_Box2d BPLin = PLin.Bounding();
 
     if(SurfaceIsPeriodic) { 
       Standard_Real xmin,ymin,xmax,ymax,g;
@@ -642,8 +657,8 @@ void IntPatch_RstInt::PutVertexOnLine (Handle(IntPatch_Line)& L,
        static int debug_polygon2d =0;
        if(debug_polygon2d) { 
          cout<<" ***** Numero Restriction : "<<NumeroEdge<<" *****"<<endl;
-         IntPatch_PolygoTool::Dump(PLin);
-         IntPatch_PolygoTool::Dump(Brise);
+         PLin.Dump();
+         Brise.Dump();
        }
        
        Commun.Perform(PLin,Brise);
@@ -680,17 +695,19 @@ void IntPatch_RstInt::PutVertexOnLine (Handle(IntPatch_Line)& L,
              tolU = Max(tolULast,tolU); tolV = Max(tolVLast,tolV);
            }
            Standard_Real nptCh = UMaxCh-UMinCh;
-           Standard_Boolean isNptLow = nptCh < 10. && nptCh < Nbptlin/100. ||
-             !Domain->Has3d() && Standard_Integer(nptCh)+1 < Nbptlin;
+           Standard_Boolean isNptLow = (nptCh < 10. && nptCh < Nbptlin/100.) ||
+             (!Domain->Has3d() && Standard_Integer(nptCh)+1 < Nbptlin);
            if (!isNptLow && !IsSegment2dSmall(Brise,UMinAr,UMaxAr,tolU,tolV)) {
              // treat both ends
-             Standard_Real UMinChP,UMaxChP,UMinArP,UMaxArP;
-             UMinChP = IntegerPart(UMinCh); UMinArP = IntegerPart(UMinAr);
-             UMaxChP = IntegerPart(UMaxCh); UMaxArP = IntegerPart(UMaxAr);
-             Standard_Integer irangCh1,irangCh2,irangAr1,irangAr2;
-             irangCh1 = Standard_Integer(UMinChP)+1; irangCh2 = Standard_Integer(UMaxChP)+1;
-             irangAr1 = Standard_Integer(UMinArP)+1; irangAr2 = Standard_Integer(UMaxArP)+1;
-             UMinChP = UMinCh - UMinChP; UMinArP = UMinAr - UMinArP;
+             Standard_Real UMinChP,UMinArP,UMaxArP;
+             UMinChP = IntegerPart(UMinCh);
+              UMinArP = IntegerPart(UMinAr);
+              UMaxArP = IntegerPart(UMaxAr);
+             Standard_Integer irangAr1,irangAr2;
+             irangAr1 = Standard_Integer(UMinArP)+1;
+              irangAr2 = Standard_Integer(UMaxArP)+1;
+             UMinChP = UMinCh - UMinChP;
+              UMinArP = UMinAr - UMinArP;
              //UMaxChP = UMaxCh - UMaxChP; UMaxArP = UMaxAr - UMaxArP;
              const Standard_Real eps = 1e-10;
 //           Standard_Boolean isChExtr1 = irangCh1==1 && UMinChP<eps;
@@ -782,8 +799,8 @@ void IntPatch_RstInt::PutVertexOnLine (Handle(IntPatch_Line)& L,
                if (ptsommet.Distance(locpt(j)) <= edgeTol) {
                  if (possiblyClosed) {
                    locpt2(j).Coord(U,V);
-                   if (OSurfaceIsUClosed && Abs(U-U2) > tolOUClosed ||
-                       OSurfaceIsVClosed && Abs(V-V2) > tolOVClosed)
+                   if ((OSurfaceIsUClosed && Abs(U-U2) > tolOUClosed) ||
+                       (OSurfaceIsVClosed && Abs(V-V2) > tolOVClosed))
                      continue;
                  }
                  duplicate = Standard_True;
@@ -792,16 +809,16 @@ void IntPatch_RstInt::PutVertexOnLine (Handle(IntPatch_Line)& L,
              }
 
              if (!duplicate) {
-               Standard_Integer ParamApproxOnLine = Standard_Integer(W1[ip])+1;
-
-               arc->D1(paramarc,p2d,d2d);
-               U1 = p2d.X(); V1 = p2d.Y();
-               if (typL == IntPatch_Walking && SurfaceIsPeriodic)
-                 if (OnFirst)
-                   Recadre(TypeS1,TypeS2,wlin,ParamApproxOnLine,U1,V1,U2,V2);
-                 else
-                   Recadre(TypeS1,TypeS2,wlin,ParamApproxOnLine,U2,V2,U1,V1);
-
+                Standard_Integer ParamApproxOnLine = Standard_Integer(W1[ip])+1;
+
+                arc->D1(paramarc,p2d,d2d);
+                U1 = p2d.X(); V1 = p2d.Y();
+                if (typL == IntPatch_Walking && SurfaceIsPeriodic) {
+                  if (OnFirst)
+                    Recadre(TypeS1,TypeS2,wlin,ParamApproxOnLine,U1,V1,U2,V2);
+                  else
+                    Recadre(TypeS1,TypeS2,wlin,ParamApproxOnLine,U2,V2,U1,V1);
+                }
                locpt.Append(ptsommet);
                locpt2.Append(gp_Pnt2d(U2,V2));
 
@@ -812,14 +829,14 @@ void IntPatch_RstInt::PutVertexOnLine (Handle(IntPatch_Line)& L,
                  // check in 2d
                  if (SurfaceIsUClosed || SurfaceIsVClosed) {
                    GetLinePoint2d (L, paramline, OnFirst, U,V);
-                   if (SurfaceIsUClosed && Abs(U-U1) > tolUClosed ||
-                       SurfaceIsVClosed && Abs(V-V1) > tolVClosed)
+                   if ((SurfaceIsUClosed && Abs(U-U1) > tolUClosed) ||
+                       (SurfaceIsVClosed && Abs(V-V1) > tolVClosed))
                      found = Standard_False;
                  }
                  if (found && (OSurfaceIsUClosed || OSurfaceIsVClosed)) {
                    GetLinePoint2d (L, paramline, !OnFirst, U,V);
-                   if (OSurfaceIsUClosed && Abs(U-U2) > tolOUClosed ||
-                       OSurfaceIsVClosed && Abs(V-V2) > tolOVClosed)
+                   if ((OSurfaceIsUClosed && Abs(U-U2) > tolOUClosed) ||
+                       (OSurfaceIsVClosed && Abs(V-V2) > tolOVClosed))
                      found = Standard_False;
                  }
                }
@@ -846,22 +863,22 @@ void IntPatch_RstInt::PutVertexOnLine (Handle(IntPatch_Line)& L,
                                             ? wlin->Vertex(j)
                                             : rlin->Vertex(j));
                  Standard_Boolean APointOnRstStillExist =
-                   (OnFirst  && Rptline.IsOnDomS1() && Rptline.ArcOnS1() == arc ||
-                    !OnFirst && Rptline.IsOnDomS2() && Rptline.ArcOnS2() == arc);
+                   ((OnFirst  && Rptline.IsOnDomS1() && Rptline.ArcOnS1() == arc) ||
+                    (!OnFirst && Rptline.IsOnDomS2() && Rptline.ArcOnS2() == arc));
                  if(!APointOnRstStillExist) {
                    if (possiblyClosed) {
                      if (SurfaceIsUClosed || SurfaceIsVClosed) {
                        if (OnFirst) Rptline.ParametersOnS1(U,V);
                        else         Rptline.ParametersOnS2(U,V);
-                       if (SurfaceIsUClosed && Abs(U-U1) > tolUClosed ||
-                           SurfaceIsVClosed && Abs(V-V1) > tolVClosed)
+                       if ((SurfaceIsUClosed && Abs(U-U1) > tolUClosed) ||
+                           (SurfaceIsVClosed && Abs(V-V1) > tolVClosed))
                          continue;
                      }
                      if (OSurfaceIsUClosed || OSurfaceIsVClosed) {
                        if (OnFirst) Rptline.ParametersOnS2(U,V);
                        else         Rptline.ParametersOnS1(U,V);
-                       if (OSurfaceIsUClosed && Abs(U-U2) > tolOUClosed ||
-                           OSurfaceIsVClosed && Abs(V-V2) > tolOVClosed)
+                       if ((OSurfaceIsUClosed && Abs(U-U2) > tolOUClosed) ||
+                           (OSurfaceIsVClosed && Abs(V-V2) > tolOVClosed))
                          continue;
                      }
                    }
@@ -968,8 +985,8 @@ void IntPatch_RstInt::PutVertexOnLine (Handle(IntPatch_Line)& L,
                  //   on doit avoir VtxOnArc = True. On duplique le point sur S1
                  //   en changeant ArcOnS2.
                  Standard_Boolean OnDifferentRst =
-                   (OnFirst  && ptline.IsOnDomS1() && ptline.ArcOnS1() != arc ||
-                    !OnFirst && ptline.IsOnDomS2() && ptline.ArcOnS2() != arc);
+                   ((OnFirst  && ptline.IsOnDomS1() && ptline.ArcOnS1() != arc) ||
+                    (!OnFirst && ptline.IsOnDomS2() && ptline.ArcOnS2() != arc));
                  ptline.SetTolerance(vtxTol);
                  if (   (!ptline.IsVertexOnS1() &&  OnFirst) 
                      || (!ptline.IsVertexOnS2() && !OnFirst)