]> OCCT Git - occt-copy.git/commitdiff
0027531: Modeling Algorithms - Make the algorithm Approx_SameParameter more clear...
authorifv <ifv@opencascade.com>
Fri, 31 May 2019 13:36:44 +0000 (16:36 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 6 Mar 2020 12:54:46 +0000 (15:54 +0300)
Approx/Approx_SameParameter.cxx,hxx:
Class Approx_SameParameter refactoring. Logic is changed in many places to unify usage, simplify maintenance.
Method Curve2d() is changed to return Geom2d_Curve instead of Geom2d_BSplineCurve. Corresponding message is added to the upgrade guide.
.lxx file is merged into .hxx.
Tangent computation is extracted into special method.
Comparing number of sample points after CheckSameParameter(...) is added to define cases with projection fails.
Undesirable behavior when curves are not same parameterized is fixed.

Geom2dAdaptor/Geom2dAdaptor.cxx: treatment of offset curve is added

Adaptor3d/Adaptor3d_TopolTool.cxx: minor improvement of performance for BSpline surfaces with huge number of knots

Tests were modified according to new behavior of sameparameter algorithm

63 files changed:
src/Adaptor3d/Adaptor3d_TopolTool.cxx
src/Approx/Approx_SameParameter.cxx
src/Approx/Approx_SameParameter.hxx
src/Approx/Approx_SameParameter.lxx [deleted file]
src/Approx/FILES
src/Geom2dAdaptor/Geom2dAdaptor.cxx
tests/blend/simple/X4
tests/bugs/iges/bug306
tests/bugs/modalg_1/buc60905
tests/bugs/modalg_2/bug22770_10
tests/bugs/modalg_2/bug22770_11
tests/bugs/modalg_2/bug22770_13
tests/bugs/modalg_2/bug22770_15
tests/bugs/modalg_2/bug22770_18
tests/bugs/modalg_2/bug22770_20
tests/bugs/modalg_2/bug22770_23
tests/bugs/modalg_2/bug22770_24
tests/bugs/modalg_2/bug22770_25
tests/bugs/modalg_2/bug22770_26
tests/bugs/modalg_2/bug22770_27
tests/bugs/modalg_2/bug22770_28
tests/bugs/modalg_2/bug22770_3
tests/bugs/modalg_2/bug22770_30
tests/bugs/modalg_2/bug22770_5
tests/bugs/modalg_2/bug22770_8
tests/bugs/modalg_2/bug22770_9
tests/bugs/modalg_2/bug22804
tests/bugs/modalg_4/bug714
tests/bugs/modalg_5/bug25175
tests/bugs/modalg_6/bug27015
tests/bugs/modalg_7/bug29663
tests/bugs/moddata_2/bug343
tests/bugs/moddata_2/bug42
tests/bugs/xde/bug6491
tests/de/step_1/ZH1
tests/heal/data/advanced/K2
tests/heal/data/advanced/V2
tests/heal/surface_to_revolution_advanced/end
tests/hlr/poly_hlr/Plate
tests/mkface/after_extsurf_and_offset/B3
tests/mkface/after_extsurf_and_offset/C6
tests/mkface/after_extsurf_and_offset/C7
tests/mkface/after_extsurf_and_offset/C8
tests/mkface/after_extsurf_and_offset/C9
tests/offset/with_intersect_80/L6
tests/offset/with_intersect_80/N7
tests/sewing/tol_0_01/F1
tests/sewing/tol_0_01/F8
tests/sewing/tol_1/S5
tests/sewing/tol_100/C5
tests/sewing/tol_100/D3
tests/sewing/tol_100/I6
tests/sewing/tol_100/I9
tests/sewing/tol_100/J1
tests/sewing/tol_100/J2
tests/sewing/tol_100/J3
tests/sewing/tol_100/J5
tests/sewing/tol_100/J6
tests/sewing/tol_100/K1
tests/sewing/tol_100/K3
tests/sewing/tol_100/T8
tests/sewing/tol_100/U1
tests/sewing/tol_100/Y7

index 81319ac31b4b47522e997c39b35fcc6999fea5ce..6ce96fd440222ca79682520e1354fcc9c415980a 100644 (file)
@@ -933,6 +933,7 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl,
                                         const Standard_Integer theNUmin,
                                         const Standard_Integer theNVmin)
 { 
+  const Standard_Integer aMaxPnts = 1001;
   const Handle(Geom_BSplineSurface)& aBS = myS->BSpline();
   Standard_Real uinf,usup,vinf,vsup;
   uinf = myS->FirstUParameter();  usup = myS->LastUParameter();
@@ -999,11 +1000,20 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl,
     nbsu = theNUmin;
     bUuniform = Standard_True;
   }
-
+  else if (nbsu > aMaxPnts)
+  {
+    nbsu = aMaxPnts;
+    bUuniform = Standard_True;
+  }
   if(nbsv < theNVmin) {
     nbsv = theNVmin;
     bVuniform = Standard_True;
   }
+  else if (nbsv > aMaxPnts)
+  {
+    nbsv = aMaxPnts;
+    bVuniform = Standard_True;
+  }
 
   TColStd_Array1OfReal anUPars(1, nbsu);
   TColStd_Array1OfBoolean anUFlg(1, nbsu);
index 54a8b569e2eea89b32ec506138dbe5573c3406d9..7258312053da118a52dcb1ceb2ea76e69b0e1850 100644 (file)
@@ -14,7 +14,6 @@
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-//  Modified by skv - Wed Jun  2 11:49:59 2004 OCC5898
 
 #include <Adaptor2d_HCurve2d.hxx>
 #include <Adaptor3d_CurveOnSurface.hxx>
 #include <BSplCLib.hxx>
 #include <Extrema_ExtPC.hxx>
 #include <Extrema_LocateExtPC.hxx>
-#include <GCPnts_QuasiUniformDeflection.hxx>
 #include <Geom2d_BSplineCurve.hxx>
 #include <Geom2d_Curve.hxx>
 #include <Geom2dAdaptor_Curve.hxx>
 #include <Geom2dAdaptor_HCurve.hxx>
 #include <Geom_Curve.hxx>
 #include <Geom_Surface.hxx>
-#include <GeomAdaptor_Curve.hxx>
 #include <GeomAdaptor_HCurve.hxx>
 #include <GeomAdaptor_HSurface.hxx>
-#include <GeomAdaptor_Surface.hxx>
 #include <GeomLib_MakeCurvefromApprox.hxx>
 #include <Precision.hxx>
 #include <Standard_ConstructionError.hxx>
 #include <Standard_OutOfRange.hxx>
 #include <TColStd_Array1OfReal.hxx>
+#include <Geom2dAdaptor.hxx>
 
 //=======================================================================
 //class    : Approx_SameParameter_Evaluator
@@ -125,7 +122,7 @@ static void ProjectPointOnCurve(const Standard_Real      InitValue,
                                 Standard_Boolean&        Status,
                                 Standard_Real&           Result)
 {
-  Standard_Integer num_iter = 0, not_done = 1, ii;
+  Standard_Integer num_iter = 0, not_done = 1;
 
   gp_Pnt a_point;
   gp_Vec vector, d1, d2;
@@ -136,8 +133,7 @@ static void ProjectPointOnCurve(const Standard_Real      InitValue,
   {
     num_iter++;
     Curve.D2(param, a_point, d1, d2);
-    for (ii = 1 ; ii <= 3 ; ii++) 
-      vector.SetCoord(ii, APoint.Coord(ii) - a_point.Coord(ii));
+    vector = gp_Vec(a_point,APoint);
 
     func = vector.Dot(d1);
     if ( Abs(func) < Tolerance * d1.Magnitude())
@@ -189,7 +185,7 @@ static Standard_Real ComputeTolReached(const Handle(Adaptor3d_HCurve)& c3d,
     d2 = Max(d2, Pc3d.SquareDistance(Pcons));
   }
 
-  const Standard_Real aMult = 1.5; // To be tolerant to discrete tolerance computing.
+  const Standard_Real aMult = 1. + 0.05; // 
   Standard_Real aDeviation = aMult * sqrt(d2);
   aDeviation = Max(aDeviation, Precision::Confusion()); // Tolerance in modeling space.
   return aDeviation;
@@ -199,11 +195,10 @@ static Standard_Real ComputeTolReached(const Handle(Adaptor3d_HCurve)& c3d,
 //function : Check
 //purpose  : Check current interpolation for validity.
 //=======================================================================
-static Standard_Boolean Check(const TColStd_Array1OfReal& FlatKnots, 
+static Standard_Boolean Check(const TColStd_Array1OfReal& FlatKnots,
                               const TColStd_Array1OfReal& Poles,
                               const Standard_Integer nbp,
-                              const TColStd_Array1OfReal& pc3d,
-                              const TColStd_Array1OfReal& ,
+                              const Standard_Real *pc3d,
                               const Handle(Adaptor3d_HCurve)& c3d,
                               const Adaptor3d_CurveOnSurface& cons,
                               Standard_Real& tol,
@@ -217,8 +212,8 @@ static Standard_Boolean Check(const TColStd_Array1OfReal& FlatKnots,
   // it fixes the bug OCC5898. To develop more or less sensible criterion it is
   // necessary to deeply investigate this problem which is not possible in frames
   // of debugging.
-  Standard_Real aParamFirst = 3.0 * pc3d(1)   - 2.0 * pc3d(nbp);
-  Standard_Real aParamLast = 3.0 * pc3d(nbp) - 2.0 * pc3d(1);
+  Standard_Real aParamFirst = 3.0 * pc3d[0]   - 2.0 * pc3d[nbp - 1];
+  Standard_Real aParamLast = 3.0 * pc3d[nbp - 1] - 2.0 * pc3d[0];
 
   Standard_Real FirstPar = cons.FirstParameter();
   Standard_Real LastPar  = cons.LastParameter();
@@ -227,27 +222,29 @@ static Standard_Boolean Check(const TColStd_Array1OfReal& FlatKnots,
   if (aParamLast > LastPar)
     aParamLast = LastPar;
 
-
   Standard_Real d2 = 0.0; // Maximum square deviation on the samples.
   const Standard_Real d = tol;
   const Standard_Integer nn = 2 * nbp;
-  const Standard_Real unsurnn = 1.0/nn;
+  const Standard_Real unsurnn = 1.0 / nn;
+  Standard_Real tprev = aParamFirst;
   for(Standard_Integer i = 0; i <= nn; i++)
   {
     // Compute corresponding parameter on 2d curve.
     // It should be inside of 3d curve parameter space.
     Standard_Real t = unsurnn*i;
-    Standard_Real tc3d = pc3d(1)*(1.-t) + pc3d(nbp)*t;
+    Standard_Real tc3d = pc3d[0]*(1.0 - t) + pc3d[nbp - 1] * t; // weight function.
     gp_Pnt Pc3d = c3d->Value(tc3d);
     Standard_Real tcons;
-    BSplCLib::Eval(tc3d,Standard_False,0,extrap_mode[0],
-                   aDegree,FlatKnots,1, (Standard_Real&)Poles(1),tcons);
-    if (tcons < aParamFirst ||
+    BSplCLib::Eval(tc3d, Standard_False, 0, extrap_mode[0],
+                   aDegree, FlatKnots, 1, (Standard_Real&)Poles(1), tcons);
+
+    if (tcons < tprev ||
         tcons > aParamLast)
     {
       tol = Precision::Infinite();
       return Standard_False;
     }
+    tprev = tcons;
     gp_Pnt Pcons = cons.Value(tcons);
     Standard_Real temp = Pc3d.SquareDistance(Pcons);
     if(temp > d2) d2 = temp;
@@ -275,7 +272,8 @@ Approx_SameParameter::Approx_SameParameter(const Handle(Geom_Curve)&   C3D,
                                            const Handle(Geom2d_Curve)& C2D,
                                            const Handle(Geom_Surface)& S,
                                            const Standard_Real         Tol)
-: mySameParameter(Standard_True),
+: myDeltaMin(Precision::PConfusion()),
+  mySameParameter(Standard_True),
   myDone(Standard_False)
 {
   myHCurve2d = new Geom2dAdaptor_HCurve(C2D);
@@ -292,7 +290,8 @@ Approx_SameParameter::Approx_SameParameter(const Handle(Adaptor3d_HCurve)&   C3D
                                            const Handle(Geom2d_Curve)&       C2D,
                                            const Handle(Adaptor3d_HSurface)& S,
                                            const Standard_Real               Tol)
-: mySameParameter(Standard_True),
+: myDeltaMin(Precision::PConfusion()),
+  mySameParameter(Standard_True),
   myDone(Standard_False)
 {
   myC3d = C3D;
@@ -309,7 +308,8 @@ Approx_SameParameter::Approx_SameParameter(const Handle(Adaptor3d_HCurve)&   C3D
                                            const Handle(Adaptor2d_HCurve2d)& C2D,
                                            const Handle(Adaptor3d_HSurface)& S,
                                            const Standard_Real               Tol)
-: mySameParameter(Standard_True),
+: myDeltaMin(Precision::PConfusion()),
+  mySameParameter(Standard_True),
   myDone(Standard_False)
 {
   myC3d = C3D;
@@ -324,560 +324,620 @@ Approx_SameParameter::Approx_SameParameter(const Handle(Adaptor3d_HCurve)&   C3D
 //=======================================================================
 void Approx_SameParameter::Build(const Standard_Real Tolerance)
 {
-  const Standard_Real anErrorMAX = 1.0e15;
-  const Standard_Integer aMaxArraySize = 1000;
-  const Standard_Integer NCONTROL = 22;
-
-  Standard_Integer ii ;
-  Adaptor3d_CurveOnSurface CurveOnSurface(myHCurve2d,mySurf);
-  Standard_Real fcons = CurveOnSurface.FirstParameter();
-  Standard_Real lcons = CurveOnSurface.LastParameter();
-  Standard_Real fc3d = myC3d->FirstParameter();
-  Standard_Real lc3d = myC3d->LastParameter();
-
-  //Control tangents at the extremities to know if the
-  //reparametring is possible and calculate the tangents 
-  //at the extremities of the function of change of variable.
+  // Algorithm:
+  // 1) Build initial distribution. Increase number of samples in case of C0 continuity.
+  // 2.1) Check same parameter state on samples.
+  // 2.2) Compute parameters in 2d space if not same parameter.
+  // 3) Loop over poles number and try to interpolate 2d curve.
+  // 4) If loop is failed build 2d curve forcibly or use original pcurve.
+  Standard_Real qpcons[myMaxArraySize], qnewpcons[myMaxArraySize],
+                 qpc3d[myMaxArraySize], qnewpc3d[myMaxArraySize];
+
+  // Create and fill data structure.
+  Approx_SameParameter_Data aData;
+  aData.myCOnS = Adaptor3d_CurveOnSurface(myHCurve2d,mySurf);
+  aData.myC2dPF = aData.myCOnS.FirstParameter();
+  aData.myC2dPL = aData.myCOnS.LastParameter();
+  aData.myC3dPF = myC3d->FirstParameter();
+  aData.myC3dPL = myC3d->LastParameter();
+  aData.myNbPnt = 0; // No points initially.
+  aData.myPC2d = qpcons;
+  aData.myPC3d = qpc3d;
+  aData.myNewPC2d = qnewpcons;
+  aData.myNewPC3d = qnewpc3d;
+  aData.myTol = Tolerance;
+
+  // Build initial distribution.
+  if (!BuildInitialDistribution(aData))
+  {
+    mySameParameter = Standard_False;
+    myDone = Standard_False;
+    return;
+  }
+
+  // Check same parameter state on distribution.
+  Standard_Real aMaxSqDeviation = 0.0;
+  const Standard_Real aPercentOfBadProj = 0.3;
+  Standard_Integer aNbPnt = aData.myNbPnt - RealToInt(aPercentOfBadProj * aData.myNbPnt);
+  mySameParameter = CheckSameParameter(aData, aMaxSqDeviation);
+  if(mySameParameter)
+  {
+    myTolReached = ComputeTolReached(myC3d, aData.myCOnS, 2 * myNbSamples);
+    myDone = Standard_True;
+    return;
+  }
+  else
+  {
+    // Control number of sample points after checking sameparameter
+    // If number of points is less then initial one, it means that there are 
+    // problems with projection
+    if(aData.myNbPnt < aNbPnt )
+    {
+      myTolReached = ComputeTolReached(myC3d,aData.myCOnS, 2 * myNbSamples);
+      myCurve2d = Geom2dAdaptor::MakeCurve(myHCurve2d->Curve2d());
+      myDone = Standard_False;
+      return;
+    }
+  }
+
+  // Control tangents at the extremities to know if the
+  // reparametring is possible and calculate the tangents
+  // at the extremities of the function of change of variable.
   Standard_Real tangent[2] = { 0.0, 0.0 };
-  gp_Pnt Pcons,Pc3d;
-  gp_Vec Vcons,Vc3d;
+  if(!ComputeTangents(aData.myCOnS, tangent[0], tangent[1]))
+  {
+    // Cannot compute tangents.
+    mySameParameter = Standard_False;
+    myDone = Standard_False;
+    myTolReached = ComputeTolReached(myC3d, aData.myCOnS, 2 * myNbSamples);
+    return;
+  }
 
-  const Standard_Real Tol = Tolerance;
-  const Standard_Real Tol2 = Tol * Tol;
-  Standard_Real deltamin = Precision::PConfusion();
+  // There is at least one point where same parameter is broken.
+  // Try to build B-spline approximation curve using interpolation with degree 3.
+  // The loop is organized over number of poles.
+  GeomAbs_Shape aContinuity = myHCurve2d->Continuity();
+  if(aContinuity > GeomAbs_C1) aContinuity = GeomAbs_C1;
 
-  Standard_Real besttol2 = Tol2;
+  Standard_Real besttol2 = aData.myTol * aData.myTol,
+                tolsov = Precision::Infinite();
+  Standard_Boolean interpolok = Standard_False,
+                   hasCountChanged = Standard_False;
+  do
+  {
+    // Interpolation data.
+    Standard_Integer num_knots = aData.myNbPnt + 7;
+    Standard_Integer num_poles = aData.myNbPnt + 3;
+    TColStd_Array1OfReal    Poles(1, num_poles);
+    TColStd_Array1OfReal    FlatKnots(1 ,num_knots);
 
-  // Check tangency on curve border.
-  Standard_Boolean extrok = 1;
-  CurveOnSurface.D1(fcons,Pcons,Vcons);
-  myC3d->D1(fc3d,Pc3d,Vc3d);
-  Standard_Real dist2 = Pcons.SquareDistance(Pc3d);
-  Standard_Real dmax2 = dist2;
+    if (!Interpolate(aData, tangent[0], tangent[1], Poles, FlatKnots))
+    {
+      // Interpolation fails.
+      mySameParameter = Standard_False;
+      myDone = Standard_False;
+      myTolReached = ComputeTolReached(myC3d, aData.myCOnS, 2 * myNbSamples);
+      return;
+    }
+
+    Standard_Real algtol = sqrt(besttol2);
+    interpolok = Check (FlatKnots, Poles, aData.myNbPnt+1, aData.myPC3d,
+                        myC3d, aData.myCOnS, algtol, tolsov);
+    tolsov = algtol;
 
-  Standard_Real magVcons = Vcons.Magnitude();
-  if (magVcons > 1.e-12)
-    tangent[0] = Vc3d.Magnitude() / magVcons;
-  else extrok = 0;
+    // Try to build 2d curve and check it for validity.
+    if(interpolok)
+    {
+      Standard_Real besttol = sqrt(besttol2);
 
-  CurveOnSurface.D1(lcons,Pcons,Vcons);
-  myC3d->D1(lc3d,Pc3d,Vc3d);
-  dist2 = Pcons.SquareDistance(Pc3d);
+      Handle(TColStd_HArray1OfReal) tol1d,tol2d,tol3d;
+      tol1d = new TColStd_HArray1OfReal(1,2);
+      tol1d->SetValue(1, mySurf->UResolution(besttol));
+      tol1d->SetValue(2, mySurf->VResolution(besttol));
 
-  dmax2 = Max(dmax2, dist2);
-  magVcons = Vcons.Magnitude();
-  if (magVcons > 1.e-12)
-    tangent[1] = Vc3d.Magnitude() / magVcons;
-  else extrok = 0;
-
-
-  //Take a multiple of the sample pof CheckShape,
-  //at least the control points will be correct. No comment!!!
-
-  Standard_Boolean interpolok = 0;
-  Standard_Real tolsov = 1.e200;
-  //Take parameters with  constant step on the curve on surface
-  //and on curve 3d.
-  Standard_Real deltacons = lcons - fcons;
-  deltacons /= (NCONTROL);
-  Standard_Real deltac3d = lc3d - fc3d;
-  deltac3d /= (NCONTROL);
-
-  Standard_Real wcons = fcons;
-  Standard_Real wc3d  = fc3d;
-
-  Standard_Real qpcons[aMaxArraySize], qnewpcons[aMaxArraySize], 
-                 qpc3d[aMaxArraySize], qnewpc3d[aMaxArraySize];
-  Standard_Real * pcons = qpcons; Standard_Real * newpcons = qnewpcons;
-  Standard_Real * pc3d = qpc3d; Standard_Real * newpc3d = qnewpc3d;
-
-  for ( ii = 0 ; ii < NCONTROL; ii++) {
-    pcons[ii] = wcons;
-    pc3d[ii]  = wc3d;
-    wcons += deltacons;
-    wc3d  += deltac3d;
-  }
-  pcons[NCONTROL] = lcons;
-  pc3d[NCONTROL]  = lc3d;
+      Approx_SameParameter_Evaluator ev (FlatKnots, Poles, myHCurve2d);
+      Standard_Integer aMaxDeg = 11, aMaxSeg = 1000;
+      AdvApprox_ApproxAFunction  anApproximator(2,0,0,tol1d,tol2d,tol3d,aData.myC3dPF,aData.myC3dPL,
+                                                aContinuity,aMaxDeg,aMaxSeg,ev);
 
-  // Change number of points in case of C0 continuity.
-  Standard_Integer New_NCONTROL = NCONTROL;
-  GeomAbs_Shape Continuity = myHCurve2d->Continuity();
-  if(Continuity > GeomAbs_C1) Continuity = GeomAbs_C1;
-  if(Continuity < GeomAbs_C1)
-  {
-    Standard_Integer NbInt = myHCurve2d->NbIntervals(GeomAbs_C1) + 1;
-    TColStd_Array1OfReal Param_de_decoupeC1 (1, NbInt);
-    myHCurve2d->Intervals(Param_de_decoupeC1, GeomAbs_C1);
-    TColStd_SequenceOfReal new_par;
-    Standard_Integer inter = 1;
-    ii =1;
-    new_par.Append(fcons);
-
-    while(inter <= NbInt && Param_de_decoupeC1(inter) <= fcons + deltamin) inter++;
-    while(NbInt > 0 && Param_de_decoupeC1(NbInt) >= lcons - deltamin) NbInt--;
-
-    while(inter <= NbInt || (ii < NCONTROL && inter <= Param_de_decoupeC1.Length()) ) {
-      if(Param_de_decoupeC1(inter) < pcons[ii]) {
-        new_par.Append(Param_de_decoupeC1(inter));
-        if((pcons[ii] - Param_de_decoupeC1(inter)) <= deltamin) {
-          ii++;
-          if(ii > NCONTROL) {ii = NCONTROL;}
+      if (anApproximator.IsDone() || anApproximator.HasResult())
+      {
+        Adaptor3d_CurveOnSurface ACS = aData.myCOnS;
+        GeomLib_MakeCurvefromApprox  aCurveBuilder(anApproximator);
+        Handle(Geom2d_BSplineCurve) aC2d = aCurveBuilder.Curve2dFromTwo1d(1,2);
+        Handle(Adaptor2d_HCurve2d) aHCurve2d = new Geom2dAdaptor_HCurve(aC2d);
+        aData.myCOnS.Load(aHCurve2d);
+        myTolReached = ComputeTolReached(myC3d,aData.myCOnS, 2 * myNbSamples);
+
+        const Standard_Real aMult = 250.0; // To be tolerant with discrete tolerance.
+        if (myTolReached < aMult * besttol ) 
+        {
+          myCurve2d = aC2d;
+          myHCurve2d = aHCurve2d;
+          myDone = Standard_True;
+          break;
         }
-        inter++;
-      }
-      else {
-        if((Param_de_decoupeC1(inter) - pcons[ii]) > deltamin) {
-          new_par.Append(pcons[ii]);
+        else if(aData.myNbPnt < myMaxArraySize - 1)
+        {
+          interpolok = Standard_False;
+          aData.myCOnS = ACS;
+        }
+        else
+        {
+          break;
         }
-        ii++;
       }
     }
 
-    new_par.Append(lcons);
-    New_NCONTROL = new_par.Length() - 1;
-    // Simple protection if New_NCONTROL > allocated elements in array but one
-    // aMaxArraySize - 1 index may be filled after projection.
-    if (New_NCONTROL > aMaxArraySize - 1) {
-      mySameParameter = Standard_False;
+    if (!interpolok)
+      hasCountChanged = IncreaseNbPoles(Poles, FlatKnots, aData, besttol2);
+
+  } while(!interpolok && hasCountChanged);
+
+  if (!myDone)
+  {
+    // Loop is finished unsuccessfully. Fix tolerance by maximal deviation,
+    // using data from the last loop iteration or initial data. Use data set with minimal deflection.
+
+    // Original 2d curve.
+    aData.myCOnS.Load(myHCurve2d);
+    myTolReached = ComputeTolReached(myC3d,aData.myCOnS, 2 * myNbSamples);
+    myCurve2d = Geom2dAdaptor::MakeCurve(myHCurve2d->Curve2d());
+
+    // Approximation curve.
+    Standard_Integer num_knots = aData.myNbPnt + 7;
+    Standard_Integer num_poles = aData.myNbPnt + 3;
+    TColStd_Array1OfReal    Poles(1, num_poles);
+    TColStd_Array1OfReal    FlatKnots(1 ,num_knots);
+
+    Interpolate(aData, tangent[0], tangent[1],
+                Poles, FlatKnots);
+
+    Standard_Real besttol = sqrt(besttol2);
+    Handle(TColStd_HArray1OfReal) tol1d,tol2d,tol3d;
+    tol1d = new TColStd_HArray1OfReal(1,2) ;
+    tol1d->SetValue(1, mySurf->UResolution(besttol));
+    tol1d->SetValue(2, mySurf->VResolution(besttol));
+
+    Approx_SameParameter_Evaluator ev(FlatKnots, Poles, myHCurve2d);
+    AdvApprox_ApproxAFunction  anApproximator(2,0,0,tol1d,tol2d,tol3d,aData.myC3dPF,aData.myC3dPL,
+                                              aContinuity,11,40,ev);
+
+    if (!anApproximator.IsDone() &&
+        !anApproximator.HasResult() )
+    {
+      myDone = Standard_False;
       return;
     }
-    for(ii = 1; ii <= New_NCONTROL; ii++){
-      pcons[ii] = pc3d[ii] = new_par.Value(ii + 1);
+
+    GeomLib_MakeCurvefromApprox  aCurveBuilder(anApproximator);
+    Handle(Geom2d_BSplineCurve) aC2d = aCurveBuilder.Curve2dFromTwo1d(1,2);
+    Handle(Adaptor2d_HCurve2d) aHCurve2d = new Geom2dAdaptor_HCurve(aC2d);
+    aData.myCOnS.Load(aHCurve2d);
+
+    Standard_Real anApproxTol = ComputeTolReached(myC3d,aData.myCOnS,2 * myNbSamples);
+    if (anApproxTol < myTolReached)
+    {
+      myTolReached = anApproxTol;
+      myCurve2d = aC2d;
+      myHCurve2d  = aHCurve2d;
     }
-    pc3d[New_NCONTROL]  = lc3d;
+    myDone = Standard_True;
   }
+}
 
-  // Check existing same parameter state.
-  Extrema_LocateExtPC Projector;
-  Projector.Initialize(myC3d->Curve(),fc3d,lc3d,Tol);
-
-  Standard_Integer count = 1;
-  Standard_Real previousp = fc3d, initp=0, curp;
-  Standard_Real bornesup = lc3d - deltamin;
-  Standard_Boolean projok = 0, 
-    use_parameter ;
-  for (ii = 1; ii < New_NCONTROL; ii++){    
-    CurveOnSurface.D0(pcons[ii],Pcons);
-    myC3d->D0(pc3d[ii],Pc3d);
-    dist2 = Pcons.SquareDistance(Pc3d);
-    use_parameter = (dist2 <= Tol2  && (pc3d[ii] > pc3d[count-1] + deltamin)) ;
-    Standard_Real aDistMin = RealLast();
-    if(use_parameter) {
+//=======================================================================
+//function : BuildInitialDistribution
+//purpose  : Sub-method in Build.
+//=======================================================================
+Standard_Boolean Approx_SameParameter::BuildInitialDistribution(Approx_SameParameter_Data &theData) const
+{
+  // Take a multiple of the sample pof CheckShape,
+  // at least the control points will be correct.
+  // Take parameters with constant step on the curve on surface
+  // and on curve 3d.
+  const Standard_Real deltacons = (theData.myC2dPL - theData.myC2dPF) / myNbSamples;
+  const Standard_Real deltac3d  = (theData.myC3dPL - theData.myC3dPF) / myNbSamples;
+  Standard_Real wcons = theData.myC2dPF;
+  Standard_Real wc3d  = theData.myC3dPF;
+  for (Standard_Integer ii = 0 ; ii < myNbSamples; ii++)
+  {
+    theData.myPC2d[ii] = wcons;
+    theData.myPC3d[ii]  = wc3d;
+    wcons += deltacons;
+    wc3d  += deltac3d;
+  }
+  theData.myNbPnt = myNbSamples;
+  theData.myPC2d[theData.myNbPnt] = theData.myC2dPL;
+  theData.myPC3d[theData.myNbPnt]  = theData.myC3dPL;
 
-      if(dist2 > dmax2) dmax2 = dist2;
-      initp = previousp = pc3d[count] = pc3d[ii];
-      pcons[count] = pcons[ii];
-      count++;
-      
+  // Change number of points in case of C0 continuity.
+  GeomAbs_Shape Continuity = myHCurve2d->Continuity();
+  if(Continuity < GeomAbs_C1)
+  {
+    if (!IncreaseInitialNbSamples(theData))
+    {
+      // Number of samples is too big.
+      return Standard_False;
     }
-    else {
-      if(!projok) initp = pc3d[ii];
-      projok = mySameParameter = Standard_False;
-      Projector.Perform(Pcons, initp);
-      if (Projector.IsDone()) {
-        curp = Projector.Point().Parameter();
-        Standard_Real dist_2 = Projector.SquareDistance();
-        projok = Standard_True;
-        aDistMin = dist_2; 
-      }
-      else
-      {
-        ProjectPointOnCurve(initp,Pcons,Tol,30,myC3d->Curve(),projok,curp);
-        if(projok)
-        {
-          const gp_Pnt& ap1 =myC3d->Value(curp);
-          aDistMin = Pcons.SquareDistance(ap1);
-        }
-      }
-      projok = (projok && (curp > previousp + deltamin && curp < bornesup));
-      if(projok)
-      {
-        initp = previousp = pc3d[count] = curp;
-        pcons[count] = pcons[ii];
-        count++;
-       
-      }
-      else
+  }
+
+  return Standard_True;
+}
+
+//=======================================================================
+//function : IncreaseInitialNbSamples
+//purpose  : Get number of C1 intervals and build new distribution on them.
+//           Sub-method in BuildInitialDistribution.
+//=======================================================================
+Standard_Boolean Approx_SameParameter::IncreaseInitialNbSamples(Approx_SameParameter_Data &theData) const
+{
+  Standard_Integer NbInt = myHCurve2d->NbIntervals(GeomAbs_C1) + 1;
+  TColStd_Array1OfReal aC1Intervals (1, NbInt);
+  myHCurve2d->Intervals(aC1Intervals, GeomAbs_C1);
+
+  Standard_Integer inter = 1;
+  while(inter <= NbInt && aC1Intervals(inter) <= theData.myC3dPF + myDeltaMin) inter++;
+  while(NbInt > 0 && aC1Intervals(NbInt) >= theData.myC3dPL - myDeltaMin) NbInt--;
+
+  // Compute new parameters.
+  TColStd_SequenceOfReal aNewPar;
+  aNewPar.Append(theData.myC3dPF);
+  Standard_Integer ii = 1;
+  while(inter <= NbInt || (ii < myNbSamples && inter <= aC1Intervals.Length()) )
+  {
+    if(aC1Intervals(inter) < theData.myPC2d[ii])
+    {
+      aNewPar.Append(aC1Intervals(inter));
+      if((theData.myPC2d[ii] - aC1Intervals(inter)) <= myDeltaMin)
       {
-        Extrema_ExtPC PR(Pcons,myC3d->Curve(),fc3d,lc3d,Tol);
-        if(PR.IsDone())
+        ii++;
+        if(ii > myNbSamples)
         {
-          const Standard_Integer aNbExt = PR.NbExt();
-          if(aNbExt > 0)
-          {
-            Standard_Integer anIndMin = 0;
-            Standard_Real aCurDistMin = RealLast();
-            for(Standard_Integer i = 1; i <= aNbExt; i++)
-            {
-              const gp_Pnt &aP = PR.Point(i).Value();
-              Standard_Real aDist2 = aP.SquareDistance(Pcons);
-              if(aDist2 < aCurDistMin)
-              {
-                aCurDistMin = aDist2;
-                anIndMin = i;
-              }
-            }
-            if(anIndMin)
-            {
-              curp = PR.Point(anIndMin).Parameter();
-              if( curp > previousp + deltamin && curp < bornesup)
-              {
-                aDistMin = aCurDistMin;
-                initp = previousp = pc3d[count] = curp;
-                pcons[count] = pcons[ii];
-                count++;
-                projok = Standard_True;
-                
-              }
-            }
-         
-          }
+          ii = myNbSamples;
         }
       }
-      if(projok && besttol2 < aDistMin)
-        besttol2 = aDistMin;
-        
-      else if(!projok)
+      inter++;
+    }
+    else
+    {
+      if((aC1Intervals(inter) - theData.myPC2d[ii]) > myDeltaMin)
       {
-        //Projector
-#ifdef OCCT_DEBUG
-        std::cout << "Projection not done" << std::endl;
-#endif
+        aNewPar.Append(theData.myPC2d[ii]);
       }
+      ii++;
     }
   }
-
-  if(mySameParameter){
-    myTolReached = 1.5*sqrt(dmax2);
-    return;
+  // Simple protection if theNewNbPoints > allocated elements in array but one
+  // myMaxArraySize - 1 index may be filled after projection.
+  theData.myNbPnt = aNewPar.Length();
+  if (theData.myNbPnt > myMaxArraySize - 1)
+  {
+    return Standard_False;
   }
 
-  if(!extrok)
+  for(ii = 1; ii < theData.myNbPnt; ii++)
   {
-    // If not already SameP and tangent to mill, abandon.
-    mySameParameter = Standard_False;
-#ifdef OCCT_DEBUG
-    std::cout<<"SameParameter problem  : zero tangent to extremities"<<std::endl;
-#endif
-    return;
+    // Copy only internal points.
+    theData.myPC2d[ii] = theData.myPC3d[ii] = aNewPar.Value(ii + 1);
   }
+  theData.myPC3d[theData.myNbPnt]  = theData.myC3dPL;
+  theData.myPC2d[theData.myNbPnt] = theData.myC2dPL;
 
-  pcons[count] = lcons;
-  pc3d[count]  = lc3d;
+  return Standard_True;
+}
 
-  // There is at least one point where same parameter is broken.
-  // Try to build B-spline interpolation curve with degree 3.
-  // The loop is organized over number of poles.
-  Standard_Boolean hasCountChanged = Standard_False;
-  do
-  {
-    // The tables and their limits for the interpolation.
-    Standard_Integer num_knots = count + 7;
-    Standard_Integer num_poles = count + 3;
-    TColStd_Array1OfReal    Paramc3d(*pc3d,1,count+1);
-    TColStd_Array1OfReal    Paramcons(*pcons,1,count+1);
-    TColStd_Array1OfInteger ContactOrder(1,num_poles) ;
-    TColStd_Array1OfReal    Poles(1,num_poles) ;
-    TColStd_Array1OfReal    InterpolationParameters(1,num_poles) ;
-    TColStd_Array1OfReal    FlatKnots(1,num_knots) ; 
-
-    // Fill tables taking attention to end values.
-    ContactOrder.Init(0);
-    ContactOrder(2) = ContactOrder(num_poles - 1) = 1;
-
-    FlatKnots(1) = FlatKnots(2) = FlatKnots(3) = FlatKnots(4) = fc3d;
-    FlatKnots(num_poles + 1) = FlatKnots(num_poles + 2) = 
-      FlatKnots(num_poles + 3) = FlatKnots(num_poles + 4) = lc3d;
-
-    Poles(1) = fcons; Poles(num_poles) = lcons;
-    Poles(2) = tangent[0]; Poles(num_poles - 1) = tangent[1];
-
-    InterpolationParameters(1) = InterpolationParameters(2) = fc3d;
-    InterpolationParameters(num_poles - 1) = InterpolationParameters(num_poles) = lc3d;
-
-    for (ii = 3; ii <= num_poles - 2; ii++) {
-      Poles(ii) = Paramcons(ii - 1);
-      InterpolationParameters(ii) = FlatKnots(ii+2) = Paramc3d(ii - 1);
-    }
-    Standard_Integer inversion_problem;
-    BSplCLib::Interpolate(3,FlatKnots,InterpolationParameters,ContactOrder,
-      1,Poles(1),inversion_problem);
-    if(inversion_problem) {
-      throw Standard_ConstructionError();
-    }
+//=======================================================================
+//function : CheckSameParameter
+//purpose  : Sub-method in Build.
+//=======================================================================
+Standard_Boolean Approx_SameParameter::CheckSameParameter(Approx_SameParameter_Data &theData,
+                                                          Standard_Real &theSqDist) const
+{
+  const Standard_Real Tol2 = theData.myTol * theData.myTol;
+  Standard_Boolean isSameParam = Standard_True;
 
-    // Test if par2d(par3d) is monotonous function or not           ----- IFV, Jan 2000
-    // and try to insert new point to improve BSpline interpolation
+  // Compute initial distance on boundary points.
+  gp_Pnt Pcons, Pc3d;
+  theData.myCOnS.D0(theData.myC2dPF, Pcons);
+  myC3d->D0(theData.myC3dPF, Pc3d);
+  Standard_Real dist2 = Pcons.SquareDistance(Pc3d);
+  Standard_Real dmax2 = dist2;
 
-    Standard_Integer extrap_mode[2] ;
-    extrap_mode[0] = extrap_mode[1] = 3;
-    Standard_Real eval_result[2] ;
-    Standard_Integer DerivativeRequest = 0;
-    Standard_Real *PolesArray =
-      (Standard_Real *) &Poles(Poles.Lower()) ;
+  theData.myCOnS.D0(theData.myC2dPL, Pcons);
+  myC3d->D0(theData.myC3dPL, Pc3d);
+  dist2 = Pcons.SquareDistance(Pc3d);
+  dmax2 = Max(dmax2, dist2);
 
-    Standard_Integer newcount = 0;
-    for (ii = 0; ii < count; ii++) {
+  Extrema_LocateExtPC Projector;
+  Projector.Initialize(myC3d->Curve(), theData.myC3dPF, theData.myC3dPL, theData.myTol);
 
-      newpcons[newcount] = pcons[ii];
-      newpc3d[newcount] = pc3d[ii];
-      newcount++;
+  Standard_Integer count = 1;
+  Standard_Real previousp = theData.myC3dPF, initp=0, curp;
+  Standard_Real bornesup = theData.myC3dPL - myDeltaMin;
+  Standard_Boolean isProjOk = Standard_False;
+  for (Standard_Integer ii = 1; ii < theData.myNbPnt; ii++)
+  {
+    theData.myCOnS.D0(theData.myPC2d[ii],Pcons);
+    myC3d->D0(theData.myPC3d[ii],Pc3d);
+    dist2 = Pcons.SquareDistance(Pc3d);
 
-      if(count - ii + newcount == aMaxArraySize) continue;
+    // Same parameter point.
+    Standard_Boolean isUseParam = (dist2 <= Tol2  && // Good distance.
+      (theData.myPC3d[ii] > theData.myPC3d[count-1] + myDeltaMin)); // Point is separated from previous.
+    if(isUseParam)
+    {
+      if(dmax2 < dist2)
+        dmax2 = dist2;
+      initp = previousp = theData.myPC3d[count] = theData.myPC3d[ii];
+      theData.myPC2d[count] = theData.myPC2d[ii];
+      count++;
+      continue;
+    }
 
-      BSplCLib::Eval(.5*(pc3d[ii]+pc3d[ii+1]), Standard_False, DerivativeRequest,
-        extrap_mode[0], 3, FlatKnots, 1, PolesArray[0], eval_result[0]);
+    // Local search: local extrema and iterative projection algorithm.
+    if(!isProjOk)
+      initp = theData.myPC3d[ii];
+    isProjOk = isSameParam = Standard_False;
+    Projector.Perform(Pcons, initp);
+    if (Projector.IsDone())
+    {
+      // Local extrema is found.
+      curp = Projector.Point().Parameter();
+      isProjOk = Standard_True;
+    }
+    else
+    {
+      ProjectPointOnCurve(initp,Pcons,theData.myTol,30,myC3d->Curve(),isProjOk,curp);
+    }
+    isProjOk = isProjOk && // Good projection.
+               curp > previousp + myDeltaMin && // Point is separated from previous.
+               curp < bornesup; // Inside of parameter space.
+    if(isProjOk)
+    {
+      initp = previousp = theData.myPC3d[count] = curp;
+      theData.myPC2d[count] = theData.myPC2d[ii];
+      count++;
+      continue;
+    }
 
-      if(eval_result[0] < pcons[ii] || eval_result[0] > pcons[ii+1]) {
-        Standard_Real ucons = 0.5*(pcons[ii]+pcons[ii+1]);
-        Standard_Real uc3d  = 0.5*(pc3d[ii]+pc3d[ii+1]);
+    // Whole parameter space search using general extrema.
+    Extrema_ExtPC PR(Pcons,myC3d->Curve(),theData.myC3dPF, theData.myC3dPL,theData.myTol);
+    if (!PR.IsDone() || PR.NbExt() == 0) // Lazy evaluation is used.
+      continue;
 
-        CurveOnSurface.D0(ucons,Pcons);
-        Projector.Perform(Pcons, uc3d);
-        if (Projector.IsDone()) {
-          curp = Projector.Point().Parameter();
-          Standard_Real dist_2 = Projector.SquareDistance();
-          if(dist_2 > besttol2) besttol2 = dist_2;
-          projok = 1;
-        }
-        else {
-          ProjectPointOnCurve(uc3d,Pcons,Tol,30,myC3d->Curve(),projok,curp);
-        }
-        if(projok){
-          if(curp > pc3d[ii] + deltamin && curp < pc3d[ii+1] - deltamin){
-            newpc3d[newcount] = curp;
-            newpcons[newcount] = ucons;
-            newcount ++;
-          }
-        }
-        else {
-#ifdef OCCT_DEBUG
-          std::cout << "Projection not done" << std::endl;
-#endif
-        }
+    const Standard_Integer aNbExt = PR.NbExt();
+    Standard_Integer anIndMin = 0;
+    Standard_Real aCurDistMin = RealLast();
+    for(Standard_Integer i = 1; i <= aNbExt; i++)
+    {
+      const gp_Pnt &aP = PR.Point(i).Value();
+      Standard_Real aDist2 = aP.SquareDistance(Pcons);
+      if(aDist2 < aCurDistMin)
+      {
+        aCurDistMin = aDist2;
+        anIndMin = i;
       }
-
     }
-
-    newpc3d[newcount] = pc3d[count];
-    newpcons[newcount] = pcons[count];
-    Standard_Real * temp;
-    temp = pc3d;
-    pc3d = newpc3d;
-    newpc3d = temp;
-    temp = pcons;
-    pcons = newpcons;
-    newpcons = temp;
-
-    if((count != newcount) && newcount < aMaxArraySize)
+    if(anIndMin)
     {
-      hasCountChanged = Standard_True;
-      count = newcount;
-      continue;
+      curp = PR.Point(anIndMin).Parameter();
+      if( curp > previousp + myDeltaMin && curp < bornesup)
+      {
+        initp = previousp = theData.myPC3d[count] = curp;
+        theData.myPC2d[count] = theData.myPC2d[ii];
+        count++;
+        isProjOk = Standard_True;
+      }
     }
+  }
+  theData.myNbPnt = count;
+  theData.myPC2d[theData.myNbPnt] = theData.myC2dPL;
+  theData.myPC3d[theData.myNbPnt] = theData.myC3dPL;
 
-    count = newcount;
+  theSqDist = dmax2;
+  return isSameParam;
+}
 
-    Standard_Real algtol = sqrt(besttol2);
+//=======================================================================
+//function : ComputeTangents
+//purpose  : Sub-method in Build.
+//=======================================================================
+Standard_Boolean Approx_SameParameter::ComputeTangents(const Adaptor3d_CurveOnSurface & theCOnS,
+                                                       Standard_Real &theFirstTangent,
+                                                       Standard_Real &theLastTangent) const
+{
+  const Standard_Real aSmallMagnitude = 1.0e-12;
+  // Check tangency on curve border.
+  gp_Pnt aPnt, aPntCOnS;
+  gp_Vec aVec, aVecConS;
+
+  // First point.
+  const Standard_Real aParamFirst = myC3d->FirstParameter();
+  theCOnS.D1(aParamFirst, aPntCOnS, aVecConS);
+  myC3d->D1(aParamFirst, aPnt, aVec);
+  Standard_Real aMagnitude = aVecConS.Magnitude();
+  if (aMagnitude > aSmallMagnitude)
+    theFirstTangent = aVec.Magnitude() / aMagnitude;
+  else
+    return Standard_False;
+
+  // Last point.
+  const Standard_Real aParamLast = myC3d->LastParameter();
+  theCOnS.D1(aParamLast,aPntCOnS,aVecConS);
+  myC3d->D1(aParamLast, aPnt, aVec);
+
+  aMagnitude = aVecConS.Magnitude();
+  if (aMagnitude > aSmallMagnitude)
+    theLastTangent = aVec.Magnitude() / aMagnitude;
+  else
+    return Standard_False;
+
+  return Standard_True;
+}
 
-    interpolok = Check (FlatKnots, Poles, count+1, Paramc3d, Paramcons, 
-                        myC3d, CurveOnSurface, algtol, tolsov);
+//=======================================================================
+//function : Interpolate
+//purpose  : Sub-method in Build.
+//=======================================================================
+Standard_Boolean Approx_SameParameter::Interpolate(const Approx_SameParameter_Data & theData,
+                                       const Standard_Real aTangFirst,
+                                       const Standard_Real aTangLast,
+                                       TColStd_Array1OfReal & thePoles,
+                                       TColStd_Array1OfReal & theFlatKnots) const
+{
+  Standard_Integer num_poles = theData.myNbPnt + 3;
+  TColStd_Array1OfInteger ContactOrder(1,num_poles);
+  TColStd_Array1OfReal    aParameters(1, num_poles);
 
-    if (Precision::IsInfinite(algtol)) {
-      mySameParameter = Standard_False;
-#ifdef OCCT_DEBUG
-      std::cout<<"SameParameter problem  : function of interpolation of parametration at mills !!"<<std::endl;
-#endif
-      return;
-    }
+  // Fill tables taking attention to end values.
+  ContactOrder.Init(0);
+  ContactOrder(2) = ContactOrder(num_poles - 1) = 1;
 
-    tolsov = algtol;
+  theFlatKnots(1) = theFlatKnots(2) = theFlatKnots(3) = theFlatKnots(4) = theData.myC3dPF;
+  theFlatKnots(num_poles + 1) = theFlatKnots(num_poles + 2) = 
+    theFlatKnots(num_poles + 3) = theFlatKnots(num_poles + 4) = theData.myC3dPL;
 
-    interpolok = (interpolok || // Good result.
-                  count >= aMaxArraySize - 1 ); // Number of points.
+  thePoles(1) = theData.myC2dPF; thePoles(num_poles) = theData.myC2dPL;
+  thePoles(2) = aTangFirst; thePoles(num_poles - 1) = aTangLast;
 
-    if(interpolok) {
-      Standard_Real besttol = sqrt(besttol2);
+  aParameters(1) = aParameters(2) = theData.myC3dPF;
+  aParameters(num_poles - 1) = aParameters(num_poles) = theData.myC3dPL;
 
-      Handle(TColStd_HArray1OfReal) tol1d,tol2d,tol3d;
-      tol1d = new TColStd_HArray1OfReal(1,2) ;
-      tol1d->SetValue(1, mySurf->UResolution(besttol));
-      tol1d->SetValue(2, mySurf->VResolution(besttol));
+  for (Standard_Integer ii = 3; ii <= num_poles - 2; ii++)
+  {
+    thePoles(ii) = theData.myPC2d[ii - 2];
+    aParameters(ii) = theFlatKnots(ii+2) = theData.myPC3d[ii - 2];
+  }
+  Standard_Integer inversion_problem;
+  BSplCLib::Interpolate(3,theFlatKnots,aParameters,ContactOrder,
+                        1,thePoles(1),inversion_problem);
+  if(inversion_problem)
+  {
+    return Standard_False;
+  }
 
-      Approx_SameParameter_Evaluator ev (FlatKnots, Poles, myHCurve2d); 
-      AdvApprox_ApproxAFunction  anApproximator(2,0,0,tol1d,tol2d,tol3d,fc3d,lc3d,
-        Continuity,11,40,ev);
+  return Standard_True;
+}
 
-      if (anApproximator.IsDone() || anApproximator.HasResult()) {
-        Adaptor3d_CurveOnSurface ACS = CurveOnSurface;
-        GeomLib_MakeCurvefromApprox  aCurveBuilder(anApproximator) ;
-        Handle(Geom2d_BSplineCurve) aC2d = aCurveBuilder.Curve2dFromTwo1d(1,2) ;
-        Handle(Adaptor2d_HCurve2d) aHCurve2d = new Geom2dAdaptor_HCurve(aC2d);
-        CurveOnSurface.Load(aHCurve2d);
+//=======================================================================
+//function : IncreaseNbPoles
+//purpose  : Sub-method in Build.
+//=======================================================================
+Standard_Boolean Approx_SameParameter::IncreaseNbPoles(const TColStd_Array1OfReal & thePoles,
+                                                       const TColStd_Array1OfReal & theFlatKnots,
+                                                       Approx_SameParameter_Data & theData,
+                                                       Standard_Real &theBestSqTol) const
+{
+  Extrema_LocateExtPC Projector;
+  Projector.Initialize(myC3d->Curve(), myC3d->FirstParameter(), myC3d->LastParameter(), theData.myTol);
+  Standard_Real curp = 0.0;
+  Standard_Boolean projok = Standard_False;
 
-        myTolReached = ComputeTolReached(myC3d,CurveOnSurface,NCONTROL);
+  // Project middle point to fix parameterization and check projection existence.
+  const Standard_Integer aDegree = 3;
+  const Standard_Integer DerivativeRequest = 0;
+  Standard_Integer extrap_mode[2] = {aDegree, aDegree};
+  Standard_Real eval_result;
+  Standard_Real *PolesArray = (Standard_Real *) &thePoles(thePoles.Lower());
+  Standard_Integer newcount = 0;
+  for (Standard_Integer ii = 0; ii < theData.myNbPnt; ii++)
+  {
+    theData.myNewPC2d[newcount] = theData.myPC2d[ii];
+    theData.myNewPC3d[newcount] = theData.myPC3d[ii];
+    newcount++;
 
-        if(myTolReached > anErrorMAX)
-        {
-          //This tolerance is too big. Probably, we will not be able to get 
-          //edge with sameparameter in this case.
+    if(theData.myNbPnt - ii + newcount == myMaxArraySize) continue;
 
-          myDone = Standard_False;
-          return;
-        }
+    BSplCLib::Eval(0.5*(theData.myPC3d[ii]+theData.myPC3d[ii+1]), Standard_False, DerivativeRequest,
+      extrap_mode[0], 3, theFlatKnots, 1, PolesArray[0], eval_result);
 
-        if( (myTolReached < 250.0*besttol) || 
-            (count >= aMaxArraySize-2) || 
-            !hasCountChanged) //if count does not change after adding new point
-                              //(else we can have circularity)
-        {
-          myCurve2d = aC2d;
-          myHCurve2d  = aHCurve2d;
-          myDone = Standard_True;
-        }
-        else
-        {
-          interpolok = Standard_False;
-          CurveOnSurface = ACS;
-        }
-      } 
-    }
-    
-    if(!interpolok)
+    if(eval_result < theData.myPC2d[ii] || eval_result > theData.myPC2d[ii+1])
     {
+      Standard_Real ucons = 0.5*(theData.myPC2d[ii]+theData.myPC2d[ii+1]);
+      Standard_Real uc3d  = 0.5*(theData.myPC3d[ii]+theData.myPC3d[ii+1]);
 
-      newcount = 0;
-      for(Standard_Integer n = 0; n < count; n++){
-        newpc3d[newcount] = pc3d[n];
-        newpcons[newcount] = pcons[n];
-        newcount ++;
-
-        if(count - n + newcount == aMaxArraySize) continue;
-
-        Standard_Real ucons = 0.5*(pcons[n]+pcons[n+1]);
-        Standard_Real uc3d  = 0.5*(pc3d[n]+pc3d[n+1]);
-
-        CurveOnSurface.D0(ucons,Pcons);
-        Projector.Perform(Pcons, uc3d);
-        if (Projector.IsDone()) {
-          curp = Projector.Point().Parameter();
-          Standard_Real dist_2 = Projector.SquareDistance();
-          if(dist_2 > besttol2) besttol2 = dist_2;
-          projok = 1;
-        }
-        else {
-          ProjectPointOnCurve(uc3d,Pcons,Tol,30,myC3d->Curve(),projok,curp);
-        }
-        if(projok){
-          if(curp > pc3d[n] + deltamin && curp < pc3d[n+1] - deltamin){
-            newpc3d[newcount] = curp;
-            newpcons[newcount] = ucons;
-            newcount ++;
-          }
-        }
-        else {
-#ifdef OCCT_DEBUG
-          std::cout << "Projection not done" << std::endl;
-#endif
-        }
-      }
-      newpc3d[newcount] = pc3d[count];
-      newpcons[newcount] = pcons[count];
-      Standard_Real * tempx;
-      tempx = pc3d;
-      pc3d = newpc3d;
-      newpc3d = tempx;
-      tempx = pcons;
-      pcons = newpcons;
-      newpcons = tempx;
-      
-      if(count != newcount)
+      gp_Pnt Pcons;
+      theData.myCOnS.D0(ucons,Pcons);
+      Projector.Perform(Pcons, uc3d);
+      if (Projector.IsDone())
       {
-        count = newcount;
-        hasCountChanged = Standard_True;
+        curp = Projector.Point().Parameter();
+        Standard_Real dist_2 = Projector.SquareDistance();
+        if(dist_2 > theBestSqTol) theBestSqTol = dist_2;
+        projok = 1;
       }
       else
       {
-        hasCountChanged = Standard_False;
+        ProjectPointOnCurve(uc3d,Pcons,theData.myTol,30,myC3d->Curve(),projok,curp);
+      }
+      if(projok)
+      {
+        if(curp > theData.myPC3d[ii] + myDeltaMin && curp < theData.myPC3d[ii+1] - myDeltaMin)
+        {
+          theData.myNewPC3d[newcount] = curp;
+          theData.myNewPC2d[newcount] = ucons;
+          newcount ++;
+        }
       }
     }
-  } while(!interpolok && hasCountChanged);
+  } //     for (ii = 0; ii < count; ii++)
+  theData.myNewPC3d[newcount] = theData.myPC3d[theData.myNbPnt];
+  theData.myNewPC2d[newcount] = theData.myPC2d[theData.myNbPnt];
 
-  if (!myDone)
+  if((theData.myNbPnt != newcount) && newcount < myMaxArraySize - 1)
   {
-    // Loop is finished unsuccessfully. Fix tolerance by maximal deviation,
-    // using data from the last loop iteration.
-    Standard_Integer num_knots = count + 7;
-    Standard_Integer num_poles = count + 3;
-    TColStd_Array1OfReal    Paramc3d(*pc3d,1,count + 1);
-    TColStd_Array1OfReal    Paramcons(*pcons,1,count + 1);
-    TColStd_Array1OfInteger ContactOrder(1,num_poles) ;
-    TColStd_Array1OfReal    Poles(1,num_poles) ;
-    TColStd_Array1OfReal    InterpolationParameters(1,num_poles) ;
-    TColStd_Array1OfReal    FlatKnots(1,num_knots) ; 
-
-    // Fill tables taking attention to end values.
-    ContactOrder.Init(0);
-    ContactOrder(2) = ContactOrder(num_poles - 1) = 1;
-
-    FlatKnots(1) = FlatKnots(2) = FlatKnots(3) = FlatKnots(4) = fc3d;
-    FlatKnots(num_poles + 1) = FlatKnots(num_poles + 2) = 
-      FlatKnots(num_poles + 3) = FlatKnots(num_poles + 4) = lc3d;
-
-    Poles(1) = fcons; Poles(num_poles) = lcons;
-    Poles(2) = tangent[0]; Poles(num_poles - 1) = tangent[1];
-
-    InterpolationParameters(1) = InterpolationParameters(2) = fc3d;
-    InterpolationParameters(num_poles - 1) = InterpolationParameters(num_poles) = lc3d;
-
-    for (ii = 3; ii <= num_poles - 2; ii++)
-    {
-      Poles(ii) = Paramcons(ii - 1);
-      InterpolationParameters(ii) = FlatKnots(ii+2) = Paramc3d(ii - 1);
-    }
-    Standard_Integer inversion_problem;
-    BSplCLib::Interpolate(3,FlatKnots,InterpolationParameters,ContactOrder,
-                          1,Poles(1),inversion_problem);
-    if(inversion_problem)
-    {
-      throw Standard_ConstructionError();
-    }
+    // Distribution is changed.
+    theData.Swap(newcount);
+    return Standard_True;
+  }
 
-    Standard_Real besttol = sqrt(besttol2);
-    Handle(TColStd_HArray1OfReal) tol1d,tol2d,tol3d;
-    tol1d = new TColStd_HArray1OfReal(1,2) ;
-    tol1d->SetValue(1, mySurf->UResolution(besttol));
-    tol1d->SetValue(2, mySurf->VResolution(besttol));
+  // Increase number of samples in two times.
+  newcount = 0;
+  for(Standard_Integer n = 0; n < theData.myNbPnt; n++)
+  {
+    theData.myNewPC3d[newcount] = theData.myPC3d[n];
+    theData.myNewPC2d[newcount] = theData.myPC2d[n];
+    newcount ++;
 
-    Approx_SameParameter_Evaluator ev (FlatKnots, Poles, myHCurve2d); 
-    AdvApprox_ApproxAFunction  anApproximator(2,0,0,tol1d,tol2d,tol3d,fc3d,lc3d,
-                                              Continuity,11,40,ev);
+    if(theData.myNbPnt - n + newcount == myMaxArraySize) continue;
 
-    if (!anApproximator.IsDone() &&
-        !anApproximator.HasResult() )
+    Standard_Real ucons = 0.5*(theData.myPC2d[n]+theData.myPC2d[n+1]);
+    Standard_Real uc3d  = 0.5*(theData.myPC3d[n]+theData.myPC3d[n+1]);
+
+    gp_Pnt Pcons;
+    theData.myCOnS.D0(ucons,Pcons);
+    Projector.Perform(Pcons, uc3d);
+    if (Projector.IsDone()) 
     {
-      myDone = Standard_False;
-      return;
+      curp = Projector.Point().Parameter();
+      Standard_Real dist_2 = Projector.SquareDistance();
+      if(dist_2 > theBestSqTol) theBestSqTol = dist_2;
+      projok = 1;
     }
-
-    GeomLib_MakeCurvefromApprox  aCurveBuilder(anApproximator) ;
-    Handle(Geom2d_BSplineCurve) aC2d = aCurveBuilder.Curve2dFromTwo1d(1,2) ;
-    Handle(Adaptor2d_HCurve2d) aHCurve2d = new Geom2dAdaptor_HCurve(aC2d);
-    CurveOnSurface.Load(aHCurve2d);
-
-    myTolReached = ComputeTolReached(myC3d,CurveOnSurface,NCONTROL);
-
-    if(myTolReached > anErrorMAX)
+    else 
     {
-      //This tolerance is too big. Probably, we will not be able to get
-      //edge with sameparameter in this case.
-      myDone = Standard_False;
-      return;
+      ProjectPointOnCurve(uc3d,Pcons,theData.myTol,30,myC3d->Curve(),projok,curp);
     }
+    if(projok)
+    {
+      if(curp > theData.myPC3d[n] + myDeltaMin && curp < theData.myPC3d[n+1] - myDeltaMin)
+      {
+        theData.myNewPC3d[newcount] = curp;
+        theData.myNewPC2d[newcount] = ucons;
+        newcount ++;
+      }
+    }
+  }
+  theData.myNewPC3d[newcount] = theData.myPC3d[theData.myNbPnt];
+  theData.myNewPC2d[newcount] = theData.myPC2d[theData.myNbPnt];
 
-    myCurve2d = aC2d;
-    myHCurve2d  = aHCurve2d;
-    myDone = Standard_True;
+  if(theData.myNbPnt != newcount)
+  {
+    // Distribution is changed.
+    theData.Swap(newcount);
+    return Standard_True;
   }
+
+  return Standard_False;
 }
index 4d69b22433bbdd9ef3094c19326685fdcb56e264..7f56fc3f91a58cd5e5bf72838df941684d2a5712 100644 (file)
 #include <Standard.hxx>
 #include <Standard_DefineAlloc.hxx>
 #include <Standard_Handle.hxx>
-
+#include <Adaptor3d_CurveOnSurface.hxx>
 #include <Standard_Boolean.hxx>
 #include <Standard_Real.hxx>
-class Geom2d_BSplineCurve;
 class Adaptor2d_HCurve2d;
 class Adaptor3d_HCurve;
 class Adaptor3d_HSurface;
-class Standard_OutOfRange;
-class Standard_ConstructionError;
 class Geom_Curve;
 class Geom2d_Curve;
 class Geom_Surface;
 
-
-//! Approximation of a  PCurve  on a surface to  make  its
+//! Approximation of a  PCurve  on a surface to  make its
 //! parameter be the same that the parameter of a given 3d
 //! reference curve.
 class Approx_SameParameter 
@@ -43,63 +39,149 @@ public:
 
   DEFINE_STANDARD_ALLOC
 
-  
+  //! Warning: the C3D and C2D must have the same parametric domain.
+  Standard_EXPORT Approx_SameParameter(const Handle(Geom_Curve)& C3D,
+                                       const Handle(Geom2d_Curve)& C2D,
+                                       const Handle(Geom_Surface)& S,
+                                       const Standard_Real Tol);
 
   //! Warning: the C3D and C2D must have the same parametric domain.
-  Standard_EXPORT Approx_SameParameter(const Handle(Geom_Curve)& C3D, const Handle(Geom2d_Curve)& C2D, const Handle(Geom_Surface)& S, const Standard_Real Tol);
-  
-  Standard_EXPORT Approx_SameParameter(const Handle(Adaptor3d_HCurve)& C3D, const Handle(Geom2d_Curve)& C2D, const Handle(Adaptor3d_HSurface)& S, const Standard_Real Tol);
-  
+  Standard_EXPORT Approx_SameParameter(const Handle(Adaptor3d_HCurve)& C3D,
+                                       const Handle(Geom2d_Curve)& C2D,
+                                       const Handle(Adaptor3d_HSurface)& S,
+                                       const Standard_Real Tol);
 
   //! Warning: the C3D and C2D must have the same parametric domain.
-  Standard_EXPORT Approx_SameParameter(const Handle(Adaptor3d_HCurve)& C3D, const Handle(Adaptor2d_HCurve2d)& C2D, const Handle(Adaptor3d_HSurface)& S, const Standard_Real Tol);
-  
-    Standard_Boolean IsDone() const;
-  
-    Standard_Real TolReached() const;
-  
-  //! Tells whether the original data  had already the  same
-  //! parameter up to  the tolerance :  in that case nothing
+  Standard_EXPORT Approx_SameParameter(const Handle(Adaptor3d_HCurve)& C3D,
+                                       const Handle(Adaptor2d_HCurve2d)& C2D,
+                                       const Handle(Adaptor3d_HSurface)& S,
+                                       const Standard_Real Tol);
+
+  //!@Returns .false. if calculations failed,
+  //! .true. if calculations succeed
+  Standard_Boolean IsDone() const
+  {
+    return myDone;
+  }
+
+  //!@Returns tolerance (maximal distance) between 3d curve
+  //! and curve on surface, generated by 2d curve and surface. 
+  Standard_Real TolReached() const
+  {
+    return myTolReached;
+  }
+
+  //! Tells whether the original data had already the same
+  //! parameter up to the tolerance : in that case nothing
   //! is done.
-    Standard_Boolean IsSameParameter() const;
-  
-  //! Returns the 2D  curve that has  the same parameter  as
-  //! the  3D curve once evaluated on  the surface up to the
-  //! specified tolerance
-    Handle(Geom2d_BSplineCurve) Curve2d() const;
-
-
-
-
-protected:
-
-
-
-
+  Standard_Boolean IsSameParameter() const
+  {
+    return mySameParameter;
+  }
+
+  //! Returns the 2D curve that has the same parameter as
+  //! the 3D curve once evaluated on the surface up to the
+  //! specified tolerance.
+  Handle(Geom2d_Curve) Curve2d() const
+  {
+    return myCurve2d;
+  }
 
 private:
 
-  
-  //! Compute the Pcurve (internal use only).
+  //! Internal data structure to unify access to the most actively used data.
+  //! This structure is not intended to be class field since
+  //! a lot of memory is used in intermediate computations.
+  struct Approx_SameParameter_Data
+  {
+    Adaptor3d_CurveOnSurface myCOnS; // Curve on surface.
+    Standard_Integer myNbPnt; // Number of points.
+    Standard_Real *myPC3d; // Parameters on 3d curve.
+    Standard_Real *myPC2d; // Parameters on 2d curve.
+
+    // Second data arrays. Used in loop over poles.
+    Standard_Real *myNewPC3d; // Parameters on 3d curve.
+    Standard_Real *myNewPC2d; // Parameters on 2d curve.
+
+    // Parameters ranges.
+    Standard_Real myC3dPF; // Curve 3d Parameter First.
+    Standard_Real myC3dPL; // Curve 3d Parameter Last.
+    Standard_Real myC2dPF; // Curve 2d Parameter First.
+    Standard_Real myC2dPL; // Curve 2d Parameter Last.
+
+    Standard_Real myTol; // Working tolerance.
+
+    // Swap data arrays and update number of points.
+    void Swap(const Standard_Integer theNewNbPoints)
+    {
+      myNbPnt = theNewNbPoints;
+      Standard_Real * temp;
+
+      // 3-D
+      temp = myPC3d;
+      myPC3d = myNewPC3d;
+      myNewPC3d = temp;
+
+      // 2-D
+      temp = myPC2d;
+      myPC2d = myNewPC2d;
+      myNewPC2d = temp;
+    }
+  };
+
+
+  Approx_SameParameter(const Approx_SameParameter &);
+  Approx_SameParameter& operator=(const Approx_SameParameter &);
+
+  //! Computes the pcurve (internal use only).
   Standard_EXPORT void Build (const Standard_Real Tol);
 
+  //! Computes initial point distribution.
+  Standard_Boolean BuildInitialDistribution(Approx_SameParameter_Data &theData) const;
+
+  //! Increases initial number of samples in case of the C0 continuity.
+  //! Return new number of points and corresponding data arrays.
+  //@return true if new number of samples is good and false otherwise.
+  Standard_Boolean IncreaseInitialNbSamples(Approx_SameParameter_Data &theData) const;
+
+  //! Computes tangents on boundary points.
+  //@return true if tangents are not null and false otherwise.
+  Standard_Boolean ComputeTangents(const Adaptor3d_CurveOnSurface & theCOnS,
+                                   Standard_Real &theFirstTangent,
+                                   Standard_Real &theLastTangent) const;
+
+  //! Method to check same parameter state
+  //! and build dependency between 2d and 3d curves.
+  //@return true if 2d and 3d curves have same parameter state and false otherwise.
+  Standard_Boolean CheckSameParameter(Approx_SameParameter_Data &theData,
+                                      Standard_Real &theSqDist) const;
+
+  //! Computes interpolated values.
+  //!@Returns .false. if computations failed;
+  Standard_Boolean Interpolate(const Approx_SameParameter_Data & theData,
+                   const Standard_Real aTangFirst,
+                   const Standard_Real aTangLast,
+                   TColStd_Array1OfReal & thePoles,
+                   TColStd_Array1OfReal & theFlatKnots) const;
+
+  //! Increases number of poles in poles loop.
+  //@return true if poles is changed and false otherwise.
+  Standard_Boolean IncreaseNbPoles(const TColStd_Array1OfReal & thePoles,
+                                   const TColStd_Array1OfReal & theFlatKnots,
+                                   Approx_SameParameter_Data & theData,
+                                   Standard_Real &theBestSqTol) const;
+
+  static const Standard_Integer myNbSamples = 22; // To be consistent with "checkshape".
+  static const Standard_Integer myMaxArraySize = 1000;
+  const Standard_Real myDeltaMin; // Initialization is allowed only for integral types.
 
   Standard_Boolean mySameParameter;
   Standard_Boolean myDone;
   Standard_Real myTolReached;
-  Handle(Geom2d_BSplineCurve) myCurve2d;
+  Handle(Geom2d_Curve) myCurve2d;
   Handle(Adaptor2d_HCurve2d) myHCurve2d;
   Handle(Adaptor3d_HCurve) myC3d;
   Handle(Adaptor3d_HSurface) mySurf;
-
-
 };
 
-
-#include <Approx_SameParameter.lxx>
-
-
-
-
-
 #endif // _Approx_SameParameter_HeaderFile
diff --git a/src/Approx/Approx_SameParameter.lxx b/src/Approx/Approx_SameParameter.lxx
deleted file mode 100644 (file)
index 012ab93..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-// Created on: 1995-06-06
-// Created by: Modelistation
-// Copyright (c) 1995-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 License 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.
-
-//=======================================================================
-//function : IsDone
-//purpose  : 
-//=======================================================================
-
-inline Standard_Boolean Approx_SameParameter::IsDone() const 
-{ return myDone ; }
-//=======================================================================
-//function : TolReached
-//purpose  : 
-//=======================================================================
-
-inline Standard_Real Approx_SameParameter::TolReached() const 
-{ return myTolReached; }
-//=======================================================================
-//function : IsSameParameter
-//purpose  : 
-//=======================================================================
-
-inline Standard_Boolean Approx_SameParameter::IsSameParameter()  const 
-{ return mySameParameter ; }
-//=======================================================================
-//function : Curve2d
-//purpose  : 
-//=======================================================================
-
-inline Handle(Geom2d_BSplineCurve) Approx_SameParameter::Curve2d() const 
-{ return myCurve2d ; } 
index 6cd02d9bc161a1465744afc2780f4372441e0f7f..939d6e53d5b7ea810055d82bc73d84b0055df93a 100644 (file)
@@ -24,7 +24,6 @@ Approx_MCurvesToBSpCurve.hxx
 Approx_ParametrizationType.hxx
 Approx_SameParameter.cxx
 Approx_SameParameter.hxx
-Approx_SameParameter.lxx
 Approx_SequenceOfHArray1OfReal.hxx
 Approx_Status.hxx
 Approx_SweepApproximation.cxx
index a07354e888380689ff763e80b68a190da1307a8f..c206365c775f6091d54776bd15bde91b84189a5f 100644 (file)
@@ -16,6 +16,7 @@
 
 
 #include <Adaptor2d_Curve2d.hxx>
+#include <Geom2dAdaptor_Curve.hxx>
 #include <Geom2d_BezierCurve.hxx>
 #include <Geom2d_BSplineCurve.hxx>
 #include <Geom2d_Circle.hxx>
@@ -88,7 +89,21 @@ Handle(Geom2d_Curve) Geom2dAdaptor::MakeCurve
       C2D = HC.BSpline();
     }
     break;
-    
+
+  case GeomAbs_OffsetCurve:
+  {
+    const Geom2dAdaptor_Curve* pGAC = dynamic_cast<const Geom2dAdaptor_Curve*>(&HC);
+    if (pGAC != 0)
+    {
+      C2D = pGAC->Curve();
+    }
+    else
+    {
+      Standard_DomainError::Raise("Geom2dAdaptor::MakeCurve, Not Geom2dAdaptor_Curve");
+    }
+  }
+  break;
+
   default:
     throw Standard_DomainError("Geom2dAdaptor::MakeCurve, OtherCurve");
 
@@ -99,8 +114,19 @@ Handle(Geom2d_Curve) Geom2dAdaptor::MakeCurve
       ((HC.FirstParameter() != C2D->FirstParameter()) ||
       (HC.LastParameter()  != C2D->LastParameter()))) {
 
-    C2D = new Geom2d_TrimmedCurve
-      (C2D,HC.FirstParameter(),HC.LastParameter());
+    if (C2D->IsPeriodic() ||
+      (HC.FirstParameter() >= C2D->FirstParameter() &&
+      HC.LastParameter() <= C2D->LastParameter()))
+    {
+      C2D = new Geom2d_TrimmedCurve
+        (C2D, HC.FirstParameter(), HC.LastParameter());
+    }
+    else
+    {
+      Standard_Real tf = Max(HC.FirstParameter(), C2D->FirstParameter());
+      Standard_Real tl = Min(HC.LastParameter(), C2D->LastParameter());
+      C2D = new Geom2d_TrimmedCurve(C2D, tf, tl);
+    }
   }
 
   return C2D;
index 3e60060b3de8d0fcf958f2878965bcf71f2bdbd9..4edc216d18911b3a978cf408948814206392faac 100644 (file)
@@ -1,4 +1,4 @@
-puts "TODO #OCC26740 ALL: Faulty shapes in variables faulty_1 to faulty_2"
+#puts "TODO #OCC26740 ALL: Faulty shapes in variables faulty_1 to faulty_2"
 
 ## ===========================================
 ## Grid    : CCV001
index 1e0a1ac19feb356c90563d7b23e86e89df1710e2..0e844344e34a102dd1b994c088347ef422821697 100755 (executable)
@@ -20,7 +20,7 @@ vsetdispmode result 1
 vdisplay result
 vfit
 
-checktrinfo result -tri 5814 -nod 5811
+checktrinfo result -tri 5812 -nod 5809
 
 checkmaxtol result -ref 0.92213088179312575
 checknbshapes result -shell 1
index 6cfcdc8a59ff991a73e2dd3001f5b0da181dc623..ae4c1332716d5d15162c2b428243602140236738 100755 (executable)
@@ -20,7 +20,7 @@ vdisplay result
 
 # checkshape res
 
-checkmaxtol result -ref 1.56901e+001
+checkmaxtol result -ref 1.098308e+001
 checknbshapes result -shell 2
 checkfreebounds result 115
 
index ddf37475fd547557262b0f5ff4594740f0a2b6ce..09d5a7d2a253d3c15d242318b82e0682df4dd869 100755 (executable)
@@ -14,7 +14,7 @@ sewing result +t 0.01 a b +mint 0.01 -a
 
 set nbshapes_expected "
 Number of shapes in shape
- VERTEX    : 479
+ VERTEX    : 480
  EDGE      : 748
  WIRE      : 273
  FACE      : 259
@@ -22,11 +22,11 @@ Number of shapes in shape
  SOLID     : 0
  COMPSOLID : 0
  COMPOUND  : 1
- SHAPE     : 1762
+ SHAPE     : 1763
 "
 checknbshapes result -ref ${nbshapes_expected} -t -m "sewing result"
-checkmaxtol result -ref 0.066338232054955981
-checkfreebounds result 12
+checkmaxtol result -ref 0.04656161000546645
+checkfreebounds result 14
 
 checkprops result -s 1.8847e+07 -eps 0.1
 checkshape result
index 38a5ab692de44bd4f00ab1f9abdf1f6f242312b7..fd420486d12923ffe03f97e6d8148f0e1b3cccc6 100755 (executable)
@@ -16,7 +16,7 @@ checkprops result -s 1.88469e+07
 checkshape result
 
 checknbshapes result -vertex 476 -edge 748 -wire 273 -face 259 -shell 2 -solid 0 -compsolid 0 -compound 1 -shape 1759
-checkmaxtol result -ref 0.066338232054955981
+checkmaxtol result -ref 0.04656161000546645
 checknbshapes result -shell 2
 checkfreebounds result 6
 checkview -display result -3d -path ${imagedir}/${test_image}.png
index 92e62371609a35100cb02657e1cdace84c99693e..fbe4ce43e45389dbca4d2189f7f2979a37afd278 100755 (executable)
@@ -32,7 +32,7 @@ checkprops result -s 1.8847e+07
 checkshape result
 
 checknbshapes result -vertex 964 -edge 1222 -wire 273 -face 259 -shell 18 -solid 0 -compsolid 0 -compound 1 -shape 2737
-checkmaxtol result -ref 0.046734236640099257
+checkmaxtol result -ref 0.0451323239933289
 checknbshapes result -shell 18
 checkfreebounds result 926
 checkview -display result -3d -path ${imagedir}/${test_image}.png
index 22c4fb2242a7b5431cbf47687e8c1009201585f7..47dab4893bc10a72b6aa9fe547042b43ef301adc 100755 (executable)
@@ -32,7 +32,7 @@ checkprops result -s 1.8847e+07
 checkshape result
 
 checknbshapes result -vertex 964 -edge 1222 -wire 273 -face 259 -shell 18 -solid 0 -compsolid 0 -compound 1 -shape 2737
-checkmaxtol result -ref 0.046734236640099257
+checkmaxtol result -ref 0.0451323239933289
 checknbshapes result -shell 18
 checkfreebounds result 926
 checkview -display result -3d -path ${imagedir}/${test_image}.png
index 0f8e564829592b24974e8bf8fb06da43af7f3dce..4c18f970c3c35fd371c542be92477cf6ea7d1772 100755 (executable)
@@ -19,7 +19,7 @@ checkprops result -s 12
 checkshape result
 
 checknbshapes result -vertex 4 -edge 4 -wire 2 -face 2 -shell 1 -solid 0 -compsolid 0 -compound 0 -shape 13
-checkmaxtol result -ref 1.5
+checkmaxtol result -ref 1.05
 checknbshapes result -shell 1
 checkfreebounds result 0
 checkview -display result -3d -path ${imagedir}/${test_image}.png
index e2155a4477c8681391320be24b8fd33a11cbd8f4..346c64bc100009b40a63b81756047094c82e0955 100755 (executable)
@@ -19,7 +19,7 @@ checkprops result -s 12
 checkshape result
 
 checknbshapes result -vertex 4 -edge 4 -wire 2 -face 2 -shell 1 -solid 0 -compsolid 0 -compound 0 -shape 13
-checkmaxtol result -ref 1.5
+checkmaxtol result -ref 1.05
 checknbshapes result -shell 1
 checkfreebounds result 0
 checkview -display result -3d -path ${imagedir}/${test_image}.png
index 10e27ecc778d94758d0490acf42e8028ab724e0e..d48ad3916e043e39f59ff67c528ad04e0db69dd8 100755 (executable)
@@ -17,7 +17,7 @@ checkprops result -s 1.8847e+07
 checkshape result
 
 checknbshapes result -vertex 480 -edge 741 -wire 273 -face 259 -shell 2 -solid 0 -compsolid 0 -compound 1 -shape 1756
-checkmaxtol result -ref 0.080878557461246572
+checkmaxtol result -ref 0.083903522096914374
 checknbshapes result -shell 2
 checkfreebounds result 0
 checkview -display result -3d -path ${imagedir}/${test_image}.png
index 4b826ac781e2bccc5320536310bdf505f9b732ed..45fe73d3041862c09487660b7820db936fe51492 100755 (executable)
@@ -19,7 +19,7 @@ checkprops result -s 1.88469e+07
 checkshape result
 
 checknbshapes result -vertex 476 -edge 748 -wire 273 -face 259 -shell 2 -solid 0 -compsolid 0 -compound 1 -shape 1759
-checkmaxtol result -ref 0.080878557461246572
+checkmaxtol result -ref 0.083903522096914374
 checknbshapes result -shell 2
 checkfreebounds result 0
 checkview -display result -3d -path ${imagedir}/${test_image}.png
index e5a16066df5ae57989445cfdf314b887b780c0ea..fd88aae1405daf2389076f01cdef4ce5edd5de7a 100755 (executable)
@@ -1,4 +1,4 @@
-puts "TODO OCC11111 ALL: Error :  is WRONG because number of "
+#puts "TODO OCC11111 ALL: Error :  is WRONG because number of "
 
 puts "================"
 puts "OCC22770"
@@ -18,8 +18,8 @@ sewing result 0.1 a b +mint 0.01 -a
 checkprops result -s 1.88469e+07 
 checkshape result
 
-checknbshapes result -vertex 478 -edge 748 -wire 273 -face 259 -shell 2 -solid 0 -compsolid 0 -compound 1 -shape 1761
-checkmaxtol result -ref 0.080878557461246572
+checknbshapes result -vertex 479 -edge 746 -wire 273 -face 259 -shell 2 -solid 0 -compsolid 0 -compound 1 -shape 1760
+checkmaxtol result -ref 0.083903522096914374
 checknbshapes result -shell 2
-checkfreebounds result 6
+checkfreebounds result 8
 checkview -display result -3d -path ${imagedir}/${test_image}.png
index 2ddf5894026ffc92648f76c60d5738c6ad5cd31f..5fe88694c8f7a5e44071ee22f4f49bd2829afcf9 100755 (executable)
@@ -19,7 +19,7 @@ checkprops result -s 1.88469e+07
 checkshape result
 
 checknbshapes result -vertex 476 -edge 748 -wire 273 -face 259 -shell 2 -solid 0 -compsolid 0 -compound 1 -shape 1759
-checkmaxtol result -ref 0.080878557461246572
+checkmaxtol result -ref 0.083903522096914374
 checknbshapes result -shell 2
 checkfreebounds result 0
 checkview -display result -3d -path ${imagedir}/${test_image}.png
index 71ab081ada97b9083305c5761cf68d90ae5d66ea..f96c9bae2314bd4af8a739c952602f28e2ba951b 100755 (executable)
@@ -17,7 +17,7 @@ checkprops result -s 1.8847e+07
 checkshape result
 
 checknbshapes result -vertex 483 -edge 744 -wire 273 -face 259 -shell 2 -solid 0 -compsolid 0 -compound 1 -shape 1762
-checkmaxtol result -ref 0.080645000662448688
+checkmaxtol result -ref 0.083710669564248399
 checknbshapes result -shell 2
 checkfreebounds result 9
 checkview -display result -3d -path ${imagedir}/${test_image}.png
index b1db90beafdce0d81dd191989e741d0226c1090e..b0d774ec3b0921701e461c778466401d2bf30c6c 100755 (executable)
@@ -17,7 +17,7 @@ checkprops result -s 1.8847e+07
 checkshape result
 
 checknbshapes result -vertex 480 -edge 741 -wire 273 -face 259 -shell 2 -solid 0 -compsolid 0 -compound 1 -shape 1756
-checkmaxtol result -ref 0.080878557461246572
+checkmaxtol result -ref  0.083903522096914374
 checknbshapes result -shell 2
 checkfreebounds result 0
 checkview -display result -3d -path ${imagedir}/${test_image}.png
index 10415b62baae5a9ee43b6005207f78379dcb5744..8d6c4fbb848cf861606e45696571744301ce7e02 100755 (executable)
@@ -25,7 +25,7 @@ sewing result +t 1.1 a_2 b_1
 checkprops result -s 12 
 checkshape result
 checknbshapes result -vertex 4 -edge 4 -wire 2 -face 2 -shell 1 -solid 0 -compsolid 0 -compound 0 -shape 13
-checkmaxtol result -ref 1.5
+checkmaxtol result -ref 1.05
 checknbshapes result -shell 1
 checkfreebounds result 0
 checkview -display result -3d -path ${imagedir}/${test_image}.png
index d8e3cfadd09dfcc2da0de0bb7708356f46b0ac2b..6fe96c931d5d25df31ba79174ed6281a89a75f69 100755 (executable)
@@ -17,7 +17,7 @@ checkprops result -s 1.8847e+07
 checkshape result
 
 checknbshapes result -vertex 480 -edge 741 -wire 273 -face 259 -shell 2 -solid 0 -compsolid 0 -compound 1 -shape 1756
-checkmaxtol result -ref 0.080878557461246572
+checkmaxtol result -ref 0.083903522096914374
 checknbshapes result -shell 2
 checkfreebounds result 0
 checkview -display result -3d -path ${imagedir}/${test_image}.png
index cc01b8b1ca4fbfe383e7b86e38e5bc54a8ef89c1..43c03eb243935677bcdc65d1deb42e6de56b4218 100755 (executable)
@@ -17,7 +17,7 @@ sewing result +t 1.1 a_2 b_1 +f
 checkprops result -s 12 
 checkshape result
 checknbshapes result -vertex 4 -edge 4 -wire 2 -face 2 -shell 1 -solid 0 -compsolid 0 -compound 0 -shape 13
-checkmaxtol result -ref 1.5
+checkmaxtol result -ref 1.05
 checknbshapes result -shell 1
 checkfreebounds result 0
 checkview -display result -3d -path ${imagedir}/${test_image}.png
index 0efef4e4c80d0b4c2c6adc898d061c5f3a073445..d9ad2990289d2512fd37de205233036c5cef5812 100755 (executable)
@@ -18,7 +18,7 @@ checkprops result -s 1.88469e+07
 checkshape result
 
 checknbshapes result -vertex 482 -edge 744 -wire 273 -face 259 -shell 2 -solid 0 -compsolid 0 -compound 1 -shape 1761
-checkmaxtol result -ref 0.066338232054955981
+checkmaxtol result -ref 0.04656161000546645
 checknbshapes result -shell 2
 checkfreebounds result 6
 checkview -display result -3d -path ${imagedir}/${test_image}.png
index 1df78add47583ea440dd21b81148c2cce37d4aeb..572b26e942c09333711bce34ef6a88a1911f649d 100755 (executable)
@@ -16,7 +16,7 @@ checkprops result -s 1.88469e+07
 checkshape result
 
 checknbshapes result -vertex 476 -edge 748 -wire 273 -face 259 -shell 2 -solid 0 -compsolid 0 -compound 1 -shape 1759
-checkmaxtol result -ref 0.066338232054955981
+checkmaxtol result -ref 0.04656161000546645
 checknbshapes result -shell 2
 checkfreebounds result 6
 checkview -display result -3d -path ${imagedir}/${test_image}.png
index 8b794093dc48973e5f2e8301c3aa0850e1fdca05..7850befe3dd93fa0581d90d11b5338118eaca5f5 100755 (executable)
@@ -28,7 +28,7 @@ if { ${minTolerance}  > ${VertexTolerance} } {
 
 
 checkreal "Min tolerance" ${minTolerance} ${oTolerance} 0 0.001
-checkmaxtol result -ref 2352.4465999220711
+checkmaxtol result -ref 1699.9358291469857
 checknbshapes result -shell 1
 checkfreebounds result 5
 
index 3c3d2265e3b36416ba7391c2fb715aff2d446d2c..972e017dda9a66814b619348a55312d88ca3f37b 100755 (executable)
@@ -29,7 +29,7 @@ if { $ve1 != $ve2 || $ed1 != $ed2 || $we1 != $we2} {
     puts "OK OCC714: SEWING operation was made PROPERLY"
 }
 
-checkmaxtol result -ref 0.25619311354638169
+checkmaxtol result -ref 0.17933517948246736
 checknbshapes result -shell 1
 checkfreebounds result 0
 
index 0912b2591e27ee50ac1959682bee8a3a79f1099a..ee7c73ee8286e1c0330058f61fe5c0375f4f18f8 100644 (file)
@@ -12,7 +12,7 @@ igesread [locate_data_file bug25175_3.igs] a *
 
 sewing result 0.1 a
 
-checkmaxtol result -ref 0.40493352048584974 
+checkmaxtol result -ref 0.21794517334615857 
 checknbshapes result -shell 1
 checkfreebounds result 0
 
index b554ed3f956869e9bf7a41bd7824d5548a21fca2..a065ebb5fe8bf00cd490f088c174397711224d71 100644 (file)
@@ -1,4 +1,4 @@
-puts "TODO OCC27531 ALL: Error: Max tolerance"
+#puts "TODO OCC27531 ALL: Error: Max tolerance"
 puts "========"
 puts "0027015: Sewing returns invalid shape if some faces are nearly plane cones"
 puts "========"
@@ -14,4 +14,4 @@ checkshape result
 # Check tolerance of the result shape.
 # Currently same parameter algorithm can not interpolate pcurve.
 #"same parameter" state is obtained increasing tolerance to ~130.0 mm (max deviation between curves in 3d and 2d).
-checkmaxtol result -ref 1.0
+checkmaxtol result -ref 0.029697490042886372
index 321de4bd13d105d7436f16d59cd05a2fd66a1f96..af381765e9e10256ebf1365f73bb8ccc3c4cfc55 100644 (file)
@@ -21,7 +21,7 @@ fixshape result rr
 checkshape result
 checkprops result -s 2.14316e+011
 
-checkmaxtol result -ref 0.070055357229360987
+checkmaxtol result -ref 0.049038750060552701
 
 checknbshapes result -shell 1 -face 201 -wire 201
 
index bd84779c5daa5d17a0bf0c887d7434be44c9f14b..e37e88b6dcec3ac019c014d9f560cd968e49fd15 100755 (executable)
@@ -18,7 +18,7 @@ if [catch {igesbrep $filepath a *} catch_result] {
     #
     sewing result1 100. a
 
-    checkmaxtol result1 -ref 9.43897e+001
+    checkmaxtol result1 -ref 66.0727572
     checknbshapes result1 -shell 1
     checkfreebounds result1 86
 
@@ -71,7 +71,7 @@ if [catch {igesbrep $filepath a *} catch_result] {
         tpcompound a
        sewing result2 100. a
 
-        checkmaxtol result2 -ref 9.43897e+001
+        checkmaxtol result2 -ref 66.072757207851282
         checknbshapes result2 -shell 1
         checkfreebounds result2 86
 
index 091eefd0288e923cf1deb04f50548b9343bcd58e..6dc628f20d2489608a65c31e2f843b8e9a939be4 100755 (executable)
@@ -34,7 +34,7 @@ if { [llength $closed_wires] != 1} {
    puts "Error : Amount of free closed wires is not equal 1"
 }
 
-checkmaxtol result -ref 9.43897e+001
+checkmaxtol result -ref 66.072757207853044
 checknbshapes result -shell 1
 checkfreebounds result 86
 
index d81477f3686d2283a3f26937f5a2af5d909a10cd..cb65b657a4c99e3001bb368124329185faa4692c 100755 (executable)
@@ -15,7 +15,7 @@ set tolerance 1000
 sewing result ${tolerance} a
 
 checknbshapes result -face 263 -shell 1
-checkmaxtol result -ref 185.91005891234283
+checkmaxtol result -ref 130.21536414731227
 checkfreebounds result 73
 
 checkview -display result -2d -path ${imagedir}/${test_image}.png
index 31638358b88b9c176ba84bc68f0ef2a0acc1ed8b..4a8460bc2504ce2b84ae35feb5be5b3c831858d2 100644 (file)
@@ -11,7 +11,7 @@ TPSTAT      : Faulties = 0  ( 0 )  Warnings = 0  ( 7 )  Summary  = 0  ( 7 )
 CHECKSHAPE  : Wires    = 0  ( 0 )  Faces    = 0  ( 0 )  Shells   = 0  ( 0 )   Solids   = 0 ( 0 )
 NBSHAPES    : Solid    = 0  ( 0 )  Shell    = 9  ( 0 )  Face     = 9  ( 9 ) 
 STATSHAPE   : Solid    = 0  ( 0 )  Shell    = 9  ( 0 )  Face     = 9  ( 9 )   FreeWire = 0  ( 0 ) 
-TOLERANCE   : MaxTol   = 0.003863207397  (  0.02717230043 )  AvgTol   =  0.0004713629464  (  0.003097464066 )
+TOLERANCE   : MaxTol   = 0.003863207397  (  0.03790164928 )  AvgTol   =  0.0004713629464  (  0.003090287092 )
 LABELS      : N0Labels = 1  ( 1 )  N1Labels = 5  ( 5 )  N2Labels = 0  ( 0 )   TotalLabels = 6  ( 6 )   NameLabels = 1  ( 1 )   ColorLabels = 0  ( 0 )   LayerLabels = 5  ( 5 )
 PROPS       : Centroid = 0  ( 0 )  Volume   = 0  ( 0 )  Area     = 0  ( 0 )
 NCOLORS     : NColors  = 0  ( 0 )
index dd1e15fa1f5924ca42b391d2cce31a5660e700c0..1faa827553591bd44f7dd0b2160402174fcfae6e 100644 (file)
@@ -1,5 +1,5 @@
-if { [string compare $command "ShapeConvertRev"] == 0 } {
-   puts "TODO OCC23127 ALL: Error : The area of the resulting shape is"
-}
+#if { [string compare $command "ShapeConvertRev"] == 0 } {
+   #puts "TODO OCC23127 ALL: Error : The area of the resulting shape is"
+#}
 restore [locate_data_file CTO901_cts20172_base.rle] a
 
index ea4d5e06c119276132fd8efec4b706b33cff039d..36bc188ab7c328c3a20f140d6b70087bdd229e06 100644 (file)
@@ -1,2 +1,5 @@
+if { [string compare $command "SplitAngle"] == 0 } {
+  puts "REQUIRED All: Faulty shapes in variables faulty_1 to faulty_"
+}
 restore [locate_data_file ANSCHLUSS.brep] a
 
index 63ab3db33e0bc4283f53f8d924aa913142a4021d..7d6858c032f157fac4e3b47f7923ecc3b1ed125a 100644 (file)
@@ -12,10 +12,10 @@ regexp {Number +of +other +pcurves +- +([-0-9.+eE]+)} $expsh full nb_pcurve
 if { $nb_plane != 0 || $nb_other_surf != 0 || $nb_curve != 0 || $nb_pcurve != 0} {
    puts "Error : The resulting shape is not correct"
 }
-regexp {Mass +: +([-0-9.+eE]+)} [sprops a] full mass
-regexp {Mass +: +([-0-9.+eE]+)} [sprops result] full m
+regexp {Mass +: +([-0-9.+eE]+)} [sprops a $rel_tol] full mass
+regexp {Mass +: +([-0-9.+eE]+)} [sprops result $rel_tol] full m
 
-if { ($mass != 0 && [expr 1.*abs($mass - $m)/$mass] > $rel_tol) || ($mass == 0 && $m != 0) } {
+if { ($mass != 0 && [expr 1.*abs($mass - $m)/$mass] > 1.5*$rel_tol) || ($mass == 0 && $m != 0) } {
    puts "Error : The area of the resulting shape is $m"
 } else {
    puts "The areas of the initial and the resulting shape are equal"
index b2be5093351561f92500f98deb1414b96c304d09..536d8018d559bedb7e67a9dd302d67007d2330c9 100644 (file)
@@ -1,4 +1,5 @@
 puts "TODO OCC30286 Windows: Error : The length of result shape is 404.004, expected 404.386"
+puts "TODO OCC30286 Linux: Error : The length of result shape is 404.492, expected 404.386"
 
 polyline f1 0 0 0  0 -10 0  100 -10 0  100 0 0  0 0 0
 polyline f2 100 0 0  110 0 0  110 100 0  100 100 0  100 0 0
index f5bb3426ca053ecdba15ba1d7ec9d4ab8a2e4079..5b163d034f1ee9b10c2a2b965992d22bac2ee5fc 100644 (file)
@@ -4,5 +4,5 @@ offset es_bspline_3d_p_nr_of es_bspline_3d_p_nr 1
 offset es_bspline_3d_p_nr_of_of es_bspline_3d_p_nr_of 1
 mkface result es_bspline_3d_p_nr_of_of 0 1 0 3
 set MaxFTol 9.9999999999999995e-08
-set MaxETol 3.0212868909361951e-07
-set MaxVTol 3.0212868909361962e-07
+set MaxETol 3.2685874571489216e-007
+set MaxVTol 3.2685874571489216e-007
index 91e3cb2adf9c5c933761c16ea9bb621b6737fce1..23f6d9ef34155c405162622a04b2e13b92e086b8 100644 (file)
@@ -2,6 +2,7 @@ beziercurve beziercurve_nr 3 0 0 0 2 2 2 4 5 2
 extsurf es_beziercurve_nr beziercurve_nr 0 0 1
 offset es_beziercurve_nr_of es_beziercurve_nr 1
 puts "TODO #23133 ALL: Error : Incorrect input parameters are not processed correctly"
+puts "REQUIRED All: Faulty shapes in variables faulty_1 to faulty"
 if { [catch { mkface result es_beziercurve_nr_of 0 3 0 30 } out] == 0 } {
   puts "Error : Incorrect input parameters are not processed correctly."
 }
index 29e1c1bf90d5702a5119ebb89b488ab6f6eee275..ee86c9418c387d52c16a5eb21fbe8fc5b6a15154 100644 (file)
@@ -3,6 +3,7 @@ extsurf es_beziercurve_nr beziercurve_nr 0 0 1
 offset es_beziercurve_nr_of es_beziercurve_nr 1
 offset es_beziercurve_nr_of_of es_beziercurve_nr_of 5
 puts "TODO #23133 ALL: Error : Incorrect input parameters are not processed correctly"
+puts "REQUIRED All: Faulty shapes in variables faulty_1 to faulty"
 if { [catch { mkface result es_beziercurve_nr_of_of 0 3 0 30 } out] == 0 } {
   puts "Error : Incorrect input parameters are not processed correctly."
 }
index aea8e92cc12f28f5a909a610e4f860ca26784154..eefb7d789c8bfd74ec20476cc53882b1f6c27f20 100644 (file)
@@ -2,6 +2,7 @@ beziercurve beziercurve_r 3 0 0 0 1 2 2 2 2 4 5 2 1
 extsurf es_beziercurve_r beziercurve_r 0 0 1
 offset es_beziercurve_r_of es_beziercurve_r 1
 puts "TODO #23133 ALL: Error : Incorrect input parameters are not processed correctly"
+puts "REQUIRED All: Faulty shapes in variables faulty_1 to faulty"
 if { [catch { mkface result es_beziercurve_r_of 0 3 0 30 } out] == 0 } {
   puts "Error : Incorrect input parameters are not processed correctly."
 }
index a6c4831baaaa5c927d9d4705e590b016781422aa..c29543ca42a758f571659334cb25f1514ac3606a 100644 (file)
@@ -3,6 +3,7 @@ extsurf es_beziercurve_r beziercurve_r 0 0 1
 offset es_beziercurve_r_of es_beziercurve_r 1
 offset es_beziercurve_r_of_of es_beziercurve_r_of 5
 puts "TODO #23133 ALL: Error : Incorrect input parameters are not processed correctly"
+puts "REQUIRED All: Faulty shapes in variables faulty_1 to faulty"
 if { [catch { mkface result es_beziercurve_r_of_of 0 3 0 30 } out] == 0 } {
   puts "Error : Incorrect input parameters are not processed correctly."
 }
index 05aed64a790d226929ecba5a78edbc7de924b30d..96047e17a575cbfaa55992e228b16e0517f87717 100644 (file)
@@ -1,5 +1,6 @@
 puts "TODO OCC26577 All: Error :  is WRONG because number of EDGE entities in shape"
 puts "TODO OCC26577 All: Error :  is WRONG because number of SHELL entities in shape"
+puts "REQUIRED All: Faulty shapes in variables faulty_1 to faulty"
 restore [locate_data_file bug26663_test_offset_L6.brep] s
 OFFSETSHAPE ${off_param} {} ${calcul} ${type}
 checknbshapes result -ref [lrange [nbshapes s] 8 19]
index 9494f7d3b773b44976e3712fa843f515e5520abd..71fa2ab75af319259d9589de80192ff5fe18ef1c 100644 (file)
@@ -1,5 +1,5 @@
-puts "TODO OCC26577 All: Error :  is WRONG because number of EDGE entities in shape"
-puts "TODO OCC26577 All: Error :  is WRONG because number of SHELL entities in shape"
+#puts "TODO OCC26577 All: Error :  is WRONG because number of EDGE entities in shape"
+#puts "TODO OCC26577 All: Error :  is WRONG because number of SHELL entities in shape"
 restore [locate_data_file bug26663_test_offset_N7.brep] s
 OFFSETSHAPE ${off_param} {} ${calcul} ${type}
 checknbshapes result -ref [lrange [nbshapes s] 8 19]
index 17d2101a91a9642dd186760b475002f51f202e9f..3daa0350009f12fefac77dd330d0e5f01ece4d71 100644 (file)
@@ -2,7 +2,7 @@ restore [locate_data_file CCH_indushej.rle] a
 
 sewing result $tol a
 
-checkmaxtol result -ref 0.014670260636369852
+checkmaxtol result -ref 0.010269182445458897
 checknbshapes result -shell 1
 checkfreebounds result 26
 checkfaults result a 0
index f7b147bb690501b80da3a428847f396e00831865..f08c612ea0afb10baf5fe975e9cd95998dc9c890 100644 (file)
@@ -1,9 +1,9 @@
-puts "TODO OCC24592 ALL: Error : Number of free edges is"
+#puts "TODO OCC24592 ALL: Error : Number of free edges is"
 restore [locate_data_file CCH_indusheq.rle] a
 
 sewing result $tol a
 
-checkmaxtol result -ref 0.014624921005106987
+checkmaxtol result -ref 0.0094066994984719748 
 checknbshapes result -shell 1
-checkfreebounds result 33
+checkfreebounds result 31
 checkfaults result a 2
index 6a46c567454afbd31c594a89c72d1605c6a9731b..945614c3c3f8dcb801dc25ec8341c0a1c9509e4c 100755 (executable)
@@ -2,7 +2,7 @@ restore [locate_data_file CIN001_a20.rle] a
 
 sewing result $tol a
 
-checkmaxtol result -ref 0.0035821432134069929
+checkmaxtol result -ref 0.0025075002493848949
 checknbshapes result -shell 1
 checkfreebounds result 74
 checkfaults result a 0
index 05c52f2ceeced9320ccafd6d52ba50b179e191af..110d7f16b7d4b1a4c088b70ad9f604ce680c4230 100644 (file)
@@ -2,7 +2,7 @@ restore [locate_data_file CFI_pro11907.rle] a
 
 sewing result $tol a
 
-checkmaxtol result -ref 119.7091229132561
+checkmaxtol result -ref 83.796386040226665
 checknbshapes result -shell 1
-checkfreebounds result 5
+checkfreebounds result 8
 checkfaults result a 0
index aee1cbeca611f1313d9a03d1b08d2d35909f735b..59b9a08bbadb60162e5eac76dc2461525b3f1ad4 100644 (file)
@@ -4,7 +4,7 @@ restore [locate_data_file CFI_pro15441.rle] a
 
 sewing result $tol a
 
-checkmaxtol result -ref 77.938759360032321
+checkmaxtol result -ref 72.971139124346976
 checknbshapes result -shell 1
 checkfreebounds result 4
 checkfaults result a 5
index 2b0e90824f96a68cdd2b3e22a89ed2b2a97a5352..09621ac2e6b3b450b2fc66f3452ffe73c563d09e 100755 (executable)
@@ -4,7 +4,7 @@ restore [locate_data_file CIN901_intcqhmj.rle] a
 
 sewing result $tol a
 
-checkmaxtol result -ref 71.039012505679182
+checkmaxtol result -ref 50.653334255238171
 checknbshapes result -shell 1
 checkfreebounds result 34
 checkfaults result a 3
index c5cb6dfeb14da85c6dd5ed8b6e311ec2c209eec0..ce3c0c243aaffc927607768344de676bcc3c2387 100755 (executable)
@@ -4,7 +4,7 @@ restore [locate_data_file CIN902_intcqhmm.rle] a
 
 sewing result $tol a
 
-checkmaxtol result -ref 4.30764e+001
+checkmaxtol result -ref 28.717617980682633
 checknbshapes result -shell 1
 checkfreebounds result 28
 checkfaults result a 11
index aa7901677a1b6bd24fa4acdeffac633b00086fbf..99445e9dcaa6953b346bbd9c968e2d7ec3cbdaf9 100644 (file)
@@ -4,7 +4,7 @@ restore [locate_data_file CIN902_intcqhmn.rle] a
 
 sewing result $tol a
 
-checkmaxtol result -ref 31.117378506550729
+checkmaxtol result -ref 32.67324743187833
 checknbshapes result -shell 1
 checkfreebounds result 47
 checkfaults result a 7
index b6d95b07f17fb0d7822de99856df5fcadb770cbe..6d6eb5a8bcb382afa202c933ebb83dc5aef42e28 100644 (file)
@@ -4,7 +4,7 @@ restore [locate_data_file CIN902_intcqhmo.rle] a
 
 sewing result $tol a
 
-checkmaxtol result -ref 31.117378506550729
+checkmaxtol result -ref 32.67324743187833
 checknbshapes result -shell 1
 checkfreebounds result 47
 checkfaults result a 7
index 2c8170d680e2747848f30a9fe68cec831f2273d9..08013456600c5c5c6d0932d4cb391830a2c6ff66 100755 (executable)
@@ -4,7 +4,7 @@ restore [locate_data_file CIN902_intcqhmp.rle] a
 
 sewing result $tol a
 
-checkmaxtol result -ref 122.47700432877426
+checkmaxtol result -ref 98.605773005137095
 checknbshapes result -shell 1
 checkfreebounds result 19
 checkfaults result a 7
index 5198e6cda4f8e1e66e726bf2561ef2802d7f5114..222c567d160d34bd7084e78ef08b1c3486db8665 100644 (file)
@@ -1,9 +1,9 @@
-puts "TODO OCC24592 ALL: Error : Number of free edges is"
+#puts "TODO OCC24592 ALL: Error : Number of free edges is"
 restore [locate_data_file CIN902_intcqhmr.rle] a
 
 sewing result $tol a
 
-checkmaxtol result -ref 103.91426175652668
+checkmaxtol result -ref 69.276181431972319
 checknbshapes result -shell 1
 checkfreebounds result 21
 checkfaults result a 7
index abb24952462ed9b8edee55e6bf3420474214ea0a..d22db11b011ef9dc0df9aba49ecc6148503a5401 100644 (file)
@@ -1,10 +1,10 @@
 puts "TODO OCC24592 ALL: Error : Number of faults is"
-puts "TODO OCC24592 ALL: Error : Number of free edges is"
+#puts "TODO OCC24592 ALL: Error : Number of free edges is"
 restore [locate_data_file CIN902_intcqhms.rle] a
 
 sewing result $tol a
 
-checkmaxtol result -ref 129.56600395440302
+checkmaxtol result -ref 92.086165513507652
 checknbshapes result -shell 1
-checkfreebounds result 53
+checkfreebounds result 46
 checkfaults result a 30
index 07e93e08df4eb83fe5683d2615435f8f87594114..d21f46d7d1fdcced48bed61dfccef4c99f4cc815 100644 (file)
@@ -1,10 +1,10 @@
 puts "TODO OCC24592 ALL: Error : Number of free edges is"
-puts "TODO OCC24592 ALL: Error : Number of faults is"
+#puts "TODO OCC24592 ALL: Error : Number of faults is"
 restore [locate_data_file CNP002_projoiep.rle] a
 
 sewing result $tol a
 
-checkmaxtol result -ref 2.81877e+001
+checkmaxtol result -ref  19.731382910922985
 checknbshapes result -shell 1
 checkfreebounds result 15
 checkfaults result a 1
index a6b52d19cfb6b6d9d3ca51d0dbabb52631ce99e6..ca661abbe0f0ec9f83dffd1566cecc2996e90653 100644 (file)
@@ -2,7 +2,7 @@ restore [locate_data_file CNP002_projoier.rle] a
 
 sewing result $tol a
 
-checkmaxtol result -ref 106.44142183190296
+checkmaxtol result -ref 70.960954984042459
 checknbshapes result -shell 1
 checkfreebounds result 39
 checkfaults result a 0
index e8cc7af5a4be680047163a6c2a67e9e10ce7f3cd..8458403b4bbfba6e1e0f397a6e644a324b88ccde 100755 (executable)
@@ -2,7 +2,7 @@ restore [locate_data_file ma-test3.rle] a
 
 sewing result $tol a
 
-checkmaxtol result -ref 1.75025e+002
+checkmaxtol result -ref 99.599628445249778
 checknbshapes result -shell 1
-checkfreebounds result 0
+checkfreebounds result 2
 checkfaults result a 0
index 705dcda5bb20dc4087c6b2b9be9f2b74614cd2d8..d468bc8e47c298e6e35e8911dc1651d26ed3f731 100755 (executable)
@@ -2,7 +2,7 @@ restore [locate_data_file ma-test5.rle] a
 
 sewing result $tol a
 
-checkmaxtol result -ref 1.57832e+000
+checkmaxtol result -ref 1.54111715485806
 checknbshapes result -shell 1
 checkfreebounds result 0
 checkfaults result a 0
index b68283aa83453f7f170de1d8f426a13e291cf634..78c97e9015754cd17f578f004fa99d2315144e3e 100644 (file)
@@ -2,7 +2,7 @@ restore [locate_data_file CTO904_pro10095b.rle] a
 
 sewing result $tol a
 
-checkmaxtol result -ref 114.90666646781224
+checkmaxtol result -ref 80.434666527468579
 checknbshapes result -shell 1
 checkfreebounds result 4
 checkfaults result a 0