From b92f35729a96e19de410ab4284e80ff1c2106f41 Mon Sep 17 00:00:00 2001 From: nbv Date: Wed, 5 Mar 2014 16:54:38 +0400 Subject: [PATCH] 0024612: Wrong pcurve of the section curve Main changes are in "IntWalk_IWalking::TestDeflection(...)" function (IntWalk_IWalking_5.gxx). Some test cases were corrected according to their new behavior. --- src/GeomInt/GeomInt_LineConstructor.cxx | 34 +- .../GeometryTest_CurveCommands.cxx | 227 ++++---- src/IntImp/IntImp_ZerImpFunc.gxx | 2 +- src/IntPatch/IntPatch_Intersection.cxx | 5 +- src/IntWalk/IntWalk_IWalking.cdl | 2 - src/IntWalk/IntWalk_IWalking_1.gxx | 12 +- src/IntWalk/IntWalk_IWalking_3.gxx | 538 +++++++++--------- src/IntWalk/IntWalk_IWalking_4.gxx | 401 ++++++------- src/IntWalk/IntWalk_IWalking_5.gxx | 318 ++++++----- src/IntWalk/IntWalk_PWalking_1.gxx | 2 +- tests/boolean/bfuse_complex/O5 | 4 +- tests/boolean/bfuse_complex/O6 | 4 +- tests/boolean/bfuse_complex/P1 | 4 +- tests/boolean/boptuc_complex/D5 | 4 +- tests/bugs/modalg_4/fra62369 | 2 +- tests/bugs/modalg_5/bug23952_2 | 2 +- tests/bugs/modalg_5/bug24612 | 82 +++ tests/bugs/moddata_1/bug13 | 6 +- tests/feat/featprism/C4 | 6 +- 19 files changed, 889 insertions(+), 766 deletions(-) create mode 100644 tests/bugs/modalg_5/bug24612 diff --git a/src/GeomInt/GeomInt_LineConstructor.cxx b/src/GeomInt/GeomInt_LineConstructor.cxx index 88710920aa..04e8a2382d 100644 --- a/src/GeomInt/GeomInt_LineConstructor.cxx +++ b/src/GeomInt/GeomInt_LineConstructor.cxx @@ -197,7 +197,7 @@ void GeomInt_LineConstructor::Perform(const Handle(IntPatch_Line)& L) Standard_Real aSQDist = aP1.SquareDistance(aP2); aSQDist = Max(aSQDist, aP1.SquareDistance(Pmid)); aSQDist = Max(aSQDist, aP2.SquareDistance(Pmid)); - + Standard_Boolean isMicro = aSQDist*100.0 < Tol; if((Abs(firstp-lastp)>Precision::PConfusion()) && !isMicro) @@ -261,6 +261,38 @@ void GeomInt_LineConstructor::Perform(const Handle(IntPatch_Line)& L) Standard_Boolean isMicro = aSQDist*100.0 < Tol; + if(isMicro) + {//3D-dimension is small. Checking 2D-dimension + aSQDist = 0.0; + Standard_Real u1f, v1f, u2f, v2f; + Standard_Real u1l, v1l, u2l, v2l; + Standard_Real u1m, v1m, u2m, v2m; + + WLine->Point(RealToInt(firstp)).Parameters(u1f, v1f, u2f, v2f); + WLine->Point(RealToInt(lastp)).Parameters(u1l, v1l, u2l, v2l); + WLine->Point(pmid).Parameters(u1m, v1m, u2m, v2m); + + Standard_Real aDelta = u1m - u1f; + aSQDist += aDelta*aDelta; + aDelta = v1m - v1f; + aSQDist += aDelta*aDelta; + aDelta = u2m - u2f; + aSQDist += aDelta*aDelta; + aDelta = v2m - v2f; + aSQDist += aDelta*aDelta; + + aDelta = u1m - u1l; + aSQDist += aDelta*aDelta; + aDelta = v1m - v1l; + aSQDist += aDelta*aDelta; + aDelta = u2m - u2l; + aSQDist += aDelta*aDelta; + aDelta = v2m - v2l; + aSQDist += aDelta*aDelta; + + isMicro = aSQDist*100.0 < Tol; + } + if((Abs(firstp-lastp)>Precision::PConfusion()) && !isMicro) { Pmid.Parameters(u1,v1,u2,v2); diff --git a/src/GeometryTest/GeometryTest_CurveCommands.cxx b/src/GeometryTest/GeometryTest_CurveCommands.cxx index 529892392e..4a34517624 100644 --- a/src/GeometryTest/GeometryTest_CurveCommands.cxx +++ b/src/GeometryTest/GeometryTest_CurveCommands.cxx @@ -762,68 +762,68 @@ static Standard_Integer bisec (Draw_Interpretor& di, static Standard_Integer movelaw (Draw_Interpretor& di, Standard_Integer n, const char** a) { Standard_Integer - ii, - condition=0, - error_status ; + ii, + condition=0, + error_status ; Standard_Real u, - x, - tolerance, - tx ; + x, + tolerance, + tx ; u = Draw::Atof(a[2]); x = Draw::Atof(a[3]); tolerance = 1.0e-5 ; if (n < 5) { - return 1 ; + return 1 ; } Handle(Geom2d_BSplineCurve) G2 = DrawTrSurf::GetBSplineCurve2d(a[1]); if (!G2.IsNull()) { - tx = Draw::Atof(a[4]) ; - if (n == 6) { - condition = Max(Draw::Atoi(a[5]), -1) ; - condition = Min(condition, G2->Degree()-1) ; - } - TColgp_Array1OfPnt2d curve_poles(1,G2->NbPoles()) ; - TColStd_Array1OfReal law_poles(1,G2->NbPoles()) ; - TColStd_Array1OfReal law_knots(1,G2->NbKnots()) ; - TColStd_Array1OfInteger law_mults(1,G2->NbKnots()) ; - - G2->Knots(law_knots) ; - G2->Multiplicities(law_mults) ; - G2->Poles(curve_poles) ; - for (ii = 1 ; ii <= G2->NbPoles() ; ii++) { - law_poles(ii) = curve_poles(ii).Coord(2) ; - } - - Law_BSpline a_law(law_poles, - law_knots, - law_mults, - G2->Degree(), - Standard_False) ; - - a_law.MovePointAndTangent(u, - x, - tx, - tolerance, - condition, - condition, - error_status) ; - - for (ii = 1 ; ii <= G2->NbPoles() ; ii++) { - curve_poles(ii).SetCoord(2,a_law.Pole(ii)) ; - G2->SetPole(ii,curve_poles(ii)) ; - } - - - if (! error_status) { - Draw::Repaint(); - } - else { - di << "Not enought degree of freedom increase degree please" << "\n"; - } - - + tx = Draw::Atof(a[4]) ; + if (n == 6) { + condition = Max(Draw::Atoi(a[5]), -1) ; + condition = Min(condition, G2->Degree()-1) ; } + TColgp_Array1OfPnt2d curve_poles(1,G2->NbPoles()) ; + TColStd_Array1OfReal law_poles(1,G2->NbPoles()) ; + TColStd_Array1OfReal law_knots(1,G2->NbKnots()) ; + TColStd_Array1OfInteger law_mults(1,G2->NbKnots()) ; + + G2->Knots(law_knots) ; + G2->Multiplicities(law_mults) ; + G2->Poles(curve_poles) ; + for (ii = 1 ; ii <= G2->NbPoles() ; ii++) { + law_poles(ii) = curve_poles(ii).Coord(2) ; + } + + Law_BSpline a_law(law_poles, + law_knots, + law_mults, + G2->Degree(), + Standard_False) ; + + a_law.MovePointAndTangent(u, + x, + tx, + tolerance, + condition, + condition, + error_status) ; + + for (ii = 1 ; ii <= G2->NbPoles() ; ii++) { + curve_poles(ii).SetCoord(2,a_law.Pole(ii)) ; + G2->SetPole(ii,curve_poles(ii)) ; + } + + + if (! error_status) { + Draw::Repaint(); + } + else { + di << "Not enought degree of freedom increase degree please" << "\n"; + } + + + } return 0; } @@ -1422,20 +1422,21 @@ static Standard_Integer surfpoints (Draw_Interpretor& /*di*/, Standard_Integer / //function : intersect //purpose : //======================================================================= -static Standard_Integer intersection (Draw_Interpretor& di, Standard_Integer n, const char** a) - { +static Standard_Integer intersection (Draw_Interpretor& di, + Standard_Integer n, const char** a) +{ if (n < 4) return 1; - + // Handle(Geom_Curve) GC1; Handle(Geom_Surface) GS1 = DrawTrSurf::GetSurface(a[2]); if (GS1.IsNull()) - { + { GC1 = DrawTrSurf::GetCurve(a[2]); if (GC1.IsNull()) return 1; - } + } // Handle(Geom_Surface) GS2 = DrawTrSurf::GetSurface(a[3]); @@ -1450,108 +1451,108 @@ static Standard_Integer intersection (Draw_Interpretor& di, Standard_Integer n, // Handle(Geom_Curve) Result; gp_Pnt Point; - + // if (GC1.IsNull()) - { + { GeomInt_IntSS Inters; // // Surface Surface if (n <= 5) - { + { // General case Inters.Perform(GS1,GS2,tol,Standard_True); - } + } else if (n == 8 || n == 9 || n == 12 || n == 13 || n == 16 || n == 17) - { + { Standard_Boolean useStart = Standard_True, useBnd = Standard_True; Standard_Integer ista1=0,ista2=0,ibnd1=0,ibnd2=0; Standard_Real UVsta[4]; Handle(GeomAdaptor_HSurface) AS1,AS2; - + // if (n <= 9) // user starting point - { + { useBnd = Standard_False; ista1 = 4; ista2 = 7; - } + } else if (n <= 13) // user bounding - { + { useStart = Standard_False; ibnd1 = 4; ibnd2 = 11; - } + } else // both user starting point and bounding - { + { ista1 = 4; ista2 = 7; ibnd1 = 8; ibnd2 = 15; - } + } if (useStart) - { + { for (Standard_Integer i=ista1; i <= ista2; i++) - { + { UVsta[i-ista1] = Draw::Atof(a[i]); - } } + } if (useBnd) - { + { Standard_Real UVbnd[8]; for (Standard_Integer i=ibnd1; i <= ibnd2; i++) UVbnd[i-ibnd1] = Draw::Atof(a[i]); AS1 = new GeomAdaptor_HSurface(GS1,UVbnd[0],UVbnd[1],UVbnd[2],UVbnd[3]); AS2 = new GeomAdaptor_HSurface(GS2,UVbnd[4],UVbnd[5],UVbnd[6],UVbnd[7]); - } + } // if (useStart && !useBnd) - { - Inters.Perform(GS1,GS2,tol,UVsta[0],UVsta[1],UVsta[2],UVsta[3]); - } - else if (!useStart && useBnd) - { - Inters.Perform(AS1,AS2,tol); - } - else - { - Inters.Perform(AS1,AS2,tol,UVsta[0],UVsta[1],UVsta[2],UVsta[3]); - } - }//else if (n == 8 || n == 9 || n == 12 || n == 13 || n == 16 || n == 17) - else { + Inters.Perform(GS1,GS2,tol,UVsta[0],UVsta[1],UVsta[2],UVsta[3]); + } + else if (!useStart && useBnd) + { + Inters.Perform(AS1,AS2,tol); + } + else + { + Inters.Perform(AS1,AS2,tol,UVsta[0],UVsta[1],UVsta[2],UVsta[3]); + } + }//else if (n == 8 || n == 9 || n == 12 || n == 13 || n == 16 || n == 17) + else + { di<<"incorrect number of arguments"<<"\n"; return 1; - } + } // if (!Inters.IsDone()) - { + { di<<"No intersections found!"<<"\n"; return 1; - } - + } + // char buf[1024]; Standard_Integer i, aNbLines, aNbPoints; - + // aNbLines = Inters.NbLines(); if (aNbLines >= 2) - { + { for (i=1; i<=aNbLines; ++i) - { + { Sprintf(buf, "%s_%d",a[1],i); di << buf << " "; Result = Inters.Line(i); const char* temp = buf; DrawTrSurf::Set(temp,Result); - } } + } else if (aNbLines == 1) - { + { Result = Inters.Line(1); Sprintf(buf,"%s",a[1]); di << buf << " "; @@ -1561,25 +1562,25 @@ static Standard_Integer intersection (Draw_Interpretor& di, Standard_Integer n, // aNbPoints=Inters.NbPoints(); for (i=1; i<=aNbPoints; ++i) - { + { Point=Inters.Point(i); Sprintf(buf,"%s_p_%d",a[1],i); di << buf << " "; const char* temp = buf; DrawTrSurf::Set(temp, Point); - } - }// if (GC1.IsNull()) + } + }// if (GC1.IsNull()) else - { + { // Curve Surface GeomAPI_IntCS Inters(GC1,GS2); - + // if (!Inters.IsDone()) - { + { di<<"No intersections found!"<<"\n"; return 1; - } + } Standard_Integer nblines = Inters.NbSegments(); Standard_Integer nbpoints = Inters.NbPoints(); @@ -1587,7 +1588,7 @@ static Standard_Integer intersection (Draw_Interpretor& di, Standard_Integer n, char newname[1024]; if ( (nblines+nbpoints) >= 2) - { + { Standard_Integer i; Standard_Integer Compt = 1; @@ -1595,13 +1596,13 @@ static Standard_Integer intersection (Draw_Interpretor& di, Standard_Integer n, cout << " Lines: " << endl; for (i = 1; i <= nblines; i++, Compt++) - { + { Sprintf(newname,"%s_%d",a[1],Compt); di << newname << " "; Result = Inters.Segment(i); const char* temp = newname; // pour portage WNT DrawTrSurf::Set(temp,Result); - } + } if(nbpoints >= 1) cout << " Points: " << endl; @@ -1609,33 +1610,33 @@ static Standard_Integer intersection (Draw_Interpretor& di, Standard_Integer n, const Standard_Integer imax = nblines+nbpoints; for (/*i = 1*/; i <= imax; i++, Compt++) - { + { Sprintf(newname,"%s_%d",a[1],i); di << newname << " "; Point = Inters.Point(i); const char* temp = newname; // pour portage WNT DrawTrSurf::Set(temp,Point); - } } + } else if (nblines == 1) - { + { Result = Inters.Segment(1); Sprintf(newname,"%s",a[1]); di << newname << " "; DrawTrSurf::Set(a[1],Result); - } + } else if (nbpoints == 1) - { + { Point = Inters.Point(1); Sprintf(newname,"%s",a[1]); di << newname << " "; DrawTrSurf::Set(a[1],Point); - } } + } dout.Flush(); return 0; - } +} //======================================================================= //function : CurveCommands diff --git a/src/IntImp/IntImp_ZerImpFunc.gxx b/src/IntImp/IntImp_ZerImpFunc.gxx index d805625a0b..ef6e231694 100644 --- a/src/IntImp/IntImp_ZerImpFunc.gxx +++ b/src/IntImp/IntImp_ZerImpFunc.gxx @@ -122,7 +122,7 @@ Standard_Boolean IntImp_ZerImpFunc::IsTangent() d3d.SetLinearForm(tgdu,d1u,tgdv,d1v); d2d = gp_Dir2d(tgdu, tgdv); if (d3d.Magnitude() <= Tolpetit) { // jag - tangent = Standard_True; + tangent = Standard_True; } } } diff --git a/src/IntPatch/IntPatch_Intersection.cxx b/src/IntPatch/IntPatch_Intersection.cxx index 5d43ec6dfe..d3da07067a 100644 --- a/src/IntPatch/IntPatch_Intersection.cxx +++ b/src/IntPatch/IntPatch_Intersection.cxx @@ -1420,13 +1420,14 @@ void IntPatch_Intersection::GeomParamPerfom(const Handle(Adaptor3d_HSurface)& t if (!empt) { - for(Standard_Integer i = 1; i <= interip.NbLines(); i++) + const Standard_Integer aNbLines = interip.NbLines(); + for(Standard_Integer i = 1; i <= aNbLines; i++) { if(interip.Line(i)->ArcType() != IntPatch_Walking) slin.Append(interip.Line(i)); } - for(Standard_Integer i = 1; i <= interip.NbLines(); i++) + for(Standard_Integer i = 1; i <= aNbLines; i++) { if(interip.Line(i)->ArcType() == IntPatch_Walking) slin.Append(interip.Line(i)); diff --git a/src/IntWalk/IntWalk_IWalking.cdl b/src/IntWalk/IntWalk_IWalking.cdl index 3aea7d5316..a82a04863b 100644 --- a/src/IntWalk/IntWalk_IWalking.cdl +++ b/src/IntWalk/IntWalk_IWalking.cdl @@ -294,7 +294,5 @@ fields previousd2d : Dir2d from gp; seqAjout : SequenceOfInteger from TColStd; lines : SequenceOfIWLine; - NbPointsConfondusConsecutifs: Integer from Standard; - EpsilonSembleTropGrand : Integer from Standard; end IWalking; diff --git a/src/IntWalk/IntWalk_IWalking_1.gxx b/src/IntWalk/IntWalk_IWalking_1.gxx index 8c1b004098..b960c5afa9 100644 --- a/src/IntWalk/IntWalk_IWalking_1.gxx +++ b/src/IntWalk/IntWalk_IWalking_1.gxx @@ -31,9 +31,7 @@ IntWalk_IWalking::IntWalk_IWalking (const Standard_Real Epsilon, epsilon(Epsilon*Epsilon), wd1 (IntWalk_VectorOfWalkingData::allocator_type (new NCollection_IncAllocator)), wd2 (wd1.get_allocator()), - nbMultiplicities (wd1.get_allocator()), - NbPointsConfondusConsecutifs(0), - EpsilonSembleTropGrand(0) + nbMultiplicities (wd1.get_allocator()) { } @@ -161,9 +159,13 @@ void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1, Func.Set(Caro); // calculation of all open lines - if (nbPnts1 != 0) ComputeOpenLine(Umult,Vmult,Pnts1,Func,Rajout); + if (nbPnts1 != 0) + ComputeOpenLine(Umult,Vmult,Pnts1,Func,Rajout); + // calculation of all closed lines - if (nbPnts2 != 0) ComputeCloseLine(Umult,Vmult,Pnts1,Pnts2,Func,Rajout); + if (nbPnts2 != 0) + ComputeCloseLine(Umult,Vmult,Pnts1,Pnts2,Func,Rajout); + for (I = 1; I <= nbPnts1; I++) { if (wd1[I].etat >0) seqSingle.Append(Pnts1(I)); } diff --git a/src/IntWalk/IntWalk_IWalking_3.gxx b/src/IntWalk/IntWalk_IWalking_3.gxx index bb790e68e9..6bc7b7a133 100644 --- a/src/IntWalk/IntWalk_IWalking_3.gxx +++ b/src/IntWalk/IntWalk_IWalking_3.gxx @@ -118,27 +118,27 @@ void IntWalk_IWalking::ComputeOpenLine(const TColStd_SequenceOfReal& Umult, CurrentLine->AddPoint(previousPoint); // modified by NIZHNY-MKK Fri Oct 27 12:34:32 2000.BEGIN if(movementdirectioninfo[I] !=0) { - if(movementdirectioninfo[I] < 0) { - StepSign = -1; - CurrentLine->SetTangentVector(previousd3d.Reversed(),1); - } else { - StepSign = 1; - CurrentLine->SetTangentVector(previousd3d,1); - } + if(movementdirectioninfo[I] < 0) { + StepSign = -1; + CurrentLine->SetTangentVector(previousd3d.Reversed(),1); + } else { + StepSign = 1; + CurrentLine->SetTangentVector(previousd3d,1); + } } else { - Standard_Real tyutuyt=ThePointOfPathTool::Direction3d(PathPnt) * previousd3d; - if( tyutuyt < 0) { - StepSign = -1; - CurrentLine->SetTangentVector(previousd3d.Reversed(),1); - } - else { - StepSign = 1; - CurrentLine->SetTangentVector(previousd3d,1); - } + Standard_Real tyutuyt=ThePointOfPathTool::Direction3d(PathPnt) * previousd3d; + if( tyutuyt < 0) { + StepSign = -1; + CurrentLine->SetTangentVector(previousd3d.Reversed(),1); + } + else { + StepSign = 1; + CurrentLine->SetTangentVector(previousd3d,1); + } } // modified by NIZHNY-MKK Fri Oct 27 12:34:37 2000.END -// Modified by Sergey KHROMOV - Tue Nov 20 10:41:45 2001 Begin + // Modified by Sergey KHROMOV - Tue Nov 20 10:41:45 2001 Begin wd1[I].etat = - abs(wd1[I].etat); movementdirectioninfo[I] = (movementdirectioninfo[I]==0) ? StepSign : 0; // Modified by Sergey KHROMOV - Tue Nov 20 10:41:56 2001 End @@ -146,13 +146,13 @@ void IntWalk_IWalking::ComputeOpenLine(const TColStd_SequenceOfReal& Umult, Standard_Real d2dx = Abs(previousd2d.X()); Standard_Real d2dy = Abs(previousd2d.Y()); if (d2dx < tolerance(1)) { - PasC = pas * (VM-Vm)/d2dy; + PasC = pas * (VM-Vm)/d2dy; } else if (d2dy < tolerance(2)) { - PasC = pas * (UM-Um)/d2dx; + PasC = pas * (UM-Um)/d2dx; } else { - PasC = pas * Min((UM-Um)/d2dx,(VM-Vm)/d2dy); + PasC = pas * Min((UM-Um)/d2dx,(VM-Vm)/d2dy); } Arrive = Standard_False; @@ -161,274 +161,280 @@ void IntWalk_IWalking::ComputeOpenLine(const TColStd_SequenceOfReal& Umult, StatusPrecedent = IntWalk_OK; // modified by NIZHNY-MKK Fri Oct 27 12:39:37 2000 Standard_Integer IndexOfPathPointDoNotCheck=0; - + Standard_Integer aNbIter = 10; while (!Arrive) { // as one of stop tests is not checked - - Cadre = Cadrage(BornInf,BornSup,UVap,PasC,StepSign); - // Border? + Cadre = Cadrage(BornInf,BornSup,UVap,PasC,StepSign); + // Border? #ifdef CHRONO - Chronrsnld.Start(); + Chronrsnld.Start(); #endif - Rsnld.Perform(Func,UVap,BornInf,BornSup); + Rsnld.Perform(Func,UVap,BornInf,BornSup); #ifdef CHRONO - Chronrsnld.Stop(); + Chronrsnld.Stop(); #endif - if (Cadre) { - BornInf(1) = Um; BornSup(1) = UM; BornInf(2) = Vm; BornSup(2) = VM; - } - if (Rsnld.IsDone()) { - if (Abs(Func.Root()) > Func.Tolerance()) { - PasC = PasC / 2.0; - PasCu = Abs(PasC*previousd2d.X()); - PasCv = Abs(PasC*previousd2d.Y()); - if (PasCu <= tolerance(1) && PasCv <= tolerance(2)) { - if (CurrentLine->NbPoints() == 1) break; - Arrive = Standard_True; - CurrentLine->AddStatusLast(Standard_False); - Tgtend = Standard_True; // check + if (Cadre) { + BornInf(1) = Um; BornSup(1) = UM; BornInf(2) = Vm; BornSup(2) = VM; + } + if (Rsnld.IsDone()) { + if (Abs(Func.Root()) > Func.Tolerance()) { + PasC = PasC / 2.0; + PasCu = Abs(PasC*previousd2d.X()); + PasCv = Abs(PasC*previousd2d.Y()); + if (PasCu <= tolerance(1) && PasCv <= tolerance(2)) { + if (CurrentLine->NbPoints() == 1) break; + Arrive = Standard_True; + CurrentLine->AddStatusLast(Standard_False); + Tgtend = Standard_True; // check Rajout = Standard_True; - seqAjout.Append(lines.Length() + 1); - } - } - else { // test stop - Rsnld.Root(UVap); - Arrive = TestArretPassage(Umult, Vmult, Func, UVap, N); - if (Arrive) { - Cadre = Standard_False; - //in case if there is a frame and arrive at the same time - } - else { - if (Rajout) { - ArretAjout =TestArretAjout(Func, UVap, N, Psol); - if (ArretAjout) { - // jag 940615 - Tgtend = lines.Value(N)->IsTangentAtEnd(); - N = -N; - } - } - // modified by NIZHNY-MKK Thu Nov 2 15:09:08 2000.BEGIN - if(!(Rajout && ArretAjout)) { - Standard_Real prevUp, prevVp; - if (!reversed) { - previousPoint.ParametersOnS2(prevUp, prevVp); - } - else { - previousPoint.ParametersOnS1(prevUp, prevVp); - } - Arrive = TestPassedSolutionWithNegativeState(wd1, Umult, Vmult, prevUp, prevVp, - nbMultiplicities, tolerance, Func, UVap, N); - if(Arrive) { - Cadre = Standard_False; - } - } - // modified by NIZHNY-MKK Thu Nov 2 15:09:13 2000.END - if (!ArretAjout && Cadre) { - if (CurrentLine->NbPoints() == 1) break; // cancel the line - TestArretCadre(Umult, Vmult, CurrentLine, Func, UVap, N); -// if (N == 0) { - if (N <= 0) { // jag 941017 - MakeWalkingPoint(2, UVap(1), UVap(2), Func, Psol); - Tgtend = Func.IsTangent(); + seqAjout.Append(lines.Length() + 1); + } + } + else { // test stop + Rsnld.Root(UVap); + Arrive = TestArretPassage(Umult, Vmult, Func, UVap, N); + if (Arrive) { + Cadre = Standard_False; + //in case if there is a frame and arrive at the same time + } + else { + if (Rajout) { + ArretAjout =TestArretAjout(Func, UVap, N, Psol); + if (ArretAjout) { + // jag 940615 + Tgtend = lines.Value(N)->IsTangentAtEnd(); N = -N; - } - } - } - Status = TestDeflection(Func, Arrive, UVap, StatusPrecedent, - NbDivision,PasC,StepSign); - StatusPrecedent = Status; - if (Status == IntWalk_PasTropGrand) { - Arrive = Standard_False; - ArretAjout = Standard_False; - Tgtend = Standard_False; // jag 940615 - if (!reversed) { - previousPoint.ParametersOnS2(UVap(1), UVap(2)); - } - else { - previousPoint.ParametersOnS1(UVap(1), UVap(2)); - } - } - else if (ArretAjout || Cadre) { - Arrive = Standard_True; - CurrentLine->AddStatusLast(Standard_False); - if (Status != IntWalk_ArretSurPointPrecedent) { - CurrentLine->AddPoint(Psol); - } - if (Cadre && N==0) { - Rajout = Standard_True; - seqAjout.Append(lines.Length()+1); - } - } - else if (Status == IntWalk_ArretSurPointPrecedent) { - if (CurrentLine->NbPoints() == 1) { //cancel the line - Arrive = Standard_False; - break; - } - Arrive = Standard_True; - Rajout = Standard_True; + } + } + // modified by NIZHNY-MKK Thu Nov 2 15:09:08 2000.BEGIN + if(!(Rajout && ArretAjout)) { + Standard_Real prevUp, prevVp; + if (!reversed) { + previousPoint.ParametersOnS2(prevUp, prevVp); + } + else { + previousPoint.ParametersOnS1(prevUp, prevVp); + } + Arrive = TestPassedSolutionWithNegativeState(wd1, Umult, Vmult, prevUp, prevVp, + nbMultiplicities, tolerance, Func, UVap, N); + if(Arrive) { + Cadre = Standard_False; + } + } + // modified by NIZHNY-MKK Thu Nov 2 15:09:13 2000.END + if (!ArretAjout && Cadre) { + if (CurrentLine->NbPoints() == 1) break; // cancel the line + TestArretCadre(Umult, Vmult, CurrentLine, Func, UVap, N); + // if (N == 0) { + if (N <= 0) { // jag 941017 + MakeWalkingPoint(2, UVap(1), UVap(2), Func, Psol); + Tgtend = Func.IsTangent(); + N = -N; + } + } + } + Status = TestDeflection(Func, Arrive, UVap, StatusPrecedent, + NbDivision,PasC,StepSign); + StatusPrecedent = Status; + if (Status == IntWalk_PasTropGrand) { + Arrive = Standard_False; + ArretAjout = Standard_False; + Tgtend = Standard_False; // jag 940615 + if (!reversed) { + previousPoint.ParametersOnS2(UVap(1), UVap(2)); + } + else { + previousPoint.ParametersOnS1(UVap(1), UVap(2)); + } + } + else if (ArretAjout || Cadre) { + Arrive = Standard_True; + CurrentLine->AddStatusLast(Standard_False); + if (Status != IntWalk_ArretSurPointPrecedent) { + CurrentLine->AddPoint(Psol); + } + if (Cadre && N==0) { + Rajout = Standard_True; + seqAjout.Append(lines.Length()+1); + } + } + else if (Status == IntWalk_ArretSurPointPrecedent) { + if (CurrentLine->NbPoints() == 1) { //cancel the line + Arrive = Standard_False; + break; + } + Arrive = Standard_True; + Rajout = Standard_True; seqAjout.Append(lines.Length() + 1); - CurrentLine->AddStatusLast(Standard_False); - Tgtend = Standard_True; // check - } - else if (Arrive) { - if (CurrentLine->NbPoints() == 1 && // cancel the line - (N == I || Status == IntWalk_PointConfondu) ) { - // if N == I the main uv is probably lost - // or the point is a point of accumulation - // if point is confused the start data is bad - Arrive = Standard_False; - break; - } - // necessairily N > 0 jag 940617 + CurrentLine->AddStatusLast(Standard_False); + Tgtend = Standard_True; // check + } + else if (Arrive) { + if (CurrentLine->NbPoints() == 1 && // cancel the line + (N == I || Status == IntWalk_PointConfondu) ) { + // if N == I the main uv is probably lost + // or the point is a point of accumulation + // if point is confused the start data is bad + Arrive = Standard_False; + break; + } + // necessairily N > 0 jag 940617 // point of stop given at input - PathPnt = Pnts1.Value(N); - - Standard_Integer etat1N=wd1[N].etat; - // modified by NIZHNY-MKK Thu Nov 2 15:09:51 2000.BEGIN - // if (etat1N < 11) { // passing point that is a stop - if (Abs(etat1N) < 11) { // passing point that is a stop - // modified by NIZHNY-MKK Thu Nov 2 15:12:11 2000.END - if (Status == IntWalk_ArretSurPoint) { - CurrentLine->AddStatusLast(Standard_False); - Tgtend = Standard_True; // need check - } - else { - Arrive = Standard_False; - } - CurrentLine->AddIndexPassing(N); - } - else { // point of stop given at input - if (etat1N == 11) { - Tgtend = Standard_True; - } - CurrentLine->AddStatusLast(Standard_True, N, PathPnt); - } - AddPointInCurrentLine(N,PathPnt,CurrentLine); - if ((etat1N != 1 && etat1N != 11)) { - // modified by NIZHNY-MKK Fri Oct 27 12:43:05 2000.BEGIN - // wd1[N].etat= - wd1[N].etat; - wd1[N].etat = - Abs(etat1N); - movementdirectioninfo[N] = (movementdirectioninfo[N]==0) ? StepSign : 0; - if(Arrive && movementdirectioninfo[N]!=0) { - IndexOfPathPointDoNotCheck = N; - } + PathPnt = Pnts1.Value(N); - if(Arrive) { - Rajout = Standard_True; - seqAjout.Append(lines.Length() + 1); - } - // modified by NIZHNY-MKK Fri Oct 27 12:45:33 2000.END - } - } - else if (Status == IntWalk_ArretSurPoint) { - Arrive = Standard_True; - CurrentLine->AddStatusLast(Standard_False); - Tgtend = Standard_True; + Standard_Integer etat1N=wd1[N].etat; + // modified by NIZHNY-MKK Thu Nov 2 15:09:51 2000.BEGIN + // if (etat1N < 11) { // passing point that is a stop + if (Abs(etat1N) < 11) { // passing point that is a stop + // modified by NIZHNY-MKK Thu Nov 2 15:12:11 2000.END + if (Status == IntWalk_ArretSurPoint) { + CurrentLine->AddStatusLast(Standard_False); + Tgtend = Standard_True; // need check + } + else { + Arrive = Standard_False; + } + CurrentLine->AddIndexPassing(N); + } + else { // point of stop given at input + if (etat1N == 11) { + Tgtend = Standard_True; + } + CurrentLine->AddStatusLast(Standard_True, N, PathPnt); + } + AddPointInCurrentLine(N,PathPnt,CurrentLine); + if ((etat1N != 1 && etat1N != 11)) { + // modified by NIZHNY-MKK Fri Oct 27 12:43:05 2000.BEGIN + // wd1[N].etat= - wd1[N].etat; + wd1[N].etat = - Abs(etat1N); + movementdirectioninfo[N] = (movementdirectioninfo[N]==0) ? StepSign : 0; + if(Arrive && movementdirectioninfo[N]!=0) { + IndexOfPathPointDoNotCheck = N; + } + + if(Arrive) { + Rajout = Standard_True; + seqAjout.Append(lines.Length() + 1); + } + // modified by NIZHNY-MKK Fri Oct 27 12:45:33 2000.END + } + } + else if (Status == IntWalk_ArretSurPoint) { + Arrive = Standard_True; + CurrentLine->AddStatusLast(Standard_False); + Tgtend = Standard_True; MakeWalkingPoint(1, UVap(1), UVap(2), Func, Psol); - CurrentLine->AddPoint(Psol); - Rajout = Standard_True; + CurrentLine->AddPoint(Psol); + Rajout = Standard_True; seqAjout.Append(lines.Length() + 1); - } - else if (Status == IntWalk_OK) { + } + else if (Status == IntWalk_OK) { MakeWalkingPoint(2, UVap(1), UVap(2), Func, previousPoint); - previousd3d = Func.Direction3d(); - previousd2d = Func.Direction2d(); - CurrentLine->AddPoint(previousPoint); - } - } - } - else { // no numerical solution - PasC = PasC / 2.; - PasCu = Abs(PasC*previousd2d.X()); - PasCv = Abs(PasC*previousd2d.Y()); - if (PasCu <= tolerance(1) && PasCv <= tolerance(2)) { - if (CurrentLine->NbPoints()==1) break; - Arrive = Standard_True; - CurrentLine->AddStatusLast(Standard_False); - Tgtend = Standard_True; // need check - Rajout = Standard_True; + previousd3d = Func.Direction3d(); + previousd2d = Func.Direction2d(); + CurrentLine->AddPoint(previousPoint); + } + else if (Status == IntWalk_PointConfondu) + { + aNbIter --; + } + } + } + else { // no numerical solution + PasC = PasC / 2.; + PasCu = Abs(PasC*previousd2d.X()); + PasCv = Abs(PasC*previousd2d.Y()); + if (PasCu <= tolerance(1) && PasCv <= tolerance(2)) { + if (CurrentLine->NbPoints()==1) break; + Arrive = Standard_True; + CurrentLine->AddStatusLast(Standard_False); + Tgtend = Standard_True; // need check + Rajout = Standard_True; seqAjout.Append(lines.Length() + 1); - } - } + } + } + + if(aNbIter < 0) + break; } // end of started line if (Arrive) { - CurrentLine->SetTangencyAtEnd(Tgtend); - lines.Append(CurrentLine); - // modified by NIZHNY-MKK Fri Oct 27 12:59:29 2000.BEGIN - movementdirectioninfo[I]=0; - if(wd1[I].etat > 0) - // modified by NIZHNY-MKK Fri Oct 27 12:59:42 2000.END - wd1[I].etat=-wd1[I].etat; + CurrentLine->SetTangencyAtEnd(Tgtend); + lines.Append(CurrentLine); + // modified by NIZHNY-MKK Fri Oct 27 12:59:29 2000.BEGIN + movementdirectioninfo[I]=0; + if(wd1[I].etat > 0) + // modified by NIZHNY-MKK Fri Oct 27 12:59:42 2000.END + wd1[I].etat=-wd1[I].etat; - //-- lbr le 5 juin 97 (Pb ds Contap) - for(Standard_Integer av=1; av<=nbPath; av++) { - // modified by NIZHNY-MKK Fri Oct 27 13:00:22 2000.BEGIN - // if (wd1[av].etat > 11) { - if ((wd1[av].etat > 11) || - ((av!=I) && - (av!=IndexOfPathPointDoNotCheck) && - (wd1[av].etat < -11) && - (movementdirectioninfo[av]!=0))) { - // modified by NIZHNY-MKK Fri Oct 27 13:00:26 2000.END - Standard_Real Uav=wd1[av].ustart; - Standard_Real Vav=wd1[av].vstart; - Standard_Real Uavp,Vavp; - const IntSurf_PntOn2S &avP=CurrentLine->Value(CurrentLine->NbPoints()); - if (!reversed) { - avP.ParametersOnS2(Uavp,Vavp); - } - else { - avP.ParametersOnS1(Uavp,Vavp); - } - Uav-=Uavp; - Vav-=Vavp; - Uav*=0.001; Vav*=0.001; - if(Abs(Uav)AddStatusLast(Standard_True, av, Pnts1.Value(av)); - //-- cout<<"\n Debug ? lbr ds IntWalk_IWalking_3.gxx"<Value(1); - if (!reversed) { - avPP.ParametersOnS2(Uavp,Vavp); - } - else { - avPP.ParametersOnS1(Uavp,Vavp); - } - Uav=wd1[av].ustart; - Vav=wd1[av].vstart; - Uav-=Uavp; - Vav-=Vavp; - Uav*=0.001; Vav*=0.001; - if(Abs(Uav)AddStatusFirst(Standard_False, Standard_True, av, Pnts1.Value(av)); - } - } - } - + //-- lbr le 5 juin 97 (Pb ds Contap) + for(Standard_Integer av=1; av<=nbPath; av++) { + // modified by NIZHNY-MKK Fri Oct 27 13:00:22 2000.BEGIN + // if (wd1[av].etat > 11) { + if ((wd1[av].etat > 11) || + ((av!=I) && + (av!=IndexOfPathPointDoNotCheck) && + (wd1[av].etat < -11) && + (movementdirectioninfo[av]!=0))) + { + // modified by NIZHNY-MKK Fri Oct 27 13:00:26 2000.END + Standard_Real Uav=wd1[av].ustart; + Standard_Real Vav=wd1[av].vstart; + Standard_Real Uavp,Vavp; + const IntSurf_PntOn2S &avP=CurrentLine->Value(CurrentLine->NbPoints()); + if (!reversed) { + avP.ParametersOnS2(Uavp,Vavp); + } + else { + avP.ParametersOnS1(Uavp,Vavp); + } + Uav-=Uavp; + Vav-=Vavp; + Uav*=0.001; Vav*=0.001; + if(Abs(Uav)AddStatusLast(Standard_True, av, Pnts1.Value(av)); + //-- cout<<"\n Debug ? lbr ds IntWalk_IWalking_3.gxx"<Value(1); + if (!reversed) { + avPP.ParametersOnS2(Uavp,Vavp); + } + else { + avPP.ParametersOnS1(Uavp,Vavp); + } + Uav=wd1[av].ustart; + Vav=wd1[av].vstart; + Uav-=Uavp; + Vav-=Vavp; + Uav*=0.001; Vav*=0.001; + if(Abs(Uav)AddStatusFirst(Standard_False, Standard_True, av, Pnts1.Value(av)); + } + } + } } } //end of point processing } //end of all points diff --git a/src/IntWalk/IntWalk_IWalking_4.gxx b/src/IntWalk/IntWalk_IWalking_4.gxx index 6dfbf6cbb5..bddf8ff15c 100644 --- a/src/IntWalk/IntWalk_IWalking_4.gxx +++ b/src/IntWalk/IntWalk_IWalking_4.gxx @@ -77,13 +77,13 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult, math_FunctionSetRoot Rsnld(Func,tolerance); Standard_Integer nbLoop = Pnts2.Length(); - + for (I = 1;I<=nbLoop;I++) { - if (wd2[I].etat > 12) { // start point of closed line - + if (wd2[I].etat > 12) + { // start point of closed line LoopPnt = Pnts2.Value(I); previousPoint.SetValue(ThePointOfLoopTool::Value3d(LoopPnt),reversed, - wd2[I].ustart,wd2[I].vstart); + wd2[I].ustart,wd2[I].vstart); previousd3d = ThePointOfLoopTool::Direction3d(LoopPnt); previousd2d = ThePointOfLoopTool::Direction2d(LoopPnt); @@ -102,13 +102,13 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult, Standard_Real d2dx = Abs(previousd2d.X()); Standard_Real d2dy = Abs(previousd2d.Y()); if (d2dx < tolerance(1)) { - PasC = pas * (VM-Vm)/d2dy; + PasC = pas * (VM-Vm)/d2dy; } else if (d2dy < tolerance(2)) { - PasC = pas * (UM-Um)/d2dx; + PasC = pas * (UM-Um)/d2dx; } else { - PasC = pas * Min((UM-Um)/d2dx,(VM-Vm)/d2dy); + PasC = pas * Min((UM-Um)/d2dx,(VM-Vm)/d2dy); } PasSav = PasC; @@ -117,225 +117,232 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult, ArretAjout = Standard_False; NbDivision = 0; StatusPrecedent = IntWalk_OK; + Standard_Integer aNbIter = 10; while (!Arrive) { // as no test of stop is passed - Cadre=Cadrage(BornInf,BornSup,Uvap,PasC, StepSign); // border? + Cadre=Cadrage(BornInf,BornSup,Uvap,PasC, StepSign); // border? #ifdef CHRONO - Chronrsnld.Start(); + Chronrsnld.Start(); #endif - Rsnld.Perform(Func,Uvap,BornInf,BornSup); + Rsnld.Perform(Func,Uvap,BornInf,BornSup); #ifdef CHRONO - Chronrsnld.Stop(); + Chronrsnld.Stop(); #endif - if (Cadre) { // update of limits. - BornInf(1) = Um;BornSup(1) = UM;BornInf(2) = Vm;BornSup(2) = VM; - } - if (Rsnld.IsDone()) { - if (Abs(Func.Root()) > Func.Tolerance()) { // no solution for the tolerance - PasC = PasC/2.; - PasCu = Abs(PasC*previousd2d.X()); - PasCv = Abs(PasC*previousd2d.Y()); + if (Cadre) { // update of limits. + BornInf(1) = Um;BornSup(1) = UM;BornInf(2) = Vm;BornSup(2) = VM; + } + if (Rsnld.IsDone()) { + if (Abs(Func.Root()) > Func.Tolerance()) { // no solution for the tolerance + PasC = PasC/2.; + PasCu = Abs(PasC*previousd2d.X()); + PasCv = Abs(PasC*previousd2d.Y()); - if (PasCu <= tolerance(1) && PasCv <= tolerance(2)) { - if (CurrentLine->NbPoints()==1) break; - Arrive = Standard_True; - CurrentLine->AddStatusFirstLast(Standard_False, - Standard_False,Standard_False); - Rajout = Standard_True; + if (PasCu <= tolerance(1) && PasCv <= tolerance(2)) { + if (CurrentLine->NbPoints()==1) break; + Arrive = Standard_True; + CurrentLine->AddStatusFirstLast(Standard_False, + Standard_False,Standard_False); + Rajout = Standard_True; seqAjout.Append(lines.Length()+1); - Tgtend = Standard_True; - } - } - else { // there is a solution - Rsnld.Root(Uvap); - Arrive = TestArretPassage(Umult,Vmult,Uvap,I,Ipass); - if (Arrive) {//reset proper parameter to test the arrow. - Psol = CurrentLine->Value(1); - if (!reversed) { - Psol.ParametersOnS2(Uvap(1),Uvap(2)); - } - else { - Psol.ParametersOnS1(Uvap(1),Uvap(2)); - } + Tgtend = Standard_True; + } + } + else { // there is a solution + Rsnld.Root(Uvap); + Arrive = TestArretPassage(Umult,Vmult,Uvap,I,Ipass); + if (Arrive) {//reset proper parameter to test the arrow. + Psol = CurrentLine->Value(1); + if (!reversed) { + Psol.ParametersOnS2(Uvap(1),Uvap(2)); + } + else { + Psol.ParametersOnS1(Uvap(1),Uvap(2)); + } Cadre=Standard_False; - //in case if there is a frame and arrival at the same time - } - else { // modif jag 940615 + //in case if there is a frame and arrival at the same time + } + else { // modif jag 940615 + if (Rajout) { // test on added points + ArretAjout =TestArretAjout(Func,Uvap,N,Psol); + if (ArretAjout) { + if (N >0) { + Tgtend = lines.Value(N)->IsTangentAtEnd(); + N = -N; + } + else { + Tgtend = lines.Value(-N)->IsTangentAtBegining(); + } + Arrive = (wd2[I].etat == 12); + } + } - if (Rajout) { // test on added points - ArretAjout =TestArretAjout(Func,Uvap,N,Psol); - if (ArretAjout) { - if (N >0) { - Tgtend = lines.Value(N)->IsTangentAtEnd(); - N = -N; - } - else { - Tgtend = lines.Value(-N)->IsTangentAtBegining(); - } - Arrive = (wd2[I].etat == 12); - } - } + if (!ArretAjout&& Cadre) { // test on already marked points + if (CurrentLine->NbPoints() == 1) break; // cancel the line + TestArretCadre(Umult,Vmult,CurrentLine,Func,Uvap,N); + // if (N==0) { + if (N <= 0) { // jag 941017 + MakeWalkingPoint(2,Uvap(1),Uvap(2),Func,Psol); + Tgtend = Func.IsTangent(); // jag 940616 + N = -N; + } + Arrive = (wd2[I].etat == 12); // the line is open + } + } + Status = TestDeflection(Func, Arrive,Uvap,StatusPrecedent, + NbDivision,PasC,StepSign); - if (!ArretAjout&& Cadre) { // test on already marked points - if (CurrentLine->NbPoints() == 1) break; // cancel the line - TestArretCadre(Umult,Vmult,CurrentLine,Func,Uvap,N); -// if (N==0) { - if (N <= 0) { // jag 941017 - MakeWalkingPoint(2,Uvap(1),Uvap(2),Func,Psol); - Tgtend = Func.IsTangent(); // jag 940616 - N = -N; - } - Arrive = (wd2[I].etat == 12); // the line is open - } - } - Status = TestDeflection(Func, Arrive,Uvap,StatusPrecedent, - NbDivision,PasC,StepSign); - StatusPrecedent = Status; - if (Status == IntWalk_PasTropGrand) {// division of the step - Arrive = Standard_False; - ArretAjout = Standard_False; - Tgtend = Standard_False; // jag 940616 - if (!reversed) { - previousPoint.ParametersOnS2(Uvap(1),Uvap(2)); - } - else { - previousPoint.ParametersOnS1(Uvap(1),Uvap(2)); - } - } - else if (ArretAjout || Cadre) { + StatusPrecedent = Status; + if (Status == IntWalk_PasTropGrand) {// division of the step + Arrive = Standard_False; + ArretAjout = Standard_False; + Tgtend = Standard_False; // jag 940616 + if (!reversed) { + previousPoint.ParametersOnS2(Uvap(1),Uvap(2)); + } + else { + previousPoint.ParametersOnS1(Uvap(1),Uvap(2)); + } + } + else if (ArretAjout || Cadre) { - if (Arrive) { // line s is open - CurrentLine->AddStatusLast(Standard_False); - if (Status != IntWalk_ArretSurPointPrecedent) { - CurrentLine->AddPoint(Psol); - } - if (Cadre && N==0) { - Rajout = Standard_True; - seqAjout.Append(lines.Length()+1); - } - - } - else { // open - wd2[I].etat = 12; // declare it open - Tgtbeg = Tgtend; - Tgtend = Standard_False; - ArretAjout = Standard_False; - StepSign = -1; + if (Arrive) { // line s is open + CurrentLine->AddStatusLast(Standard_False); + if (Status != IntWalk_ArretSurPointPrecedent) { + CurrentLine->AddPoint(Psol); + } + if (Cadre && N==0) { + Rajout = Standard_True; + seqAjout.Append(lines.Length()+1); + } + + } + else { // open + wd2[I].etat = 12; // declare it open + Tgtbeg = Tgtend; + Tgtend = Standard_False; + ArretAjout = Standard_False; + StepSign = -1; StatusPrecedent = IntWalk_OK; - PasC = PasSav; - if (Status == IntWalk_ArretSurPointPrecedent) { - OpenLine(0,Psol,Pnts1,Func,CurrentLine); - } - else { - OpenLine(-lines.Length()-1,Psol,Pnts1,Func,CurrentLine); - } - if (Cadre && N==0) { - Rajout = Standard_True; - seqAjout.Append(-lines.Length()-1); - } - } - } - - else if ( Status == IntWalk_ArretSurPointPrecedent) { - if (CurrentLine->NbPoints() == 1) { //cancel the line - Arrive = Standard_False; - break; - } - if (wd2[I].etat >12) { //the line should become open - wd2[I].etat = 12; //declare it open - ArretAjout = Standard_False; - OpenLine(0,Psol,Pnts1,Func,CurrentLine); - StepSign = -1; + PasC = PasSav; + if (Status == IntWalk_ArretSurPointPrecedent) { + OpenLine(0,Psol,Pnts1,Func,CurrentLine); + } + else { + OpenLine(-lines.Length()-1,Psol,Pnts1,Func,CurrentLine); + } + if (Cadre && N==0) { + Rajout = Standard_True; + seqAjout.Append(-lines.Length()-1); + } + } + } + else if ( Status == IntWalk_ArretSurPointPrecedent) { + if (CurrentLine->NbPoints() == 1) { //cancel the line + Arrive = Standard_False; + break; + } + if (wd2[I].etat >12) { //the line should become open + wd2[I].etat = 12; //declare it open + ArretAjout = Standard_False; + OpenLine(0,Psol,Pnts1,Func,CurrentLine); + StepSign = -1; StatusPrecedent = IntWalk_OK; - Arrive = Standard_False; - PasC = PasSav; - Rajout = Standard_True; + Arrive = Standard_False; + PasC = PasSav; + Rajout = Standard_True; seqAjout.Append(-lines.Length()-1); - } - else { // line s is open - Arrive =Standard_True; - CurrentLine->AddStatusLast(Standard_False); - Rajout = Standard_True; + } + else { // line s is open + Arrive =Standard_True; + CurrentLine->AddStatusLast(Standard_False); + Rajout = Standard_True; seqAjout.Append(lines.Length()+1); - } - } - else if (Arrive) { - if (wd2[I].etat > 12) { //line closed good case - CurrentLine->AddStatusFirstLast(Standard_True, - Standard_False,Standard_False); - CurrentLine->AddPoint(CurrentLine->Value(1)); - } - else if (N >0) { //point of stop given at input - PathPnt = Pnts1.Value(N); - CurrentLine->AddStatusLast(Standard_True,N,PathPnt); + } + } + else if (Arrive) { + if (wd2[I].etat > 12) { //line closed good case + CurrentLine->AddStatusFirstLast(Standard_True, + Standard_False,Standard_False); + CurrentLine->AddPoint(CurrentLine->Value(1)); + } + else if (N >0) { //point of stop given at input + PathPnt = Pnts1.Value(N); + CurrentLine->AddStatusLast(Standard_True,N,PathPnt); AddPointInCurrentLine(N,PathPnt,CurrentLine); - } - } - else if (Status == IntWalk_ArretSurPoint) { - if (wd2[I].etat >12) { //line should become open - wd2[I].etat = 12; //declare it open - Tgtbeg = Standard_True; - Tgtend = Standard_False; + } + } + else if (Status == IntWalk_ArretSurPoint) { + if (wd2[I].etat >12) { //line should become open + wd2[I].etat = 12; //declare it open + Tgtbeg = Standard_True; + Tgtend = Standard_False; N= -lines.Length()-1; Psol.SetValue(Func.Point(),reversed,Uvap(1),Uvap(2)); - OpenLine(N,Psol,Pnts1,Func,CurrentLine); - StepSign = -1; - Rajout = Standard_True; + OpenLine(N,Psol,Pnts1,Func,CurrentLine); + StepSign = -1; + Rajout = Standard_True; seqAjout.Append(N); StatusPrecedent = IntWalk_OK; - Arrive = Standard_False; - PasC = PasSav; - } - else { - Arrive = Standard_True; - if (Ipass!=0) { //point of passage, point of stop - PathPnt = Pnts1.Value(Ipass); - CurrentLine->AddStatusLast(Standard_True,Ipass,PathPnt); + Arrive = Standard_False; + PasC = PasSav; + } + else { + Arrive = Standard_True; + if (Ipass!=0) { //point of passage, point of stop + PathPnt = Pnts1.Value(Ipass); + CurrentLine->AddStatusLast(Standard_True,Ipass,PathPnt); AddPointInCurrentLine(Ipass,PathPnt,CurrentLine); - } - else { - CurrentLine->AddStatusLast(Standard_False); - IntSurf_PntOn2S newP; - newP.SetValue(Func.Point(),reversed,Uvap(1),Uvap(2)); - CurrentLine->AddPoint(newP); - Rajout = Standard_True; - seqAjout.Append(lines.Length()+1); } - } - } - else if (Status == IntWalk_OK) { - if (Ipass!=0) CurrentLine->AddIndexPassing(Ipass); - previousPoint.SetValue(Func.Point(),reversed,Uvap(1),Uvap(2)); - previousd3d = Func.Direction3d(); - previousd2d = Func.Direction2d(); - CurrentLine->AddPoint(previousPoint); - } - } - } - else { //no numerical solution NotDone - PasC = PasC/2.; - PasCu = Abs(PasC*previousd2d.X()); - PasCv = Abs(PasC*previousd2d.Y()); + else { + CurrentLine->AddStatusLast(Standard_False); + IntSurf_PntOn2S newP; + newP.SetValue(Func.Point(),reversed,Uvap(1),Uvap(2)); + CurrentLine->AddPoint(newP); + Rajout = Standard_True; + seqAjout.Append(lines.Length()+1); + } + } + } + else if (Status == IntWalk_OK) { + if (Ipass!=0) CurrentLine->AddIndexPassing(Ipass); + previousPoint.SetValue(Func.Point(),reversed,Uvap(1),Uvap(2)); + previousd3d = Func.Direction3d(); + previousd2d = Func.Direction2d(); + CurrentLine->AddPoint(previousPoint); + } + else if (Status == IntWalk_PointConfondu) + { + aNbIter --; + } + } + } + else { //no numerical solution NotDone + PasC = PasC/2.; + PasCu = Abs(PasC*previousd2d.X()); + PasCv = Abs(PasC*previousd2d.Y()); - if (PasCu <= tolerance(1) && PasCv <= tolerance(2)) { + if (PasCu <= tolerance(1) && PasCv <= tolerance(2)) { if (CurrentLine->NbPoints() == 1) break; // cancel the line - Arrive = Standard_True; - CurrentLine->AddStatusFirstLast(Standard_False,Standard_False, - Standard_False); - Tgtend = Standard_True; - Rajout = Standard_True; - seqAjout.Append(lines.Length()+1); - } - } + Arrive = Standard_True; + CurrentLine->AddStatusFirstLast(Standard_False,Standard_False, + Standard_False); + Tgtend = Standard_True; + Rajout = Standard_True; + seqAjout.Append(lines.Length()+1); + } + } + + if(aNbIter < 0) + break; }// end of started line if (Arrive) { - CurrentLine->SetTangencyAtBegining(Tgtbeg); - CurrentLine->SetTangencyAtEnd(Tgtend); - - lines.Append(CurrentLine); - wd2[I].etat=-wd2[I].etat; //mark point as processed + CurrentLine->SetTangencyAtBegining(Tgtbeg); + CurrentLine->SetTangencyAtEnd(Tgtend); + + lines.Append(CurrentLine); + wd2[I].etat=-wd2[I].etat; //mark point as processed } } //end of processing of start point } //end of all start points diff --git a/src/IntWalk/IntWalk_IWalking_5.gxx b/src/IntWalk/IntWalk_IWalking_5.gxx index fa7e62e888..98dce89f3e 100644 --- a/src/IntWalk/IntWalk_IWalking_5.gxx +++ b/src/IntWalk/IntWalk_IWalking_5.gxx @@ -58,85 +58,83 @@ IntWalk_StatusDeflection IntWalk_IWalking::TestDeflection //-- if epsilon is great enough (1e-11). In this case one loops //-- without ever changing the values sent to Rsnld. //--------------------------------------------------------------------------------- - Standard_Real Paramu, Paramv, StepU,StepV; - Standard_Real Cosi, Cosi2, Norme; - - gp_Vec Corde(previousPoint.Value(), sp.Point()); - - Norme = Corde.SquareMagnitude(); -// if (Norme <= epsilon*epsilon) { - if ((++NbPointsConfondusConsecutifs < 10) && (Norme <= epsilon)) { // the square is already taken in the constructor - Status = IntWalk_PointConfondu; - if (StatusPrecedent == IntWalk_PasTropGrand) { - return IntWalk_ArretSurPointPrecedent; - } - - if(++EpsilonSembleTropGrand > 5 && NbPointsConfondusConsecutifs == 8) { //-- Temporary - if(epsilon>0.00000000001) epsilon*=0.5; //-- Temporary - EpsilonSembleTropGrand = 0; //-- Temporary - } - } - else { - NbPointsConfondusConsecutifs = 0; //-- Temporary - EpsilonSembleTropGrand = 0; //-- Temporary - if(Norme<1e-16) Norme = 1e-16; //-- Temporary - - Cosi = Corde * previousd3d; - if (Cosi*StepSign < 0.) { // angle 3d > pi/2 !!!! - Cosi2 = 0.; - } - else { - Cosi2 = Cosi * Cosi / previousd3d.SquareMagnitude() / Norme; - } - if (Cosi2 < CosRef3D) { //angle 3d too great - Step = Step /2.0; - StepU = Abs(Step*previousd2d.X()); - StepV = Abs(Step*previousd2d.Y()); - if (StepU < tolerance(1) && StepV < tolerance(2)) - Status = IntWalk_ArretSurPointPrecedent; - else - Status = IntWalk_PasTropGrand; - return Status; - } - } + Standard_Real Paramu = 0.0, Paramv = 0.0; if (!reversed) { previousPoint.ParametersOnS2(Paramu, Paramv); } - else { + else + { previousPoint.ParametersOnS1(Paramu, Paramv); } - Standard_Real Du = UV(1) - Paramu; - Standard_Real Dv = UV(2) - Paramv; - Standard_Real Duv = Du * Du + Dv * Dv; + + const Standard_Real Du = UV(1) - Paramu; + const Standard_Real Dv = UV(2) - Paramv; + const Standard_Real Duv = Du * Du + Dv * Dv; + + gp_Vec Corde(previousPoint.Value(), sp.Point()); + + const Standard_Real Norme = Corde.SquareMagnitude(), + aTol = epsilon*Precision::PConfusion(); + + //if ((++NbPointsConfondusConsecutifs < 10) && (Norme <= epsilon)) { // the square is already taken in the constructor + if ((Norme <= epsilon) && ((Duv <= aTol) || (StatusPrecedent != IntWalk_OK))) + { // the square is already taken in the constructor + Status = IntWalk_PointConfondu; + if (StatusPrecedent == IntWalk_PasTropGrand) { + return IntWalk_ArretSurPointPrecedent; + } + } + else { + Standard_Real Cosi = Corde * previousd3d; + Standard_Real Cosi2 = 0.0; + + if (Cosi*StepSign >= 0.) {// angle 3d <= pi/2 !!!! + const Standard_Real aDiv = previousd3d.SquareMagnitude()*Norme; + if(aDiv == 0) + return Status; + Cosi2 = Cosi * Cosi / aDiv; + } + if (Cosi2 < CosRef3D) { //angle 3d too great + Step = Step /2.0; + Standard_Real StepU = Abs(Step*previousd2d.X()), + StepV = Abs(Step*previousd2d.Y()); + if (StepU < tolerance(1) && StepV < tolerance(2)) + Status = IntWalk_ArretSurPointPrecedent; + else + Status = IntWalk_PasTropGrand; + return Status; + } + } + if (Abs(Du) < tolerance(1) && Abs(Dv) < tolerance(2)) return IntWalk_ArretSurPointPrecedent; //confused point 2d - Cosi = StepSign * (Du * previousd2d.X() + - Dv * previousd2d.Y()); + + Standard_Real Cosi = StepSign * (Du * previousd2d.X() + Dv * previousd2d.Y()); + if (Cosi < 0 && Status == IntWalk_PointConfondu) return IntWalk_ArretSurPointPrecedent; // leave as step back // with confused point - if (sp.IsTangent()) return IntWalk_ArretSurPoint; //if during routing one has subdivided more than MaxDivision for each //previous step, bug on the square; do nothing (experience U4) - if (NbDivision < MaxDivision && - Status != IntWalk_PointConfondu && - StatusPrecedent!= IntWalk_PointConfondu ) { - Cosi2 = Cosi * Cosi / Duv; + if ((NbDivision < MaxDivision) && (Status != IntWalk_PointConfondu) && + (StatusPrecedent!= IntWalk_PointConfondu)) + { + Standard_Real Cosi2 = Cosi * Cosi / Duv; if (Cosi2 < CosRef2D || Cosi < 0 ) { Step = Step / 2.0; - StepU = Abs(Step*previousd2d.X()); - StepV = Abs(Step*previousd2d.Y()); + Standard_Real StepU = Abs(Step*previousd2d.X()), + StepV = Abs(Step*previousd2d.Y()); if (StepU < tolerance(1) && StepV < tolerance(2)) - Status = IntWalk_ArretSurPointPrecedent; + Status = IntWalk_ArretSurPointPrecedent; else - Status = IntWalk_PasTropGrand; + Status = IntWalk_PasTropGrand; NbDivision = NbDivision + 1; return Status; } @@ -145,139 +143,149 @@ IntWalk_StatusDeflection IntWalk_IWalking::TestDeflection Cosi2 = Cosi * Cosi / sp.Direction3d().SquareMagnitude() / Norme; if (Cosi2 < CosRef3D ){ //angle 3d too great Step = Step / 2.; - StepU = Abs(Step*previousd2d.X()); - StepV = Abs(Step*previousd2d.Y()); + Standard_Real StepU = Abs(Step*previousd2d.X()), + StepV = Abs(Step*previousd2d.Y()); if (StepU < tolerance(1) && StepV < tolerance(2)) - Status = IntWalk_ArretSurPoint; + Status = IntWalk_ArretSurPoint; else - Status = IntWalk_PasTropGrand; + Status = IntWalk_PasTropGrand; return Status; } Cosi = Du * sp.Direction2d().X() + - Dv * sp.Direction2d().Y(); + Dv * sp.Direction2d().Y(); Cosi2 = Cosi * Cosi / Duv; if (Cosi2 < CosRef2D || - sp.Direction2d() * previousd2d < 0) { - //angle 2d too great or change the side - Step = Step / 2.; - StepU = Abs(Step*previousd2d.X()); - StepV = Abs(Step*previousd2d.Y()); - if (StepU < tolerance(1) && StepV < tolerance(2)) - Status = IntWalk_ArretSurPointPrecedent; - else - Status = IntWalk_PasTropGrand; - return Status; + sp.Direction2d() * previousd2d < 0) { + //angle 2d too great or change the side + Step = Step / 2.; + Standard_Real StepU = Abs(Step*previousd2d.X()), + StepV = Abs(Step*previousd2d.Y()); + if (StepU < tolerance(1) && StepV < tolerance(2)) + Status = IntWalk_ArretSurPointPrecedent; + else + Status = IntWalk_PasTropGrand; + return Status; } } if (!Finished) { - - if (Status == IntWalk_PointConfondu) { - StepU = Min(Abs(1.5 * Du),pas*(UM-Um)); - StepV = Min(Abs(1.5 * Dv),pas*(VM-Vm)); + if (Status == IntWalk_PointConfondu) + { + Standard_Real StepU = Min(Abs(1.5 * Du),pas*(UM-Um)), + StepV = Min(Abs(1.5 * Dv),pas*(VM-Vm)); Standard_Real d2dx = Abs(previousd2d.X()); Standard_Real d2dy = Abs(previousd2d.Y()); - if (d2dx < tolerance(1)) { - Step = StepV/d2dy; + if (d2dx < tolerance(1)) + { + Step = StepV/d2dy; } - else if (d2dy < tolerance(2)) { - Step = StepU/d2dx; + else if (d2dy < tolerance(2)) + { + Step = StepU/d2dx; } - else { - Step = Min(StepU/d2dx,StepV/d2dy); + else + { + Step = Min(StepU/d2dx,StepV/d2dy); } - - - } - else { -// estimate the current vector. -// if vector/2<=current vector<= vector it is considered that the criterion -// is observed. -// otherwise adjust the step depending on the previous step + else + { + // estimate the current vector. + // if vector/2<=current vector<= vector it is considered that the criterion + // is observed. + // otherwise adjust the step depending on the previous step -/* - Standard_Real Dist = Sqrt(Norme)/3.; - TColgp_Array1OfPnt Poles(1,4); - gp_Pnt POnCurv,Milieu; - Poles(1) = previousPoint.Value(); - Poles(4) = sp.Point(); - Poles(2) = Poles(1).XYZ() + - StepSign * Dist* previousd3d.Normalized().XYZ(); - Poles(3) = Poles(4).XYZ() - - StepSign * Dist*sp.Direction3d().Normalized().XYZ(); - BzCLib::PntPole(0.5,Poles,POnCurv); - Milieu = (Poles(1).XYZ() + Poles(4).XYZ())*0.5; -// FlecheCourante = Milieu.Distance(POnCurv); - Standard_Real FlecheCourante = Milieu.SquareDistance(POnCurv); -*/ + /* + Standard_Real Dist = Sqrt(Norme)/3.; + TColgp_Array1OfPnt Poles(1,4); + gp_Pnt POnCurv,Milieu; + Poles(1) = previousPoint.Value(); + Poles(4) = sp.Point(); + Poles(2) = Poles(1).XYZ() + + StepSign * Dist* previousd3d.Normalized().XYZ(); + Poles(3) = Poles(4).XYZ() - + StepSign * Dist*sp.Direction3d().Normalized().XYZ(); + BzCLib::PntPole(0.5,Poles,POnCurv); + Milieu = (Poles(1).XYZ() + Poles(4).XYZ())*0.5; + // FlecheCourante = Milieu.Distance(POnCurv); + Standard_Real FlecheCourante = Milieu.SquareDistance(POnCurv); + */ - // Direct calculation : - // POnCurv=(((p1+p2)/2.+(p2+p3)/2.)/2. + ((p2+p3)/2.+(p3+P4)/2.)/2.)/2. - // either POnCurv = p1/8. + 3.p2/8. + 3.p3/8. + p4/8. - // Or p2 = p1 + lambda*d1 et p3 = p4 - lambda*d4 - // So POnCurv = (p1 + p4)/2. + 3.*(lambda d1 - lambda d4)/8. - // Calculate the deviation with (p1+p4)/2. . So it is just necessary to calculate - // the norm (square) of 3.*lambda (d1 - d4)/8. - // either the norm of : - // 3.*(Sqrt(Norme)/3.)*StepSign*(d1-d4)/8. - // which produces, takin the square : - // Norme * (d1-d4).SquareMagnitude()/64. + // Direct calculation : + // POnCurv=(((p1+p2)/2.+(p2+p3)/2.)/2. + ((p2+p3)/2.+(p3+P4)/2.)/2.)/2. + // either POnCurv = p1/8. + 3.p2/8. + 3.p3/8. + p4/8. + // Or p2 = p1 + lambda*d1 et p3 = p4 - lambda*d4 + // So POnCurv = (p1 + p4)/2. + 3.*(lambda d1 - lambda d4)/8. + // Calculate the deviation with (p1+p4)/2. . So it is just necessary to calculate + // the norm (square) of 3.*lambda (d1 - d4)/8. + // either the norm of : + // 3.*(Sqrt(Norme)/3.)*StepSign*(d1-d4)/8. + // which produces, takin the square : + // Norme * (d1-d4).SquareMagnitude()/64. Standard_Real FlecheCourante = (previousd3d.Normalized().XYZ()-sp.Direction3d().Normalized().XYZ()).SquareModulus()*Norme/64.; // if (FlecheCourante <= 0.5*fleche) { - if (FlecheCourante <= 0.25*fleche*fleche) { + if (FlecheCourante <= 0.25*fleche*fleche) + { + Standard_Real d2dx = Abs(sp.Direction2d().X()); + Standard_Real d2dy = Abs(sp.Direction2d().Y()); + + Standard_Real StepU = Min(Abs(1.5*Du),pas*(UM-Um)), + StepV = Min(Abs(1.5*Dv),pas*(VM-Vm)); - Standard_Real d2dx = Abs(sp.Direction2d().X()); - Standard_Real d2dy = Abs(sp.Direction2d().Y()); - - StepU = Min(Abs(1.5*Du),pas*(UM-Um)); - StepV = Min(Abs(1.5*Dv),pas*(VM-Vm)); - - if (d2dx < tolerance(1)) { - Step = StepV/d2dy; - } - else if (d2dy < tolerance(2)) { - Step = StepU/d2dx; - } - else { - Step = Min(StepU/d2dx,StepV/d2dy); - } - + if (d2dx < tolerance(1)) + { + Step = StepV/d2dy; + } + else if (d2dy < tolerance(2)) + { + Step = StepU/d2dx; + } + else + { + Step = Min(StepU/d2dx,StepV/d2dy); + } } - else { -// if (FlecheCourante > fleche) { // step too great - if (FlecheCourante > fleche*fleche) { // step too great - Step = Step /2.; - StepU = Abs(Step*previousd2d.X()); - StepV = Abs(Step*previousd2d.Y()); + else + { + //if (FlecheCourante > fleche) { // step too great + if (FlecheCourante > fleche*fleche) + { // step too great + Step = Step /2.; + Standard_Real StepU = Abs(Step*previousd2d.X()), + StepV = Abs(Step*previousd2d.Y()); + if (StepU < tolerance(1) && StepV < tolerance(2)) Status = IntWalk_ArretSurPointPrecedent; else Status = IntWalk_PasTropGrand; - } - else { - Standard_Real d2dx = Abs(sp.Direction2d().X()); - Standard_Real d2dy = Abs(sp.Direction2d().Y()); + } + else + { + Standard_Real d2dx = Abs(sp.Direction2d().X()); + Standard_Real d2dy = Abs(sp.Direction2d().Y()); + + Standard_Real StepU = Min(Abs(1.5*Du),pas*(UM-Um)), + StepV = Min(Abs(1.5*Dv),pas*(VM-Vm)); - StepU = Min(Abs(1.5*Du),pas*(UM-Um)); - StepV = Min(Abs(1.5*Dv),pas*(VM-Vm)); - - if (d2dx < tolerance(1)) { - Step = Min(Step,StepV/d2dy); - } - else if (d2dy < tolerance(2)) { - Step = Min(Step,StepU/d2dx); - } - else { - Step = Min(Step,Min(StepU/d2dx,StepV/d2dy)); - } - } + if (d2dx < tolerance(1)) + { + Step = Min(Step,StepV/d2dy); + } + else if (d2dy < tolerance(2)) + { + Step = Min(Step,StepU/d2dx); + } + else + { + Step = Min(Step,Min(StepU/d2dx,StepV/d2dy)); + } + } } } } diff --git a/src/IntWalk/IntWalk_PWalking_1.gxx b/src/IntWalk/IntWalk_PWalking_1.gxx index d82a2078d7..6cce3b82b6 100644 --- a/src/IntWalk/IntWalk_PWalking_1.gxx +++ b/src/IntWalk/IntWalk_PWalking_1.gxx @@ -501,7 +501,7 @@ STATIC_PRECEDENT_INFLEXION(0) } else { Standard_Real t = VM2-Vm2; - if(tKELARG*pasuv[3])? KELARG*pasuv[3] : t; VM2+=t; diff --git a/tests/boolean/bfuse_complex/O5 b/tests/boolean/bfuse_complex/O5 index 82e5911ef6..4a65537950 100644 --- a/tests/boolean/bfuse_complex/O5 +++ b/tests/boolean/bfuse_complex/O5 @@ -1,8 +1,6 @@ -puts "TODO #22911 ALL: Error : The area of the resulting shape is" - restore [locate_data_file CTO908_topo104-o1.brep] wheel restore [locate_data_file CTO908_topo104-o2.brep] jante bfuse result wheel jante -set square 0 +set square 40059.9 diff --git a/tests/boolean/bfuse_complex/O6 b/tests/boolean/bfuse_complex/O6 index f79fd3aab9..f50fb7db11 100644 --- a/tests/boolean/bfuse_complex/O6 +++ b/tests/boolean/bfuse_complex/O6 @@ -1,8 +1,6 @@ -puts "TODO #22911 ALL: Error : The area of the resulting shape is" - restore [locate_data_file CTO908_topo106-p.brep] poche restore [locate_data_file CTO908_topo106-n.brep] nervure bfuse result poche nervure -set square 0 +set square 108943 diff --git a/tests/boolean/bfuse_complex/P1 b/tests/boolean/bfuse_complex/P1 index df51b47b48..b9194a1ae7 100644 --- a/tests/boolean/bfuse_complex/P1 +++ b/tests/boolean/bfuse_complex/P1 @@ -1,6 +1,4 @@ # cts17861 -#puts "TODO #22911 ALL: Faulty shapes in variables faulty_1 to faulty_" -puts "TODO #22911 ALL: Error : The area of the resulting shape is" restore [locate_data_file CTO900_cts17861a.rle] a restore [locate_data_file cts17861b.rle] b @@ -10,4 +8,4 @@ fsameparameter b bfuse result a b -set square 0 +set square 406803 diff --git a/tests/boolean/boptuc_complex/D5 b/tests/boolean/boptuc_complex/D5 index c70fc2d380..b83833325a 100644 --- a/tests/boolean/boptuc_complex/D5 +++ b/tests/boolean/boptuc_complex/D5 @@ -1,9 +1,7 @@ -puts "TODO #22911 ALL: Error : The area of the resulting shape is" - restore [locate_data_file a102] a restore [locate_data_file b136] b bop a b boptuc result -set square 0 +set square 9741.13 diff --git a/tests/bugs/modalg_4/fra62369 b/tests/bugs/modalg_4/fra62369 index 481dad8ed5..5e7962a47d 100755 --- a/tests/bugs/modalg_4/fra62369 +++ b/tests/bugs/modalg_4/fra62369 @@ -16,5 +16,5 @@ repeat 100 { compound s_$i result result incr i } -set length 3961.04 +set length 3854.34 set 2dviewer 0 diff --git a/tests/bugs/modalg_5/bug23952_2 b/tests/bugs/modalg_5/bug23952_2 index 85e5958ae2..b0061fd077 100644 --- a/tests/bugs/modalg_5/bug23952_2 +++ b/tests/bugs/modalg_5/bug23952_2 @@ -10,7 +10,7 @@ pload QAcommands restore [locate_data_file bug23952_s1.draw] a restore [locate_data_file bug23952_s2.draw] b -set NbLines 5 +set NbLines 6 set info [OCC23952intersect $NbLines a b] if { [regexp "theNbSol: OK" $info] != 1 } { diff --git a/tests/bugs/modalg_5/bug24612 b/tests/bugs/modalg_5/bug24612 new file mode 100644 index 0000000000..c8f9cd1fa8 --- /dev/null +++ b/tests/bugs/modalg_5/bug24612 @@ -0,0 +1,82 @@ +puts "=========" +puts "OCC24612" +puts "=========" +puts "" +########################################################### +# Wrong pcurve of the section curve +########################################################### + +set MaxTol 5.0e-7 +set NbCurv_OK 1 +restore [locate_data_file bug24612_b1.brep] b1 +restore [locate_data_file bug24612_b2.brep] b2 + +mksurface s1 b1 +bounds s1 U1f_exp U1l_exp V1f_exp V1l_exp + +dval U1f_exp +dval U1l_exp +dval V1f_exp +dval V1l_exp + +set log [bopcurves b1 b2 -2d] + +regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv + +if {${NbCurv} != ${NbCurv_OK}} { + puts "Error: ${NbCurv_OK} curve(s) expected, but ${NbCurv} found." +} + +if {${Toler} > ${MaxTol}} { + puts "Error: Tolerance is too big!" +} + +#Theoretically, c2d1_1 must cover V-diapason of surface s1 fully. + +set log [dump c2d1_1] + +regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles +puts "Degree=${Degree}" +puts "Poles=${Poles}" +puts "KnotsPoles=${KnotsPoles}" +puts "" + +set Pole 1 +set exp_string " +${Pole} : +(\[-0-9.+eE\]+), +(\[-0-9.+eE\]+)" +regexp ${exp_string} ${log} full U_begin V_begin + +puts "Pole=${Pole}" +puts "U_begin=${U_begin}" +puts "V_begin=${V_begin}" +dset V_begin ${V_begin} +puts "" + +set Pole ${Poles} +set exp_string " +${Pole} : +(\[-0-9.+eE\]+), +(\[-0-9.+eE\]+)" +regexp ${exp_string} ${log} full U_end V_end + +puts "Pole=${Pole}" +puts "U_end=${U_end}" +puts "V_end=${V_end}" +dset V_end ${V_end} +puts "" + +set delta_f [dval V1l_exp-V_begin] + +#ATTENTION!!! V_begin must be strictly equal V1l_exp (without any tolerance) +if {${delta_f} != 0} { + puts "Error: Bad value. V_begin = [dval V_begin], Vlast = [dval V1l_exp]." +} else { + puts "OK: Good value. V_begin matches with Vlast of surface." +} + +puts "" + +set delta_l [dval V1f_exp-V_end] + +#ATTENTION!!! V_end must be strictly equal V1f_exp (without any tolerance) +if {${delta_l} != 0} { + puts "Error: Bad value. V_end = [dval V_end], Vfirst = [dval V1f_exp]." +} else { + puts "OK: Good value. V_end matches with Vfirst of surface." +} diff --git a/tests/bugs/moddata_1/bug13 b/tests/bugs/moddata_1/bug13 index 75949fbbf0..bf8f11e1d1 100755 --- a/tests/bugs/moddata_1/bug13 +++ b/tests/bugs/moddata_1/bug13 @@ -7,8 +7,6 @@ puts "" ## It is impossible to intersect two surfaces ################################################## -puts "TODO OCC24472 ALL: Error : Intersection was made WRONGLY" - restore [locate_data_file OCC13-1.draw] su1 ############### checkshape su1 # is not a topological shape restore [locate_data_file OCC13-2.draw] su2 @@ -27,9 +25,9 @@ set nom 0 set err1 [lindex $che1 [expr [llength $che1] - 2]] if { $err != "curve" && $err1 != "3d"} { - break + break } else { - set nom [expr $nom + 1] + set nom [expr $nom + 1] } incr j} if { $nom == 0} { diff --git a/tests/feat/featprism/C4 b/tests/feat/featprism/C4 index 7a5b0a4122..f98af3700a 100644 --- a/tests/feat/featprism/C4 +++ b/tests/feat/featprism/C4 @@ -2,10 +2,6 @@ restore [locate_data_file cylindre.rle] cyl restore [locate_data_file contour.rle] cont mkplane cont cont nexplode cyl F - -puts "*" -#puts "TODO OCC22810 All:Faulty .*" -puts "TODO OCC22810 ALL:Error : The area of the resulting shape is" ttranslate cont 0 0 -100 # @@ -18,4 +14,4 @@ if { [catch { featperform prism result face face } ] != 0 } { puts "Error in featperform" } -set square 0 +set square 82351.1