From b1c5c4e6a6b009b8b3fc4d154407f32f4d57769e Mon Sep 17 00:00:00 2001 From: jgv Date: Thu, 3 Oct 2013 15:47:26 +0400 Subject: [PATCH] 0024140: Endless loop in BRepAlgoAPI_Section Test cases for issue CR24140 --- src/IntPatch/IntPatch_PrmPrmIntersection.cxx | 61 ++++++++- src/IntWalk/IntWalk.cdl | 18 +-- src/IntWalk/IntWalk_IWalking.cdl | 8 +- src/IntWalk/IntWalk_IWalking_1.gxx | 34 ++--- src/IntWalk/IntWalk_IWalking_2.gxx | 137 +++++++++---------- src/IntWalk/IntWalk_IWalking_5.gxx | 113 ++++++++------- src/IntWalk/IntWalk_IWalking_6.gxx | 8 +- src/IntWalk/IntWalk_PWalking.cdl | 60 ++++---- src/IntWalk/IntWalk_PWalking_1.gxx | 97 ++++++++----- src/IntWalk/IntWalk_PWalking_2.gxx | 14 +- src/IntWalk/IntWalk_PWalking_3.gxx | 74 +++++----- src/IntWalk/IntWalk_PWalking_4.gxx | 61 +++++---- tests/bugs/end | 1 + tests/bugs/modalg_1/buc60533 | 2 +- tests/bugs/modalg_5/bug24140 | 29 ++++ 15 files changed, 414 insertions(+), 303 deletions(-) create mode 100755 tests/bugs/modalg_5/bug24140 diff --git a/src/IntPatch/IntPatch_PrmPrmIntersection.cxx b/src/IntPatch/IntPatch_PrmPrmIntersection.cxx index 4b87723c5c..c21ee517a3 100755 --- a/src/IntPatch/IntPatch_PrmPrmIntersection.cxx +++ b/src/IntPatch/IntPatch_PrmPrmIntersection.cxx @@ -61,6 +61,11 @@ static const Handle(Adaptor3d_HSurface)& Surf2, IntPatch_SequenceOfLine& aSLin); +static + IntSurf_PntOn2S MakeNewPoint(const IntSurf_PntOn2S& replacePnt, + const IntSurf_PntOn2S& oldPnt, + const Standard_Real* Periods); + static Standard_Boolean IsPointOnLine(const IntSurf_PntOn2S &thePOn2S, const Handle(IntPatch_WLine) &theWLine, const Standard_Real Deflection); @@ -1309,6 +1314,12 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& VminLig2 = Surf2->FirstVParameter(); UmaxLig2 = Surf2->LastUParameter(); VmaxLig2 = Surf2->LastVParameter(); + + Standard_Real Periods [4]; + Periods[0] = (Surf1->IsUPeriodic())? Surf1->UPeriod() : 0.; + Periods[1] = (Surf1->IsVPeriodic())? Surf1->VPeriod() : 0.; + Periods[2] = (Surf2->IsUPeriodic())? Surf2->UPeriod() : 0.; + Periods[3] = (Surf2->IsVPeriodic())? Surf2->VPeriod() : 0.; IntSurf_ListIteratorOfListOfPntOn2S IterLOP1(LOfPnts); @@ -1537,7 +1548,10 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Standard_Integer iP; for( iP = 1; iP <= cNbP; iP++) { if( pI == iP ) - newL2s->Add(replacePnt); + { + IntSurf_PntOn2S newPnt = MakeNewPoint(replacePnt, wline->Point(iP), Periods); + newL2s->Add(newPnt); + } else if(removeNext && iP == (pI + 1)) continue; else if(removePrev && iP == (pI - 1)) @@ -1830,6 +1844,39 @@ void AdjustOnPeriodic(const Handle(Adaptor3d_HSurface)& Surf1, }//for (j=0; j<1; ++j) { }//for (i=1; i<=aNbLines; ++i) } + +//================================================================================== +// function : MakeNewPoint +// purpose : +//================================================================================== +IntSurf_PntOn2S MakeNewPoint(const IntSurf_PntOn2S& replacePnt, + const IntSurf_PntOn2S& oldPnt, + const Standard_Real* Periods) +{ + IntSurf_PntOn2S NewPoint; + NewPoint.SetValue(replacePnt.Value()); + + Standard_Real OldParams[4], NewParams[4]; + oldPnt.Parameters(OldParams[0], OldParams[1], OldParams[2], OldParams[3]); + replacePnt.Parameters(NewParams[0], NewParams[1], NewParams[2], NewParams[3]); + + Standard_Integer i; + for (i = 0; i < 4; i++) + if (Periods[i] != 0.) + { + if (Abs(NewParams[i] - OldParams[i]) >= 0.5*Periods[i]) + { + if (NewParams[i] < OldParams[i]) + NewParams[i] += Periods[i]; + else + NewParams[i] -= Periods[i]; + } + } + + NewPoint.SetValue(NewParams[0], NewParams[1], NewParams[2], NewParams[3]); + return NewPoint; +} + //================================================================================== // function : Perform // purpose : base SS Int. function @@ -1860,6 +1907,13 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur D1->VParameters(aVpars1); D2->UParameters(anUpars2); D2->VParameters(aVpars2); + + Standard_Real Periods [4]; + Periods[0] = (Surf1->IsUPeriodic())? Surf1->UPeriod() : 0.; + Periods[1] = (Surf1->IsVPeriodic())? Surf1->VPeriod() : 0.; + Periods[2] = (Surf2->IsUPeriodic())? Surf2->UPeriod() : 0.; + Periods[3] = (Surf2->IsVPeriodic())? Surf2->VPeriod() : 0.; + //--------------------------------------------- Limit = 2500; if((NbU1*NbV1<=Limit && NbV2*NbU2<=Limit)) { @@ -2243,7 +2297,10 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur Standard_Integer iP; for( iP = 1; iP <= cNbP; iP++) { if( pI == iP ) - newL2s->Add(replacePnt); + { + IntSurf_PntOn2S newPnt = MakeNewPoint(replacePnt, wline->Point(iP), Periods); + newL2s->Add(newPnt); + } else if(removeNext && iP == (pI + 1)) continue; else if(removePrev && iP == (pI - 1)) diff --git a/src/IntWalk/IntWalk.cdl b/src/IntWalk/IntWalk.cdl index 87bbb368ad..548377b1ec 100755 --- a/src/IntWalk/IntWalk.cdl +++ b/src/IntWalk/IntWalk.cdl @@ -22,7 +22,7 @@ package IntWalk - ---Purpose: This package defines the "walking" (marching?)algorithmes + ---Purpose: This package defines the "walking" (marching) algorithmes -- for the intersection between two surfaces. -- One of the surfaces is a parametric one. -- If the other is an implicit one, the "IWalking" class will @@ -42,14 +42,16 @@ is enumeration StatusDeflection is PasTropGrand, PointConfondu, ArretSurPointPrecedent, ArretSurPoint, OK; + +-- StepTooGreat, ConfusedPoint, StopOnPreviousPoint, StopOnPoint, OK --- classe definition ressource sur surface biparametree +-- class for definition of ressources on a biparametric surface deferred generic class PSurfaceTool; --- classes de definition pour algorithme cheminement sur une --- surface biparametree +-- classes for definition of marching algorithm on a +-- biparametric surface deferred generic class PathPointTool; @@ -60,12 +62,12 @@ is generic class Iterator; ---classes des objets resultat pour cheminement sur surface bi-parametree +--class of result objects marching on a biparametric surface generic class IWLine; ---algorithme cheminement/resolution +--algorithm marching/solution generic class IWalking, TheIWLine, SequenceOfIWLine; @@ -76,8 +78,8 @@ is ---Purpose: Defines a dynamic vector of integer. ---algorithme/resolution pour un cheminement sur intersection entre --- 2 surfaces biparametrees +--algorithm/solution for a marching on intersection between +-- 2 biparametric surfaces generic class PWalking, TheInt2S; diff --git a/src/IntWalk/IntWalk_IWalking.cdl b/src/IntWalk/IntWalk_IWalking.cdl index 7831423391..a1bea562d7 100755 --- a/src/IntWalk/IntWalk_IWalking.cdl +++ b/src/IntWalk/IntWalk_IWalking.cdl @@ -70,8 +70,8 @@ is -- consecutive points on a resulting polyline. -- Step is the maximum increment admitted between two -- consecutive points (in 2d space). - -- Epsilon est la tolerance au dela de laquelle 2 points - -- sont confondus + -- Epsilon is the tolerance beyond which 2 points + -- are confused. returns IWalking from IntWalk; @@ -82,8 +82,8 @@ is -- consecutive points on a resulting polyline. -- Step is the maximum increment admitted between two -- consecutive points (in 2d space). - -- Epsilon est la tolerance au dela de laquelle 2 points - -- sont confondus + -- Epsilon is the tolerance beyond which 2 points + -- are confused ---C++: inline diff --git a/src/IntWalk/IntWalk_IWalking_1.gxx b/src/IntWalk/IntWalk_IWalking_1.gxx index 4a9e21092a..8a85138e5a 100755 --- a/src/IntWalk/IntWalk_IWalking_1.gxx +++ b/src/IntWalk/IntWalk_IWalking_1.gxx @@ -68,21 +68,21 @@ void IntWalk_IWalking::Clear() } // *************************************************************************** - // etat1=12 pas tangent,pas passant - // etat1=11 tangent,pas passant - // etat1=2 pas tangent,passant - // etat1=1 tangent,passant - // lorsque un point a ete traite son etat devient negatif. + // etat1=12 not tangent, not passes + // etat1=11 tangent, not passes + // etat1=2 not tangent, passes + // etat1=1 tangent, passes + // after a point is processed its state becomes negative. // *************************************************************************** - // etat2=13 point de demarage interieur sur ligne ferme - // etat2=12 point de demarage interieur sur ligne ouverte - // (ligne initialement fermee -> la ligne s est ouverte) - // lorsque un point a ete traite (ou si on passe dessus lors du - // cheminement) son etat devient negatif. + // etat2=13 interior start point on closed line + // etat2=12 interior start point on open line + // (line initially closed -> la line s is open) + // after a point is processed (or if it is passed over during + // routing) its state becomes negative. // **************************************************************************** // -// Perform avec points interieurs +// Perform with interior points // void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1, const ThePOLIterator& Pnts2, @@ -102,7 +102,7 @@ void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1, reversed = Reversed; - // Chargement de etat1 et etat2 et des ustart et vstart. + // Loading of etat1 and etat2 as well as ustart and vstart. TColStd_SequenceOfReal Umult; TColStd_SequenceOfReal Vmult; @@ -119,7 +119,7 @@ void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1, if (!ThePointOfPathTool::IsTangent(PathPnt)) ++aWD1.etat; - if(aWD1.etat==2) { //-- lbr le 15 fev 99 + if(aWD1.etat==2) { aWD1.etat=11; } @@ -164,9 +164,9 @@ void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1, Func.Set(Caro); - // calcul de toutes les lignes ouvertes + // calculation of all open lines if (nbPnts1 != 0) ComputeOpenLine(Umult,Vmult,Pnts1,Func,Rajout); - // calcul de toutes les lignes fermees + // calculation of all closed lines 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)); @@ -177,7 +177,7 @@ void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1, // -// Perform sans point interieur +// Perform without interior point // void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1, @@ -194,7 +194,7 @@ void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1, reversed = Reversed; - // Chargement de etat1 et de ustart1 et vstart1. + // Loading of etat1 as well as ustart1 and vstart1. TColStd_SequenceOfReal Umult; TColStd_SequenceOfReal Vmult; diff --git a/src/IntWalk/IntWalk_IWalking_2.gxx b/src/IntWalk/IntWalk_IWalking_2.gxx index 00d22a4ef8..e29bf1f9ed 100755 --- a/src/IntWalk/IntWalk_IWalking_2.gxx +++ b/src/IntWalk/IntWalk_IWalking_2.gxx @@ -26,8 +26,8 @@ // _______________________________________________ // -// Cadrage d un point (u, v) dans le domaine naturel d une surface ET mise -// a jour du couple (u, v) pour le calcul du point suivant. +// Location of point (u, v) in the natural domain of a surface AND update +// of couple (u, v) for the calculation of the next point. // Standard_Boolean IntWalk_IWalking::Cadrage (math_Vector& BornInf, @@ -37,15 +37,14 @@ Standard_Boolean IntWalk_IWalking::Cadrage // Standard_Real& StepV, const Standard_Integer StepSign) const -// on a toujours : +// there are always : // BorInf(1) <= UVap(1) <= BornSup(1) et BorInf(2) <= UVap(2) <= BornSup(2) -// 1) on verifier si le point approche ne depasse pas le domaine naturel de -// la surface -// 2) si c est le cas on cadre le point approche sur frontiere en prenant la -// meilleure direction. On MODIFIE alors le pas d avancement et une des -// bornes bloquer un des parametres lors du prochain appel a FunctionSetRoot; -// 3) on recalcule couple (u, v) approche pour le le calcul du point suivant. -// 4) return Standard_True si cadrage, Standard_False si pas de cadrage. +// 1) check if the process point is out of the natural domain of the surface. +// 2) if yes the approximated point is located on border taking the best direction +// the step and a limit blocating one of the parameters during the recent call of +// FunctionSetRoot are modified; +// 3) couple (u, v) is recomputed by approximation for the calculation of the next point. +// 4) return Standard_True if location, Standard_False if no location. { Standard_Real Duvx = previousd2d.X(); Standard_Real Duvy = previousd2d.Y(); @@ -141,7 +140,7 @@ Standard_Boolean IntWalk_IWalking::Cadrage Standard_Real aStep = Abs((BornInf(1) - UVap(1)) / Duvx); // iso U =BornInf(1) if(aStep-tolv2)) { if(Index!=k) { //-- cout<<"* etat2 : ("< 0 && wd1[i].etat < 11) { //test des points passant + if (wd1[i].etat > 0 && wd1[i].etat < 11) { //test of crossing points Utest = wd1[i].ustart; Vtest = wd1[i].vstart; Utest/=deltau; @@ -522,12 +518,11 @@ Standard_Boolean IntWalk_IWalking::TestArretAjout Standard_Integer& Irang, IntSurf_PntOn2S& Psol) -// test d arret sur les points rajoutes -// ces points sont des points sur frontiere naturelle qui n ont pas ete -// donnes en entree -// on renvoit : Psol, le point rajoute. -// Irang, l index dans l iterateur des points rajoutes. -// UV, parametre du point rajoute. +// test of stop on added points +// these are the points on the natural biorder that were not given at input +// return : Psol, the added point. +// Irang, index in the iterator of added points. +// UV, parameter of the added point. // { Standard_Boolean Arrive = Standard_False; @@ -545,10 +540,10 @@ Standard_Boolean IntWalk_IWalking::TestArretAjout for (Standard_Integer i = 1; i <= nbAjout; i++) { Irang = seqAjout.Value(i); -// on rajoute le test Abs(Irang) <= lines.Length() pour le cas ou -// on ouvre une ligne fermee suite a l ajout 1 point sur cette meme -// ligne. De toute facon on a un gros pb , car on va avoir 2 points -// rajoutes sur cette ligne... +// add test Abs(Irang) <= lines.Length() for the case when +// a closed line is opened by adding a 1 point on this same +// line. Anyway there is a huge problem as 2 points will be +// added on this line... if (Abs(Irang) <= lines.Length()) { @@ -590,14 +585,13 @@ void IntWalk_IWalking::TestArretCadre math_Vector& UV, Standard_Integer& Irang) -// test d arret alors qu on est sur frontiere. -// on a essaye tous les tests d arret et on est arrive. -// test d arret sur les points donne au depart deja marques et sur -// l ensemble de la ligne courante. Cette ligne peut etre racourcie si -// on trouve in point d arret. -// Abs(Irang) = index dans l iterateur des points de depart ou 0 -// si Irang <0 , il faut ajouter ce point a la ligne ( pas de Line->Cut) -// UV = parametre du point de depart +// test of stop when located on border. +// tried all tests of stop and arrived. +// test of stop on all given departure points already marked and on the entire current line. +// This line can be shortened if the stop point is found. +// Abs(Irang) = index in the iterator of departure points or 0 +// if Irang <0 , it is necessary to add this point on the line (no Line->Cut) +// UV = parameter of the departure point { Standard_Real Scal, Up, Vp, Uc, Vc; Standard_Integer N; @@ -607,7 +601,7 @@ void IntWalk_IWalking::TestArretCadre Irang =0; for (Standard_Integer i = 1; i < (int)wd1.size(); i++) { if (wd1[i].etat < 0) { - N=0; // rang dans UVMult. + N=0; // range in UVMult. if (nbMultiplicities[i] > 0) { for (Standard_Integer k = 1; k < i; k++) N+=nbMultiplicities[k]; @@ -629,7 +623,7 @@ void IntWalk_IWalking::TestArretCadre Scal = (Up-wd1[i].ustart) * (Uc-wd1[i].ustart) + (Vp-wd1[i].vstart) * (Vc-wd1[i].vstart); - // si on a trouve un point d arret : on arrete la ligne sur ce point. + // if a stop point is found: stop the line on this point. if (Scal < 0) { Line->Cut(j); nbp= Line->NbPoints(); Irang = i; @@ -681,7 +675,7 @@ void IntWalk_IWalking::TestArretCadre gp_Vec Dir3d = sp.Direction3d(); gp_Vec Dir3d1 = gp_Vec(Line->Value(j-2).Value(),Line->Value(j-1).Value()); Standard_Real dot = Dir3d.Dot(Dir3d1); - if(dot<0.0) { // Normalement on ne doit pas passer souvent ds cette Fonction !!! + if(dot<0.0) { // Normally this Function should not be used often !!! Dir3d.Reverse(); //-- cout<<" IntWalk_IWalking_2.gxx REVERSE "< 5 && NbPointsConfondusConsecutifs == 8) { //-- Provisoire - if(epsilon>0.00000000001) epsilon*=0.5; //-- Provisoire - EpsilonSembleTropGrand = 0; //-- Provisoire + if(++EpsilonSembleTropGrand > 5 && NbPointsConfondusConsecutifs == 8) { //-- Temporary + if(epsilon>0.00000000001) epsilon*=0.5; //-- Temporary + EpsilonSembleTropGrand = 0; //-- Temporary } } else { - NbPointsConfondusConsecutifs = 0; //-- Provisoire - EpsilonSembleTropGrand = 0; //-- Provisoire - if(Norme<1e-16) Norme = 1e-16; //-- Provisoire + 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 !!!! @@ -93,7 +92,7 @@ IntWalk_StatusDeflection IntWalk_IWalking::TestDeflection else { Cosi2 = Cosi * Cosi / previousd3d.SquareMagnitude() / Norme; } - if (Cosi2 < CosRef3D) { //angle 3d trop grand + if (Cosi2 < CosRef3D) { //angle 3d too great Step = Step /2.0; StepU = Abs(Step*previousd2d.X()); StepV = Abs(Step*previousd2d.Y()); @@ -115,19 +114,19 @@ IntWalk_StatusDeflection IntWalk_IWalking::TestDeflection Standard_Real Dv = UV(2) - Paramv; Standard_Real Duv = Du * Du + Dv * Dv; if (Abs(Du) < tolerance(1) && Abs(Dv) < tolerance(2)) - return IntWalk_ArretSurPointPrecedent; //point confondu 2d + return IntWalk_ArretSurPointPrecedent; //confused point 2d Cosi = StepSign * (Du * previousd2d.X() + Dv * previousd2d.Y()); if (Cosi < 0 && Status == IntWalk_PointConfondu) - return IntWalk_ArretSurPointPrecedent; // on sort car retour arriere - // avec point confondu + return IntWalk_ArretSurPointPrecedent; // leave as step back + // with confused point if (sp.IsTangent()) return IntWalk_ArretSurPoint; -//si au cours du cheminement on a subdivise plus de MaxDivision pour chaque -//pas precedent,anomalie sur le carreau;on ne fait plus rien (experience U4) +//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 && @@ -148,7 +147,7 @@ IntWalk_StatusDeflection IntWalk_IWalking::TestDeflection Cosi = Corde * sp.Direction3d(); Cosi2 = Cosi * Cosi / sp.Direction3d().SquareMagnitude() / Norme; - if (Cosi2 < CosRef3D ){ //angle 3d trop grand + if (Cosi2 < CosRef3D ){ //angle 3d too great Step = Step / 2.; StepU = Abs(Step*previousd2d.X()); StepV = Abs(Step*previousd2d.Y()); @@ -163,7 +162,7 @@ IntWalk_StatusDeflection IntWalk_IWalking::TestDeflection Cosi2 = Cosi * Cosi / Duv; if (Cosi2 < CosRef2D || sp.Direction2d() * previousd2d < 0) { - //angle 2d trop grand ou changement de rive + //angle 2d too great or change the side Step = Step / 2.; StepU = Abs(Step*previousd2d.X()); StepV = Abs(Step*previousd2d.Y()); @@ -198,10 +197,10 @@ IntWalk_StatusDeflection IntWalk_IWalking::TestDeflection } else { -// on estime la fleche courante. -// si fleche/2<=flechecourante<= fleche on considere que le critere est -// respecte. -// sinon ajuster le pas en fonction du pas precedent +// 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.; @@ -219,16 +218,16 @@ IntWalk_StatusDeflection IntWalk_IWalking::TestDeflection Standard_Real FlecheCourante = Milieu.SquareDistance(POnCurv); */ - // Calcul direct : + // Direct calculation : // POnCurv=(((p1+p2)/2.+(p2+p3)/2.)/2. + ((p2+p3)/2.+(p3+P4)/2.)/2.)/2. - // soit POnCurv = p1/8. + 3.p2/8. + 3.p3/8. + p4/8. + // either POnCurv = p1/8. + 3.p2/8. + 3.p3/8. + p4/8. // Or p2 = p1 + lambda*d1 et p3 = p4 - lambda*d4 - // Donc POnCurv = (p1 + p4)/2. + 3.*(lambda d1 - lambda d4)/8. - // On calcule l'ecart avec (p1+p4)/2. . Il faut donc juste calculer - // la norme (au carre) de 3.*lambda (d1 - d4)/8. - // soit la norme de : + // 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. - // ce qui fait, en prenant le carre : + // which produces, takin the square : // Norme * (d1-d4).SquareMagnitude()/64. Standard_Real FlecheCourante = @@ -256,8 +255,8 @@ IntWalk_StatusDeflection IntWalk_IWalking::TestDeflection } else { -// if (FlecheCourante > fleche) { // pas trop grand - if (FlecheCourante > fleche*fleche) { // pas trop grand +// if (FlecheCourante > fleche) { // not too great + if (FlecheCourante > fleche*fleche) { // not too great Step = Step /2.; Status = IntWalk_PasTropGrand; } diff --git a/src/IntWalk/IntWalk_IWalking_6.gxx b/src/IntWalk/IntWalk_IWalking_6.gxx index e8166ba3c7..fab1e7c65f 100755 --- a/src/IntWalk/IntWalk_IWalking_6.gxx +++ b/src/IntWalk/IntWalk_IWalking_6.gxx @@ -81,7 +81,7 @@ void IntWalk_IWalking::OpenLine(const Standard_Integer N, const ThePOPIterator& Pnts1, TheIWFunction& sp, const Handle(IntWalk_TheIWLine)& Line ) -// **************** ouverture de la ligne et repartir dans l autre sens******** +// **************** open the line and restart in the other direction******** { ThePointOfPath PathPnt; @@ -102,9 +102,9 @@ void IntWalk_IWalking::OpenLine(const Standard_Integer N, previousd3d = sp.Direction3d(); previousd2d = sp.Direction2d(); - if (N>0) { //point de depart donne en entree + if (N>0) { //departure point given at input PathPnt = Pnts1.Value(N); - //marque la ligne comme ouverte avec point d arret donne + //mark the line as open with a given stop point Line->AddStatusFirst(Standard_False,Standard_True,N,PathPnt); @@ -114,7 +114,7 @@ void IntWalk_IWalking::OpenLine(const Standard_Integer N, else { if (N <0) Line->AddPoint(Psol); Line->AddStatusFirst(Standard_False,Standard_False); - //marque la ligne comme ouverte sans point d arret donne + //mark the line as open without given stop point } Line->Reverse(); //inverser la ligne Line->SetTangentVector(previousd3d.Reversed(),Line->NbPoints()); diff --git a/src/IntWalk/IntWalk_PWalking.cdl b/src/IntWalk/IntWalk_PWalking.cdl index 26a4d3b93a..f2501d5906 100755 --- a/src/IntWalk/IntWalk_PWalking.cdl +++ b/src/IntWalk/IntWalk_PWalking.cdl @@ -26,9 +26,9 @@ generic class PWalking from IntWalk ( ---Purpose: This class implements an algorithm to determine the - -- intersection between 2 parametrized surface, marching from + -- intersection between 2 parametrized surfaces, marching from -- a starting point. The intersection line - -- starts and ends on the natural surface 's boundaries . + -- starts and ends on the natural surface's boundaries . uses XY from gp, @@ -67,13 +67,12 @@ is -- solution point (each point of the line). -- It is necessary to call the Perform method to compute -- the intersection lines. - -- la ligne trouvee part d'un point sur ou dans les 2 domaines - -- naturelles des surfaces .Elle peut etre fermee ;dans les - -- cas standard si elle est ouverte elle s arrete et commence - -- a une frontiere d 'un des domaines.Si une ligne ouverte - -- s arrete en plein milieu d'un domaine ,on s'arrete sur - -- point de tangence. - -- Epsilon tolerance au carre de confusion de points + -- The line found starts at a point on or in 2 natural domains + -- of surfaces. It can be closed in the + -- standard case if it is open it stops and begins at the + -- border of one of the domains. If an open line + -- stops at the middle of a domain, one stops at the tangent point. + -- Epsilon is SquareTolerance of points confusion. returns PWalking; @@ -93,31 +92,30 @@ is -- TolTangency is the tolerance to find a tangent point. -- Func is the criterion which has to be evaluated at each -- solution point (each point of the line). - -- la ligne trouvee part d'un point sur ou dans les 2 domaines - -- naturelles des surfaces .Elle peut etre fermee ;dans les - -- cas standard si elle est ouverte elle s arrete et commence - -- a une frontiere d 'un des domaines.Si une ligne ouverte - -- s arrete en plein milieu d'un domaine ,on s'arrete sur - -- point de tangence. - -- Epsilon tolerance au carre de confusion de points + -- The line found starts at a point on or in 2 natural domains + -- of surfaces. It can be closed in the + -- standard case if it is open it stops and begins at the + -- border of one of the domains. If an open line + -- stops at the middle of a domain, one stops at the tangent point. + -- Epsilon is SquareTolerance of points confusion. returns PWalking; Perform(me :in out;ParDep : Array1OfReal from TColStd) - ---Purpose: calcule la ligne d 'intersection + ---Purpose: calculate the line of intersection is static; Perform(me :in out;ParDep : Array1OfReal from TColStd; u1min,v1min,u2min,v2min,u1max,v1max,u2max,v2max: Real from Standard) - ---Purpose: calcule la ligne d 'intersection le reglage des - -- pas est fait a partir des valeurs min max sur u et - -- v. (si ces donnees ne sont pas presentes comme - -- dans la methode precedente, les pas initiaux sont - -- calcules a partir des min max uv des faces). + ---Purpose: calculate the line of intersection. The regulation + -- of steps is done using min and max values on u and + -- v. (if this data is not presented as in the + -- previous method, the initial steps are calculated + -- starting from min and max uv of faces). is static; @@ -126,7 +124,7 @@ is ParDep : Array1OfReal from TColStd; FirstPoint: in out PntOn2S from IntSurf) - ---Purpose: calcule le premier point d'une ligne d'intersection + ---Purpose: calculate the first point of a line of intersection -- returns Boolean from Standard @@ -275,12 +273,12 @@ fields indextg : Integer from Standard; tgdir : Dir from gp; - fleche : Real from Standard; -- fleche maxi autorisee - pasMax : Real from Standard; -- ratio uv maximum autorise - tolconf : Real from Standard; -- tol de confusion de 2 points - pasuv : Real from Standard[4];-- pas uv sur les caros - pasSav : Real from Standard[4];-- premier pas sauvegarde - pasInit : Real from Standard[4];-- sauvegarde des pas + fleche : Real from Standard; -- max possible vector + pasMax : Real from Standard; -- max possible uv ratio + tolconf : Real from Standard; -- tol of confusion of 2 points + pasuv : Real from Standard[4];-- uv step on squares + pasSav : Real from Standard[4];-- first saved step + pasInit : Real from Standard[4];-- saving of steps Um1 : Real from Standard; UM1 : Real from Standard; @@ -299,9 +297,9 @@ fields sensCheminement : Integer from Standard; choixIsoSav : ConstIsoparametric from IntImp; - -- sauvegarde du choix 1 iere iso + -- save 1st iso choice previousPoint : PntOn2S from IntSurf; - -- point d 'intersection precedent + -- previous intersection point previoustg : Boolean from Standard; previousd : Dir from gp; previousd1 : Dir2d from gp; diff --git a/src/IntWalk/IntWalk_PWalking_1.gxx b/src/IntWalk/IntWalk_PWalking_1.gxx index f65b202f50..84a8023af5 100755 --- a/src/IntWalk/IntWalk_PWalking_1.gxx +++ b/src/IntWalk/IntWalk_PWalking_1.gxx @@ -28,8 +28,8 @@ //================================================================================== // function : IntWalk_PWalking::IntWalk_PWalking // purpose : -// estimation des max pas : Pour eviter des changenets -// trop brusques lors des changements d isos +// estimate of max step : To avoid abrupt changes +// during change of isos //================================================================================== void ComputePasInit(Standard_Real *pasuv, Standard_Real Um1,Standard_Real UM1, @@ -54,9 +54,9 @@ void ComputePasInit(Standard_Real *pasuv, Standard_Real _du2=Abs(_UM2-_Um2); Standard_Real _dv2=Abs(_VM2-_Vm2); - //-- On limite la reduction de l estimation de la boite uv a 0.01 la boite naturelle - //-- du1 : Sur boite des Inter - //-- _du1 : Sur espace parametrique + //-- limit the reduction of uv box estimate to 0.01 natural box + //-- du1 : On box of Inter + //-- _du1 : On parametric space if(_du1<1e50 && du1<0.01*_du1) du1=0.01*_du1; if(_dv1<1e50 && dv1<0.01*_dv1) dv1=0.01*_dv1; if(_du2<1e50 && du2<0.01*_du2) du2=0.01*_du2; @@ -90,7 +90,7 @@ IntWalk_PWalking::IntWalk_PWalking(const ThePSurface& Caro1, { Standard_Real KELARG=20.; // - pasMax=Increment*0.2; //-- le 25 juin 99 suite a des pbs de precision + pasMax=Increment*0.2; //-- June 25 99 after problems with precision Um1 = ThePSurfaceTool::FirstUParameter(Caro1); Vm1 = ThePSurfaceTool::FirstVParameter(Caro1); UM1 = ThePSurfaceTool::LastUParameter(Caro1); @@ -230,7 +230,7 @@ IntWalk_PWalking::IntWalk_PWalking(const ThePSurface& Caro1, { Standard_Real KELARG=20.; // - pasMax=Increment*0.2; //-- le 25 juin 99 suite a des pbs de precision + pasMax=Increment*0.2; //-- June 25 99 after problems with precision // Um1 = ThePSurfaceTool::FirstUParameter(Caro1); Vm1 = ThePSurfaceTool::FirstVParameter(Caro1); @@ -386,7 +386,7 @@ Standard_Boolean IntWalk_PWalking::PerformFirstPoint (const TColStd_Array1OfRea aTmp = ParDep(i); Param(i) = ParDep(i); } - //-- calcul du premier point solution + //-- calculate the first solution point math_FunctionSetRoot Rsnld(myIntersectionOn2S.Function()); // myIntersectionOn2S.Perform(Param,Rsnld); @@ -475,13 +475,13 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep, aTmp=ParDep(i); Param(i)=ParDep(i); } - //-- reprise des pas uv lies aux surfaces Caro1 et Caro2 - //-- pasuv[] et pasSav[] sont modifies lors du cheminement + //-- reproduce steps uv connected to surfaces Caro1 and Caro2 + //-- pasuv[] and pasSav[] are modified during the marching for(i = 0; i < 4; ++i) { pasMaxSV[i] = pasSav[i] = pasuv[i] = pasInit[i]; } - //-- calcul du premier point solution + //-- calculate the first solution point math_FunctionSetRoot Rsnld(myIntersectionOn2S.Function()); // ChoixIso = myIntersectionOn2S.Perform(Param,Rsnld); @@ -517,9 +517,9 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep, tgfirst = tglast = Standard_False; choixIsoSav = ChoixIso; //------------------------------------------------------------ - //-- On Teste si le premier point de cheminement correspond - //-- a un point sur frontiere. - //-- Dans ce cas, DejaReparti est initialise a True + //-- Test if the first point of marching corresponds + //-- to a point on borders. + //-- In this case, DejaReparti is initialized as True //-- pf = previousPoint.Value(); Standard_Boolean bTestFirstPoint = Standard_True; @@ -599,7 +599,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep, ChoixIso= myIntersectionOn2S.Perform(Param, Rsnld, ChoixIso); // if (!myIntersectionOn2S.IsDone()) { - //arret de la ligne,division + //end of line, division Arrive = Standard_False; Param(1)=SvParam[0]; Param(2)=SvParam[1]; @@ -608,7 +608,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep, RepartirOuDiviser(DejaReparti, ChoixIso, Arrive); } else {//009 - //== Le calcul du point exact a partir de Param(.) est possible + //== Calculation of exact point from Param(.) is possible if (myIntersectionOn2S.IsEmpty()) { Standard_Real u1,v1,u2,v2; previousPoint.Parameters(u1,v1,u2,v2); @@ -638,7 +638,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep, } else {//008 //============================================================ - //== Un point a ete trouve : T E S T D E F L E C T I O N + //== A point has been found : T E S T D E F L E C T I O N //============================================================ if(NoTestDeflection) { NoTestDeflection = Standard_False; @@ -797,7 +797,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep, case IntWalk_OK: case IntWalk_ArretSurPoint: {//006 //======================================================= - //== T e s t A r r e t : Cadrage sur Param(.) == + //== Stop Test t : Frame on Param(.) == //======================================================= //xft arrive here Arrive = TestArret(DejaReparti,Param,ChoixIso); @@ -807,7 +807,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep, if(Arrive==Standard_False && Status==IntWalk_ArretSurPoint) { Arrive=Standard_True; #ifdef DEB - cout << "Compile avec option DEB :Si Pb d intersection : "; + cout << "Compile with option DEB : if problems with intersection : "; cout << "IntWalk_PWalking_1.gxx (lbr le 1erdec98)"< MaxAngle && + Abs(PrevToParamOnS2.Angle(PrevToCurOnS2)) > MaxAngle) + { + Arrive = Standard_True; + break; + } + } + //////////////////////////////////////// AddAPoint(line,previousPoint); RejectIndex++; if(RejectIndex >= 250000) { @@ -1040,20 +1065,20 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep, } } }//else !TestArret() $ - } //$$ fin succes cadrage sur frontiere (!myIntersectionOn2S.IsEmpty()) + } //$$ end successful framing on border (!myIntersectionOn2S.IsEmpty()) else { - //echec cadrage sur frontiere;division du pas + //echec framing on border; division of step Arrive = Standard_False; NoTestDeflection = Standard_True; RepartirOuDiviser(DejaReparti,ChoixIso,Arrive); } - }//$$$ fin cadrage sur frontiere (!close) - } //004 fin TestArret retourne Arrive = True - } // 006case IntWalk_ArretSurPoint: fin Traitement Status = OK ou ArretSurPoint + }//$$$ end framing on border (!close) + } //004 fin TestArret return Arrive = True + } // 006case IntWalk_ArretSurPoint: end Processing Status = OK or ArretSurPoint } //007 switch(Status) - } //008 fin traitement point en court (TEST DEFLECTION) - } //009 fin traitement ligne (else if myIntersectionOn2S.IsDone()) - } //010 fin si premier point de depart a permis un cheminement while(!Arrive) + } //008 end processing point (TEST DEFLECTION) + } //009 end processing line (else if myIntersectionOn2S.IsDone()) + } //010 end if first departure point allows marching while (!Arrive) done = Standard_True; } // =========================================================================================================== diff --git a/src/IntWalk/IntWalk_PWalking_2.gxx b/src/IntWalk/IntWalk_PWalking_2.gxx index c1025af812..db345cf9b5 100755 --- a/src/IntWalk/IntWalk_PWalking_2.gxx +++ b/src/IntWalk/IntWalk_PWalking_2.gxx @@ -27,14 +27,14 @@ void IntWalk_PWalking:: IntImp_ConstIsoparametric& ChoixIso, Standard_Boolean& Arrive) -// au voisinage d '1 point ,il y a echec du cheminement -// il faut diviser le pas pour essayer de continuer -//si le pas est trop petit ou si on est arrive sur une frontiere -// repartir dans l autre sens si cela n a pas ete deja fait sinon arret +// at the neighborhood of a point, there is a fail of marching +// it is required to divide the steps to try to continue +// if the step is too small if we are on border +// restart in another direction if it was not done, otherwise stop { // Standard_Integer i; - if (Arrive) { //repartir dans l autre sens + if (Arrive) { //restart in the other direction if (!DejaReparti ) { Arrive = Standard_False; DejaReparti = Standard_True; @@ -80,10 +80,10 @@ void IntWalk_PWalking:: && pasuv[3]*0.5 < ResoV2 ) { if (!previoustg) { - tglast = Standard_True; // EST-CE SUFFISANT ???? + tglast = Standard_True; // IS IT ENOUGH ???? } - if (!DejaReparti) { //repartir dans l autre sens + if (!DejaReparti) { //restart in the other direction DejaReparti = Standard_True; previousPoint = line->Value(1); previoustg = Standard_False; diff --git a/src/IntWalk/IntWalk_PWalking_3.gxx b/src/IntWalk/IntWalk_PWalking_3.gxx index 054377e891..e4b1cbad3f 100755 --- a/src/IntWalk/IntWalk_PWalking_3.gxx +++ b/src/IntWalk/IntWalk_PWalking_3.gxx @@ -30,18 +30,18 @@ static const Standard_Real d = 7.0; IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection() -// tester si fleche respectee en calculant un majorant de fleche -// soit le point precedent et sa tangente ,le point nouveau calcule et sa -// tangente ;on peut trouver une cubique passant par ces 2 points et ayant -// pour derivee les tangentes de l intersection -// calculer le point au parametre 0.5 sur la cubique=p1 -// calculer le point milieu des 2 points d intersection=p2 -// si fleche/2<=||p1p2||<= fleche on considere que l on respecte la fleche -// sinon ajuster le pas en fonction du rapport ||p1p2||/fleche et du pas -// precedent -// tester si dans les 2 plans tangents des surfaces on a pas un angle2d trop -// grand : si oui diviser le pas -// tester s il n y a pas changement de rive +// test if vector is observed by calculating an increase of vector +// or the previous point and its tangent, the new calculated point and its +// tangent; it is possible to find a cube passing by the 2 points and having as a +// derivative the tangents of the intersection +// calculate the point with parameter 0.5 on cube=p1 +// calculate the medium point of 2 points of intersection=p2 +// if arrow/2<=||p1p2||<= arrow consider that the vector is observed +// otherwise adjust the step depending on the ratio ||p1p2||/vector +// and the previous step +// test if in 2 tangent planes of surfaces there is no too great angle2d +// grand : if yes divide the step +// test if there is no change of side // { if(line->NbPoints() ==1 ) { @@ -54,7 +54,7 @@ IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection() const IntSurf_PntOn2S& CurrentPoint = myIntersectionOn2S.Point(); //================================================================================== - //========= A r r e t s u r p o i n t ============ + //========= S t o p o n p o i n t ============ //================================================================================== if (myIntersectionOn2S.IsTangent()) { return IntWalk_ArretSurPoint; @@ -63,14 +63,14 @@ IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection() const gp_Dir& TgCourante = myIntersectionOn2S.Direction(); //================================================================================== - //========= R i s q u e d e p o i n t d i n f l e x i o n ============ + //========= R i s k o f i n f l e x i o n p o i n t ============ //================================================================================== if (TgCourante.Dot(previousd)<0) { //------------------------------------------------------------ - //-- Risque de point d inflexion : On divise le pas par 2 - //-- On initialise STATIC_PRECEDENT_INFLEXION pour qu a - //-- l appel suivant, on retourne Pas_OK si il n y a - //-- plus de risque de point d inflexion + //-- Risk of inflexion point : Divide the step by 2 + //-- Initialize STATIC_PRECEDENT_INFLEXION so that + //-- at the next call to return Pas_OK if there is no + //-- more risk of the point of inflexion //------------------------------------------------------------ pasuv[0]*=0.5; @@ -92,7 +92,7 @@ IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection() } //================================================================================== - //========= D e t e c t i o n d e P o in t s c o n f o n d u s =========== + //========= D e t e c t c o n f u s e d P o in t s =========== //================================================================================== Standard_Real Dist = previousPoint.Value(). @@ -122,7 +122,7 @@ IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection() AbsDv1 = Abs(Dv1); AbsDv2 = Abs(Dv2); //================================================================================= - //==== P a s d e p r o g r e s s i o n (entre previous et Current) ======= + //==== S t e p o f p r o g r e s s i o n (between previous and Current) ======= //================================================================================= if ( AbsDu1 < ResoU1 && AbsDv1 < ResoV1 && AbsDu2 < ResoU2 && AbsDv2 < ResoV2) { @@ -176,10 +176,10 @@ IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection() CosRef2 = CosRef2D/tolCoeff2; // //================================================================================== - //== Les points ne sont pas confondus : == - //== D e t e c t i o n d e A r r e t s u r P o i n t p r e c e d e n t == - //== P a s T r o p G r a n d (angle dans Esp UV) == - //== C h a n g e m e n t d e r i v e == + //== The points are not confused : == + //== D e t e c t t h e S t o p a t p r e v i o u s p o i n t == + //== N o t T o o G r e a t (angle in space UV) == + //== C h a n g e o f s i d e == //================================================================================== if (Status != IntWalk_PointConfondu) { if(Cosi1*Cosi1 < CosRef1*Duv1 || Cosi2*Cosi2 < CosRef2*Duv2) { @@ -201,8 +201,8 @@ IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection() AngRef1 = AngRef2D*tolCoeff1; AngRef2 = AngRef2D*tolCoeff2; //------------------------------------------------------- - //-- Test : Angle trop grand dans l espace UV ----- - //-- Changement de rive ----- + //-- Test : Angle too great in space UV ----- + //-- Change of side ----- //------------------------------------------------------- if(Cosi1*Cosi1 < CosRef1*Duv1 || Cosi2*Cosi2 < CosRef2*Duv2 || Ang1 > AngRef1 || Ang2 > AngRef2) { pasuv[0]*=0.5; pasuv[1]*=0.5; pasuv[2]*=0.5; pasuv[3]*=0.5; @@ -214,17 +214,17 @@ IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection() } //<-OCC431(apo) //================================================================================== - //== D e t e c t i o n d e : Pas Trop Petit - //== Pas Trop Grand + //== D e t e c t i o n o f : Step Too Small + //== STEP TOO Great //================================================================================== //--------------------------------------- - //-- Estimation de la fleche -- + //-- Estimate of the vector -- //--------------------------------------- FlecheCourante = Sqrt(Abs((previousd.XYZ()-TgCourante.XYZ()).SquareModulus()*Dist))/8.; - if ( FlecheCourante<= fleche*0.5) { //-- Pas Courant trop petit + if ( FlecheCourante<= fleche*0.5) { //-- Current step too small if(FlecheCourante>1e-16) { Ratio = 0.5*(fleche/FlecheCourante); } @@ -236,9 +236,9 @@ IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection() Standard_Real pasSu2 = pasuv[2]; Standard_Real pasSv2 = pasuv[3]; - //-- Dans les cas ou lorsqu on demande - //-- un point a U+DeltaU , .... - //-- on recupere un point a U + Epsilon + //-- In case if + //-- a point at U+DeltaU is required, .... + //-- return a point at U + Epsilon //-- Epsilon << DeltaU. if(pasuv[0]< AbsDu1) pasuv[0] = AbsDu1; @@ -269,12 +269,12 @@ IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection() } if(Status == IntWalk_OK) { STATIC_BLOCAGE_SUR_PAS_TROP_GRAND=0; - //-- On tente d augmenter le pas + //-- Try to increase the step } return Status; } - else { //-- FlecheCourante > fleche*0.5 - if (FlecheCourante > fleche) { //-- Pas Courant Trop Grand + else { //-- CurrentVector > vector*0.5 + if (FlecheCourante > fleche) { //-- Current step too Great Ratio = fleche/FlecheCourante; pasuv[0] = Ratio*pasuv[0]; pasuv[1] = Ratio*pasuv[1]; @@ -285,7 +285,7 @@ IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection() return IntWalk_PasTropGrand; //} } - else { //-- fleche/2 < FlecheCourante <= fleche + else { //-- vector/2 < CurrentVector <= vector Ratio = 0.75 * (fleche / FlecheCourante); } } diff --git a/src/IntWalk/IntWalk_PWalking_4.gxx b/src/IntWalk/IntWalk_PWalking_4.gxx index 69dacc3579..c07dbbbd37 100755 --- a/src/IntWalk/IntWalk_PWalking_4.gxx +++ b/src/IntWalk/IntWalk_PWalking_4.gxx @@ -17,16 +17,15 @@ // and conditions governing the rights and limitations under the License. //-- -//-- Modif du 5 Octobre 94 (LBR) +//-- Modif of 5 October 94 (LBR) //-- if(Trouve) ... -//-- On deborde sur une frontiere, Duv[.] = -1 -1 -1 -1 -//-- donc on garde la meme iso bloquee (voir if(k!=1) ) +//-- outpasses a border, Duv[.] = -1 -1 -1 -1 +//-- keep the same iso limited (see if(k!=1) ) //-- -//-- Modif du 8 juillet 96 (LBR) -//-- simplifaication du traitement des auto-intersections. -//-- Idee : -//-- Tester la boucle fermee en 3d et en 2d. +//-- Modif of 8 July 96 (LBR) +//-- simplify processing of auto-intersections. +//-- Idea : Test closed loop in 3d and in 2d. //-- #include @@ -38,11 +37,11 @@ Standard_Boolean IntWalk_PWalking:: IntImp_ConstIsoparametric& ChoixIso) // -// tester si le point d intersection donne par ces parametres reste dans le -// domaine naturelle de chaque carreau. -// si le point deborde cadrer de facon a trouver la meilleure iso (frontiere) -// qui intersecte le plus franchement l autre carreau -// sinon tester si presence de ligne fermee +// test if the point of intersection set by these parameters remains in the +// natural domain of each square. +// if the point outpasses reframe to find the best iso (border) +// that intersects easiest the other square +// otherwise test if closed line is present // { Standard_Real Uvd[4],Uvf[4],Epsuv[4],Duv[4],Uvp[4],dv,dv2,ParC[4]; @@ -53,6 +52,10 @@ Standard_Boolean IntWalk_PWalking:: Epsuv[2] = ResoU2; Epsuv[3] = ResoV2; previousPoint.Parameters(Uvp[0],Uvp[1],Uvp[2],Uvp[3]); + + Standard_Real SolParam[4]; + myIntersectionOn2S.Point().Parameters(SolParam[0],SolParam[1],SolParam[2],SolParam[3]); + Standard_Boolean Trouve = Standard_False; Uvd[0]=Um1; Uvf[0]=UM1; Uvd[1]=Vm1; Uvf[1]=VM1; @@ -66,35 +69,39 @@ Standard_Boolean IntWalk_PWalking:: case 3: k=4; break; case 4: k=3; break; } - if (Param(i) < (Uvd[im1]-Epsuv[im1])) { //-- Current ----- Bound Inf ----- Previous + if (Param(i) < (Uvd[im1]-Epsuv[im1]) || + SolParam[im1] < (Uvd[im1]-Epsuv[im1])) //-- Current ----- Bound Inf ----- Previous + { Trouve = Standard_True; //-- DPc = Uvp[im1]-Param(i); //-- Previous - Current DPb = Uvp[im1]-Uvd[im1]; //-- Previous - Bound Inf ParC[im1] = Uvd[im1]; //-- ParamCorrige - dv = Param(k)-Uvp[k-1]; //-- Current - Previous (Sur Autre Direction) + dv = Param(k)-Uvp[k-1]; //-- Current - Previous (other Direction) dv2 = dv*dv; - if(dv2>RealEpsilon()) { //-- Progression sur l autre Direction ? + if(dv2>RealEpsilon()) { //-- Progress at the other Direction ? Duv[im1] = DPc*DPb + dv2; Duv[im1] = Duv[im1]*Duv[im1]/(DPc*DPc+dv2)/(DPb*DPb+dv2); } else { - Duv[im1]=-1.0; //-- Si Pas de prgogression, on ne change pas - } //-- le choix de l iso + Duv[im1]=-1.0; //-- If no progress, do not change + } //-- the choice of iso } - else if (Param(i) > (Uvf[im1] + Epsuv[im1])) { //-- Previous ----- Bound Sup ----- Current + else if (Param(i) > (Uvf[im1] + Epsuv[im1]) || + SolParam[im1] > (Uvf[im1] + Epsuv[im1]))//-- Previous ----- Bound Sup ----- Current + { Trouve = Standard_True; //-- DPc = Param(i)-Uvp[im1]; //-- Current - Previous DPb = Uvf[im1]-Uvp[im1]; //-- Bound Sup - Previous ParC[im1] = Uvf[im1]; //-- Param Corrige - dv = Param(k)-Uvp[k-1]; //-- Current - Previous (Sur autre Direction) + dv = Param(k)-Uvp[k-1]; //-- Current - Previous (other Direction) dv2 = dv*dv; - if(dv2>RealEpsilon()) { //-- Progression sur l autre Direction ? + if(dv2>RealEpsilon()) { //-- Progress in other Direction ? Duv[im1] = DPc*DPb + dv2; Duv[im1] = Duv[im1]*Duv[im1]/(DPc*DPc+dv2)/(DPb*DPb+dv2); } else { - Duv[im1]=-1.0; //-- Si Pas de prgogression, on ne change pas - } //-- le choix de l iso + Duv[im1]=-1.0; //-- If no progress, do not change + } //-- the choice of iso } else { Duv[im1]= -1.; @@ -104,10 +111,10 @@ Standard_Boolean IntWalk_PWalking:: if (Trouve) { //-------------------------------------------------- - //-- Un des Parametres u1,v1,u2,v2 est en dehors -- - //-- des bornes naturelles. -- - //-- On cherche la meilleure direction de -- - //-- progression et on recadre les params. -- + //-- One of Parameters u1,v1,u2,v2 is outside of -- + //-- the natural limits. -- + //-- Find the best direction of -- + //-- progress and reframe the parameters. -- //-------------------------------------------------- Standard_Real ddv = -1.0; k=-1; @@ -140,7 +147,7 @@ Standard_Boolean IntWalk_PWalking:: } else { - if (!DejaReparti) { // recherche si ligne fermee + if (!DejaReparti) { // find if line closed Standard_Real u,v; const IntSurf_PntOn2S& POn2S1=line->Value(1); diff --git a/tests/bugs/end b/tests/bugs/end index 595dcc8870..1431d0af14 100755 --- a/tests/bugs/end +++ b/tests/bugs/end @@ -2,6 +2,7 @@ if { [info exists square] } { set prop "square" set mass $square if { [info exists tol_square] } { + # tol_square - The epsilon defines relative precision of computation regexp {Mass +: +([-0-9.+eE]+)} [sprops result $tol_square] full m } else { regexp {Mass +: +([-0-9.+eE]+)} [sprops result] full m diff --git a/tests/bugs/modalg_1/buc60533 b/tests/bugs/modalg_1/buc60533 index fb1523a9da..6d6a276cc7 100755 --- a/tests/bugs/modalg_1/buc60533 +++ b/tests/bugs/modalg_1/buc60533 @@ -66,5 +66,5 @@ copy r_1 result # An exception was caught Standard_ConstructionError: # ** Exception ** Standard_ConstructionError: -set square 1.63191e+07 +set square 1.65227e+07 set 2dviewer 0 diff --git a/tests/bugs/modalg_5/bug24140 b/tests/bugs/modalg_5/bug24140 new file mode 100755 index 0000000000..f28a12d40c --- /dev/null +++ b/tests/bugs/modalg_5/bug24140 @@ -0,0 +1,29 @@ +puts "============" +puts "OCC24140" +puts "============" +puts "" +###################################################### +# Endless loop in BRepAlgoAPI_Section +###################################################### + +pload XDE + +ReadStep D [locate_data_file bug24140_bug663.stp] +XGetShape sh1 D 0:1:1:1 +XGetShape sh2 D 0:1:1:2 + +bsection result sh1 sh2 + +set length 557.6 + +set nb_v_good 1 +set nb_e_good 1 +set nb_w_good 0 +set nb_f_good 0 +set nb_sh_good 0 +set nb_sol_good 0 +set nb_compsol_good 0 +set nb_compound_good 1 +set nb_shape_good 3 + +set 2dviewer 1