0024510: Remove unused local variables
[occt.git] / src / IntTools / IntTools_EdgeEdge.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 57c65e8..efb517c
@@ -1,21 +1,17 @@
 // Created on: 2000-10-26
 // Created by: Peter KURNEV
-// Copyright (c) 2000-2012 OPEN CASCADE SAS
+// Copyright (c) 2000-2014 OPEN CASCADE SAS
 //
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
+// This file is part of Open CASCADE Technology software library.
 //
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+// 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.
 //
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
 
 #include <IntTools_EdgeEdge.ixx>
 
@@ -54,6 +50,7 @@
 #include <IntTools_Tools.hxx>
 #include <IntTools_BeanBeanIntersector.hxx>
 
+
 //=======================================================================
 //function : IntTools_EdgeEdge::IntTools_EdgeEdge
 //purpose  : 
@@ -584,7 +581,7 @@ IntTools_EdgeEdge::IntTools_EdgeEdge()
   Standard_Integer step = 1, stepcheck = 1000, steplimit = 100000;
   Standard_Real value = (IP==1) ? DistanceFunction(0.5*(a+b)) : DerivativeFunction(0.5*(a+b));
   
-  while (1) {
+  for(;;) {
     x0=.5*(a+b);
 
     if (IP==1)
@@ -634,10 +631,18 @@ IntTools_EdgeEdge::IntTools_EdgeEdge()
 //function : FindRangeOnCurve2
 //purpose  : 
 //=======================================================================
-  Standard_Integer IntTools_EdgeEdge::FindRangeOnCurve2(IntTools_CommonPrt&  aCommonPrt)
+Standard_Integer IntTools_EdgeEdge::FindRangeOnCurve2(IntTools_CommonPrt&  aCommonPrt)
 {
-  Standard_Real ttmp, f, l, af1, al1, am1, af2, al2, am2;
   Standard_Integer pri;
+  //
+  pri=0;
+  if (aCommonPrt.AllNullFlag()) {
+    aCommonPrt.SetType(TopAbs_EDGE);
+    aCommonPrt.AppendRange2 (myTminTo, myTmaxTo);
+    return pri;
+  }
+  //
+  Standard_Real ttmp, f, l, af1, al1, am1, af2, al2, am2;
   gp_Pnt aPf1, aPl1, aPm1, aPf2, aPl2, aPm2;
   GeomAPI_ProjectPointOnCurve aProjector;
 
@@ -694,7 +699,7 @@ IntTools_EdgeEdge::IntTools_EdgeEdge()
   //
   //
   Standard_Boolean aVFlag1, aVFlag2, aGeomFlag1, aGeomFlag2;
-  Standard_Real Df2m2, Dm2l2, Df2l2, df2m2, dm2l2, df2l2, df1m1, dm1l1, df1l1;
+  Standard_Real Df2m2, Dm2l2, Df2l2, df2m2, dm2l2, df2l2, df1l1;
   Standard_Real tV1, tV2;
   //
   // parametric differences for C2
@@ -730,8 +735,6 @@ IntTools_EdgeEdge::IntTools_EdgeEdge()
   }
   //
   // geometric distances for C1
-  df1m1=aPf1.Distance(aPm1);
-  dm1l1=aPm1.Distance(aPl1);
   df1l1=aPf1.Distance(aPl1);
   //
   // if geometric distances between boundaries is less than myCriteria
@@ -857,7 +860,7 @@ IntTools_EdgeEdge::IntTools_EdgeEdge()
   void IntTools_EdgeEdge::IsIntersection (const Standard_Real ta, 
                                          const Standard_Real tb) 
 {
-  Standard_Integer i, aNb, pri;
+  Standard_Integer i, aNb;
   Standard_Real t, f;
   GeomAbs_CurveType aCT1, aCT2;
   IntTools_CArray1OfReal anArgs, aFunc;
@@ -913,7 +916,7 @@ IntTools_EdgeEdge::IntTools_EdgeEdge()
   }
   //
   // Prepare values of arguments for the interval [ta, tb]
-  pri=IntTools::PrepareArgs (myCFrom, tb, ta, myDiscret, myDeflection, anArgs);
+  IntTools::PrepareArgs (myCFrom, tb, ta, myDiscret, myDeflection, anArgs);
   aNb=anArgs.Length();
 
   aFunc.Resize(aNb);
@@ -937,7 +940,7 @@ IntTools_EdgeEdge::IntTools_EdgeEdge()
                                             const IntTools_CArray1OfReal& f)  
 {
   Standard_Integer i, n, k;
-  Standard_Real fr, tr, anEpsNull;
+  Standard_Real tr, anEpsNull;
   IntTools_CArray1OfReal fd;
   TColStd_SequenceOfReal aTSeq, aFSeq;
   
@@ -984,7 +987,6 @@ IntTools_EdgeEdge::IntTools_EdgeEdge()
     //aa
     if (fd1*fd2 < 0.) {
       tr=FindSimpleRoot(2, t1, t2, fd1);
-      fr=DistanceFunction(tr);
       myPar1=tr;
       myParallel=Standard_False;
       break;
@@ -992,7 +994,6 @@ IntTools_EdgeEdge::IntTools_EdgeEdge()
     
     if (!bF1 && bF2) {
       tr=t2;
-      fr=fd2;
       myPar1=tr;
       myParallel=Standard_False;
       break;
@@ -1000,7 +1001,6 @@ IntTools_EdgeEdge::IntTools_EdgeEdge()
     
     if (bF1 && !bF2) {
       tr=t1;
-      fr=fd1;
       myPar1=tr;
       myParallel=Standard_False;
       break;
@@ -1243,7 +1243,7 @@ IntTools_EdgeEdge::IntTools_EdgeEdge()
   Standard_Real aTFR1, aTLR1, aTFR2, aTLR2;
   Standard_Real aTL1, aTL2, aTC1, aTC2;
   Standard_Real aRC, aDLC, aD2, aC2, aTLx, aTCx;
-  GeomAbs_CurveType aTFrom, aTTo;
+  GeomAbs_CurveType aTFrom;
   gp_Circ aCirc;
   gp_Lin  aLine;
   gp_Pnt aPC, aPLx, aPCx;
@@ -1253,7 +1253,6 @@ IntTools_EdgeEdge::IntTools_EdgeEdge()
   (aCP.Ranges2())(1).Range(aTFR2, aTLR2);
   //
   aTFrom=myCFrom.GetType();
-  aTTo  =myCTo.GetType();
   //
   aTL1=aTFR1;
   aTL2=aTLR1;
@@ -1429,13 +1428,12 @@ IntTools_EdgeEdge::IntTools_EdgeEdge()
      (myCFrom.GetType() == GeomAbs_Circle && myCTo.GetType() == GeomAbs_Line))
   {
     Standard_Real aRadius;
-    GeomAbs_CurveType aTFrom, aTTo;
+    GeomAbs_CurveType aTFrom;
     gp_Circ aCirc;
     gp_Lin  aLine;
     gp_Pnt aPCenter, aPOnLine;
 
     aTFrom=myCFrom.GetType();
-    aTTo  =myCTo.GetType();
     
     if (aTFrom==GeomAbs_Circle) {
       aCirc=myCFrom.Circle();
@@ -1503,7 +1501,7 @@ IntTools_EdgeEdge::IntTools_EdgeEdge()
   //
   IsParallel = Standard_False;
   IsCoincide = Standard_False;
-  Tolang2 = 1.e-16;
+  Tolang2 = Precision::Angular();
   Tol2 = myCriteria*myCriteria; 
   //
   gp_Lin C1 = myCFrom.Line();
@@ -1512,6 +1510,7 @@ IntTools_EdgeEdge::IntTools_EdgeEdge()
   const gp_Dir& D2 = C2.Position().Direction();
   Standard_Real aCos = D1.Dot(D2);
   Standard_Real Ang2;
+
   if(aCos >= 0. ) {
     Ang2 = 2.*(1. - aCos);
   }
@@ -1632,313 +1631,3 @@ IntTools_EdgeEdge::IntTools_EdgeEdge()
   mySeqOfCommonPrts.Append(aCommonPrt);
   
 }
-//modified by NIZNHY-PKV Mon Dec 26 13:44:53 2011f
-static
-  Standard_Boolean IsSameReal(const Standard_Real aR1, 
-                             const Standard_Real aR2);
-static 
-  Standard_Boolean IsSameXYZ(const gp_XYZ& aXYZ1, const gp_XYZ& aXYZ2);
-static
-  Standard_Boolean IsSameDir(const gp_Dir& aDir1, const gp_Dir& aDir2);
-static
-  Standard_Boolean IsSamePnt(const gp_Pnt& aP1, const gp_Pnt& aP2);
-static
-  Standard_Boolean IsSameAx1(const gp_Ax1& aAx1, const gp_Ax1& aAx2);
-static
-  Standard_Boolean IsSameAx2(const gp_Ax2& aAx21, const gp_Ax2& aAx22);
-static
-  Standard_Boolean IsSameElips(const gp_Elips& aElips1, 
-                              const gp_Elips& aElips2);
-static
-  Standard_Boolean IsSameBSplineCurve(const BRepAdaptor_Curve& myCFrom,
-                                     const BRepAdaptor_Curve& myCTo);
-
-//=======================================================================
-//function : IsSameCurves
-//purpose  : 
-//=======================================================================
-Standard_Boolean IntTools_EdgeEdge::IsSameCurves()
-{
-  Standard_Boolean bRet;
-  GeomAbs_CurveType aCTFrom, aCTTo;
-  //
-  aCTFrom=myCFrom.GetType();
-  aCTTo  =myCTo.GetType();
-  //
-  bRet=(aCTFrom==aCTTo);
-  if (!bRet) {
-    return bRet;
-  }
-  // 
-  bRet=IsSameReal(myTminFrom, myTminTo);
-  if (!bRet) {
-    return bRet;
-  }
-  //
-  bRet=IsSameReal(myTmaxFrom, myTmaxTo);
-  if (!bRet) {
-    return bRet;
-  }
-  //
-  bRet=!bRet; // false
-  //
-  if (aCTTo==GeomAbs_Ellipse) {
-    gp_Elips aC1, aC2;
-    //
-    aC1=myCFrom.Ellipse();
-    aC2=myCTo.Ellipse();
-    //
-    bRet=IsSameElips(aC1, aC2);
-    //
-    return bRet;
-  } //if (aCTTo==GeomAbs_Ellipse) {
-  //
-  else if (aCTTo==GeomAbs_BSplineCurve) {
-    bRet=IsSameBSplineCurve(myCFrom, myCTo);
-    if(!bRet) {
-      return bRet;
-    }
-  }// if (aCTTo==GeomAbs_BSplineCurve) {
-  return bRet;
-}
-//=======================================================================
-//function : IsSameBSplineCurve
-//purpose  : 
-//=======================================================================
-Standard_Boolean IsSameBSplineCurve(const BRepAdaptor_Curve& myCFrom,
-                                   const BRepAdaptor_Curve& myCTo)
-{
-  Standard_Boolean bRet, bIsRational, bIsPreiodic;
-  Standard_Integer iNbPoles, iNbKnots, iDegree;
-  //
-  bIsRational=myCFrom.IsRational();
-  bRet=(bIsRational==myCTo.IsRational());
-  if (!bRet) {
-    return bRet;
-  }
-  //
-  iNbPoles=myCFrom.NbPoles();
-  bRet=(iNbPoles==myCTo.NbPoles());
-  if (!bRet) {
-    return bRet;
-  }
-  //
-  iNbKnots=myCFrom.NbKnots();
-  bRet=(iNbKnots==myCTo.NbKnots());
-  if (!bRet) {
-    return bRet;
-  }
-  //
-  iDegree=myCFrom.Degree();
-  bRet=(iDegree==myCTo.Degree());
-  if (!bRet) {
-    return bRet;
-  } 
-  //
-  bIsPreiodic=myCFrom.IsPeriodic();
-  bRet=(bIsPreiodic==myCTo.IsPeriodic());
-  if (!bRet) {
-    return bRet;
-  }
-  //-------------------------------------------
-  Standard_Integer i, j, aM[2];
-  Standard_Real aT1[2], aT2[2], aX0[4], aX1[4];
-  gp_Pnt aP;
-  Handle(Geom_Curve) aC;
-  Handle(Geom_BSplineCurve) aBSp[2];
-  TopoDS_Edge aE[2];
-  //
-  aE[0]=myCFrom.Edge();
-  aE[1]=myCTo.Edge();
-  //
-  aC=BRep_Tool::Curve (aE[0], aT1[0], aT2[0]);
-  aBSp[0]=Handle(Geom_BSplineCurve)::DownCast(aC);
-  //
-  aC=BRep_Tool::Curve (aE[1], aT1[1], aT2[1]);
-  aBSp[1]=Handle(Geom_BSplineCurve)::DownCast(aC);
-  //
-  bRet=IsSameReal(aT1[0], aT1[1]);
-  if (!bRet) {
-    return bRet;
-  }
-  //
-  bRet=IsSameReal(aT2[0], aT2[1]);
-  if (!bRet) {
-    return bRet;
-  }
-  //
-  // Poles / Weights
-  for(i=1; i<=iNbPoles; ++i) {
-    aP=aBSp[0]->Pole(i);
-    aP.Coord(aX0[0], aX0[1], aX0[2]);
-    aX0[3]=aBSp[0]->Weight(i);
-    //
-    aP=aBSp[1]->Pole(i);
-    aP.Coord(aX1[0], aX1[1], aX1[2]);
-    aX1[3]=aBSp[1]->Weight(i);
-    //
-    for (j=0; j<4; ++j) {
-      bRet=IsSameReal(aX0[j], aX1[j]);
-      if(!bRet) {
-       return bRet;
-      }
-    }
-  }//for(i=1; i<iNbPoles; ++i) {
-  //
-  // Knots / Multiplicities
-  for(i=1; i<=iNbKnots; ++i) {
-    aX0[0]=aBSp[0]->Knot(i);
-    aX0[1]=aBSp[1]->Knot(i);
-    bRet=IsSameReal(aX0[0], aX0[1]);
-    if(!bRet) {
-      return bRet;
-    }
-    //
-    aM[0]=aBSp[0]->Multiplicity(i);
-    aM[1]=aBSp[1]->Multiplicity(i);
-    bRet=(aM[0]==aM[1]);
-    if(!bRet) {
-      return bRet;
-    }
-  }// for(i=1; i<=iNbKnots; ++i) {
-  return bRet;
-}
-//=======================================================================
-//function : IsSameElips
-//purpose  : 
-//=======================================================================
-Standard_Boolean IsSameElips(const gp_Elips& aElips1, 
-                            const gp_Elips& aElips2)
-{
-  Standard_Boolean bRet;
-  Standard_Real aR1, aR2;
-  //
-  aR1=aElips1.MajorRadius();
-  aR2=aElips2.MajorRadius();
-  bRet=IsSameReal(aR1, aR2);
-  if (!bRet) {
-    return bRet;
-  }
-  //
-  aR1=aElips1.MinorRadius();
-  aR2=aElips2.MinorRadius();
-  bRet=IsSameReal(aR1, aR2);
-  if (!bRet) {
-    return bRet;
-  }
-  //
-  const gp_Ax2& aAx21=aElips1.Position();
-  const gp_Ax2& aAx22=aElips2.Position();
-  bRet=IsSameAx2(aAx21, aAx22);
-  return bRet;
-}
-//=======================================================================
-//function : IsSameAx2
-//purpose  : 
-//=======================================================================
-Standard_Boolean IsSameAx2(const gp_Ax2& aAx21, const gp_Ax2& aAx22)
-{
-  Standard_Boolean bRet;
-  //
-  const gp_Ax1& aAx1=aAx21.Axis();
-  const gp_Ax1& aAx2=aAx22.Axis();
-  //
-  bRet=IsSameAx1(aAx1, aAx2);
-  if (!bRet) {
-    return bRet;
-  }
-  //
-  const gp_Dir& aDirX1=aAx21.XDirection();
-  const gp_Dir& aDirX2=aAx22.XDirection();
-  //
-  bRet=IsSameDir(aDirX1, aDirX2);
-  if (!bRet) {
-    return bRet;
-  }
-  //
-  //
-  const gp_Dir& aDirY1=aAx21.YDirection();
-  const gp_Dir& aDirY2=aAx22.YDirection();
-  //
-  bRet=IsSameDir(aDirY1, aDirY2);
-  //
-  return bRet;
-}
-//=======================================================================
-//function : IsSameAx1
-//purpose  : 
-//=======================================================================
-Standard_Boolean IsSameAx1(const gp_Ax1& aAx1, const gp_Ax1& aAx2)
-{
-  Standard_Boolean bRet;
-  //
-  const gp_Pnt& aP1=aAx1.Location();
-  const gp_Pnt& aP2=aAx2.Location();
-  //
-  bRet=IsSamePnt(aP1, aP2);
-  if (!bRet) {
-    return bRet;
-  }
-  //
-  const gp_Dir& aDir1=aAx1.Direction();
-  const gp_Dir& aDir2=aAx2.Direction();
-  //
-  bRet=IsSameDir(aDir1, aDir2);
-  return bRet;
-}
-//=======================================================================
-//function : IsSamePnt
-//purpose  : 
-//=======================================================================
-Standard_Boolean IsSamePnt(const gp_Pnt& aP1, const gp_Pnt& aP2)
-{
-  const gp_XYZ& aXYZ1=aP1.XYZ();
-  const gp_XYZ& aXYZ2=aP2.XYZ();
-  return IsSameXYZ(aXYZ1, aXYZ2);
-}
-//=======================================================================
-//function : IsSameDir
-//purpose  : 
-//=======================================================================
-Standard_Boolean IsSameDir(const gp_Dir& aDir1, const gp_Dir& aDir2)
-{
-  const gp_XYZ& aXYZ1=aDir1.XYZ();
-  const gp_XYZ& aXYZ2=aDir2.XYZ();
-  return IsSameXYZ(aXYZ1, aXYZ2);
-}
-//=======================================================================
-//function : IsSameXYZ
-//purpose  : 
-//=======================================================================
-Standard_Boolean IsSameXYZ(const gp_XYZ& aXYZ1, const gp_XYZ& aXYZ2)
-{
-  Standard_Boolean bRet;
-  Standard_Integer i;
-  Standard_Real aX1[3], aX2[3];
-  
-  aXYZ1.Coord(aX1[0], aX1[1], aX1[2]);
-  aXYZ2.Coord(aX2[0], aX2[1], aX2[2]);
-  //
-  for (i=0; i<3; ++i) {
-    bRet=IsSameReal(aX1[i], aX2[i]);
-    if(!bRet) {
-      break;
-    }
-  }
-  return bRet;
-}
-//=======================================================================
-//function : IsSameReal
-//purpose  : 
-//=======================================================================
-Standard_Boolean IsSameReal(const Standard_Real aR1, 
-                           const Standard_Real aR2)
-{
-  Standard_Boolean bRet;
-  Standard_Real aEpsilon;
-  //
-  aEpsilon=Epsilon(aR1);
-  bRet=(fabs(aR1-aR2)<aEpsilon);
-  return bRet;
-}
-//modified by NIZNHY-PKV Mon Dec 26 13:44:55 2011t