1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-21 10:13:43 +03:00

0024140: Endless loop in BRepAlgoAPI_Section

Test cases for issue CR24140
This commit is contained in:
jgv 2013-10-03 15:47:26 +04:00 committed by bugmaster
parent 59fcbcaeaa
commit b1c5c4e6a6
15 changed files with 414 additions and 303 deletions

View File

@ -61,6 +61,11 @@ static
const Handle(Adaptor3d_HSurface)& Surf2, const Handle(Adaptor3d_HSurface)& Surf2,
IntPatch_SequenceOfLine& aSLin); 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, static Standard_Boolean IsPointOnLine(const IntSurf_PntOn2S &thePOn2S,
const Handle(IntPatch_WLine) &theWLine, const Handle(IntPatch_WLine) &theWLine,
const Standard_Real Deflection); const Standard_Real Deflection);
@ -1310,6 +1315,12 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)&
UmaxLig2 = Surf2->LastUParameter(); UmaxLig2 = Surf2->LastUParameter();
VmaxLig2 = Surf2->LastVParameter(); 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); IntSurf_ListIteratorOfListOfPntOn2S IterLOP1(LOfPnts);
for(; IterLOP1.More(); IterLOP1.Next()){ for(; IterLOP1.More(); IterLOP1.Next()){
@ -1537,7 +1548,10 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)&
Standard_Integer iP; Standard_Integer iP;
for( iP = 1; iP <= cNbP; iP++) { for( iP = 1; iP <= cNbP; iP++) {
if( pI == 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)) else if(removeNext && iP == (pI + 1))
continue; continue;
else if(removePrev && iP == (pI - 1)) else if(removePrev && iP == (pI - 1))
@ -1830,6 +1844,39 @@ void AdjustOnPeriodic(const Handle(Adaptor3d_HSurface)& Surf1,
}//for (j=0; j<1; ++j) { }//for (j=0; j<1; ++j) {
}//for (i=1; i<=aNbLines; ++i) }//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 // function : Perform
// purpose : base SS Int. function // purpose : base SS Int. function
@ -1860,6 +1907,13 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
D1->VParameters(aVpars1); D1->VParameters(aVpars1);
D2->UParameters(anUpars2); D2->UParameters(anUpars2);
D2->VParameters(aVpars2); 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; Limit = 2500;
if((NbU1*NbV1<=Limit && NbV2*NbU2<=Limit)) { if((NbU1*NbV1<=Limit && NbV2*NbU2<=Limit)) {
@ -2243,7 +2297,10 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
Standard_Integer iP; Standard_Integer iP;
for( iP = 1; iP <= cNbP; iP++) { for( iP = 1; iP <= cNbP; iP++) {
if( pI == 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)) else if(removeNext && iP == (pI + 1))
continue; continue;
else if(removePrev && iP == (pI - 1)) else if(removePrev && iP == (pI - 1))

View File

@ -22,7 +22,7 @@
package IntWalk package IntWalk
---Purpose: This package defines the "walking" (marching?)algorithmes ---Purpose: This package defines the "walking" (marching) algorithmes
-- for the intersection between two surfaces. -- for the intersection between two surfaces.
-- One of the surfaces is a parametric one. -- One of the surfaces is a parametric one.
-- If the other is an implicit one, the "IWalking" class will -- If the other is an implicit one, the "IWalking" class will
@ -43,13 +43,15 @@ is
PasTropGrand, PointConfondu, ArretSurPointPrecedent, PasTropGrand, PointConfondu, ArretSurPointPrecedent,
ArretSurPoint, OK; ArretSurPoint, OK;
-- classe definition ressource sur surface biparametree -- StepTooGreat, ConfusedPoint, StopOnPreviousPoint, StopOnPoint, OK
-- class for definition of ressources on a biparametric surface
deferred generic class PSurfaceTool; deferred generic class PSurfaceTool;
-- classes de definition pour algorithme cheminement sur une -- classes for definition of marching algorithm on a
-- surface biparametree -- biparametric surface
deferred generic class PathPointTool; deferred generic class PathPointTool;
@ -60,12 +62,12 @@ is
generic class Iterator; 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; generic class IWLine;
--algorithme cheminement/resolution --algorithm marching/solution
generic class IWalking, TheIWLine, SequenceOfIWLine; generic class IWalking, TheIWLine, SequenceOfIWLine;
@ -76,8 +78,8 @@ is
---Purpose: Defines a dynamic vector of integer. ---Purpose: Defines a dynamic vector of integer.
--algorithme/resolution pour un cheminement sur intersection entre --algorithm/solution for a marching on intersection between
-- 2 surfaces biparametrees -- 2 biparametric surfaces
generic class PWalking, TheInt2S; generic class PWalking, TheInt2S;

View File

@ -70,8 +70,8 @@ is
-- consecutive points on a resulting polyline. -- consecutive points on a resulting polyline.
-- Step is the maximum increment admitted between two -- Step is the maximum increment admitted between two
-- consecutive points (in 2d space). -- consecutive points (in 2d space).
-- Epsilon est la tolerance au dela de laquelle 2 points -- Epsilon is the tolerance beyond which 2 points
-- sont confondus -- are confused.
returns IWalking from IntWalk; returns IWalking from IntWalk;
@ -82,8 +82,8 @@ is
-- consecutive points on a resulting polyline. -- consecutive points on a resulting polyline.
-- Step is the maximum increment admitted between two -- Step is the maximum increment admitted between two
-- consecutive points (in 2d space). -- consecutive points (in 2d space).
-- Epsilon est la tolerance au dela de laquelle 2 points -- Epsilon is the tolerance beyond which 2 points
-- sont confondus -- are confused
---C++: inline ---C++: inline

View File

@ -68,21 +68,21 @@ void IntWalk_IWalking::Clear()
} }
// *************************************************************************** // ***************************************************************************
// etat1=12 pas tangent,pas passant // etat1=12 not tangent, not passes
// etat1=11 tangent,pas passant // etat1=11 tangent, not passes
// etat1=2 pas tangent,passant // etat1=2 not tangent, passes
// etat1=1 tangent,passant // etat1=1 tangent, passes
// lorsque un point a ete traite son etat devient negatif. // after a point is processed its state becomes negative.
// *************************************************************************** // ***************************************************************************
// etat2=13 point de demarage interieur sur ligne ferme // etat2=13 interior start point on closed line
// etat2=12 point de demarage interieur sur ligne ouverte // etat2=12 interior start point on open line
// (ligne initialement fermee -> la ligne s est ouverte) // (line initially closed -> la line s is open)
// lorsque un point a ete traite (ou si on passe dessus lors du // after a point is processed (or if it is passed over during
// cheminement) son etat devient negatif. // routing) its state becomes negative.
// **************************************************************************** // ****************************************************************************
// //
// Perform avec points interieurs // Perform with interior points
// //
void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1, void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1,
const ThePOLIterator& Pnts2, const ThePOLIterator& Pnts2,
@ -102,7 +102,7 @@ void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1,
reversed = Reversed; 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 Umult;
TColStd_SequenceOfReal Vmult; TColStd_SequenceOfReal Vmult;
@ -119,7 +119,7 @@ void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1,
if (!ThePointOfPathTool::IsTangent(PathPnt)) if (!ThePointOfPathTool::IsTangent(PathPnt))
++aWD1.etat; ++aWD1.etat;
if(aWD1.etat==2) { //-- lbr le 15 fev 99 if(aWD1.etat==2) {
aWD1.etat=11; aWD1.etat=11;
} }
@ -164,9 +164,9 @@ void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1,
Func.Set(Caro); Func.Set(Caro);
// calcul de toutes les lignes ouvertes // calculation of all open lines
if (nbPnts1 != 0) ComputeOpenLine(Umult,Vmult,Pnts1,Func,Rajout); 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); if (nbPnts2 != 0) ComputeCloseLine(Umult,Vmult,Pnts1,Pnts2,Func,Rajout);
for (I = 1; I <= nbPnts1; I++) { for (I = 1; I <= nbPnts1; I++) {
if (wd1[I].etat >0) seqSingle.Append(Pnts1(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, void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1,
@ -194,7 +194,7 @@ void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1,
reversed = Reversed; reversed = Reversed;
// Chargement de etat1 et de ustart1 et vstart1. // Loading of etat1 as well as ustart1 and vstart1.
TColStd_SequenceOfReal Umult; TColStd_SequenceOfReal Umult;
TColStd_SequenceOfReal Vmult; TColStd_SequenceOfReal Vmult;

View File

@ -26,8 +26,8 @@
// _______________________________________________ // _______________________________________________
// //
// Cadrage d un point (u, v) dans le domaine naturel d une surface ET mise // Location of point (u, v) in the natural domain of a surface AND update
// a jour du couple (u, v) pour le calcul du point suivant. // of couple (u, v) for the calculation of the next point.
// //
Standard_Boolean IntWalk_IWalking::Cadrage Standard_Boolean IntWalk_IWalking::Cadrage
(math_Vector& BornInf, (math_Vector& BornInf,
@ -37,15 +37,14 @@ Standard_Boolean IntWalk_IWalking::Cadrage
// Standard_Real& StepV, // Standard_Real& StepV,
const Standard_Integer StepSign) const const Standard_Integer StepSign) const
// on a toujours : // there are always :
// BorInf(1) <= UVap(1) <= BornSup(1) et BorInf(2) <= UVap(2) <= BornSup(2) // 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 // 1) check if the process point is out of the natural domain of the surface.
// la surface // 2) if yes the approximated point is located on border taking the best direction
// 2) si c est le cas on cadre le point approche sur frontiere en prenant la // the step and a limit blocating one of the parameters during the recent call of
// meilleure direction. On MODIFIE alors le pas d avancement et une des // FunctionSetRoot are modified;
// bornes bloquer un des parametres lors du prochain appel a FunctionSetRoot; // 3) couple (u, v) is recomputed by approximation for the calculation of the next point.
// 3) on recalcule couple (u, v) approche pour le le calcul du point suivant. // 4) return Standard_True if location, Standard_False if no location.
// 4) return Standard_True si cadrage, Standard_False si pas de cadrage.
{ {
Standard_Real Duvx = previousd2d.X(); Standard_Real Duvx = previousd2d.X();
Standard_Real Duvy = previousd2d.Y(); 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) Standard_Real aStep = Abs((BornInf(1) - UVap(1)) / Duvx); // iso U =BornInf(1)
if(aStep<Step) Step=aStep; if(aStep<Step) Step=aStep;
} }
BornSup(1) = BornInf(1); // on bloque le parametre BornSup(1) = BornInf(1); // limit the parameter
UVap(1) = BornInf(1); UVap(1) = BornInf(1);
UVap(2) += Step*Duvy*StepSign;; UVap(2) += Step*Duvy*StepSign;;
return Standard_True; return Standard_True;
@ -151,7 +150,7 @@ Standard_Boolean IntWalk_IWalking::Cadrage
Standard_Real aStep = Abs((BornSup(1) - UVap(1)) / Duvx); // iso U =BornSup(1) Standard_Real aStep = Abs((BornSup(1) - UVap(1)) / Duvx); // iso U =BornSup(1)
if(aStep<Step) Step=aStep; if(aStep<Step) Step=aStep;
} }
BornInf(1) = BornSup(1); // on bloque le parametre BornInf(1) = BornSup(1); // limit the parameter
UVap(1) = BornSup(1); UVap(1) = BornSup(1);
UVap(2) += Step*Duvy*StepSign; UVap(2) += Step*Duvy*StepSign;
return Standard_True; return Standard_True;
@ -187,20 +186,18 @@ Standard_Boolean IntWalk_IWalking::TestArretPassage
math_Vector& UV, math_Vector& UV,
Standard_Integer& Irang) Standard_Integer& Irang)
// Umult et Vmult : tableau des points d arret (ou passant) sur frontiere, ici // Umult et Vmult : table of stop (or crossing) points on border,
// on ne s interesse qu aux points passant. // here only the crossing points are taken into account.
// UV : le point courant. // UV : the current point.
// Irang : en sortie : donne l index du point d arret dans uvstart1 ou 0. // Irang : at exit : give index of the stop point in uvstart1 or 0.
// on considere qu on ne risque de passer que sur un seul point // consider that there is no risk of crossing only if there is one crossing point.
// passant.
// test d arret pour une ligne d intersection OUVERTE // test of stop for an OPEN intersection line
// 1) test de passage sur l ensemble des points interieur // 1) crossing test on all interior points
// 2) test d arret sur l ensemble des points depart // 2) stop test on all start points
// si on detecte un arret on renvoie l index du point d arret (Irang) dans // if a stop is detected, the index of the stop point (Irang) is returned
// l iterateur des points de depart et les parametres associes dans // in the iterator of start points and the associated parameters in UV space.
// l espace UV.
{ {
Standard_Real Up, Vp, Du, Dv, Dup, Dvp, Utest,Vtest; Standard_Real Up, Vp, Du, Dv, Dup, Dvp, Utest,Vtest;
Standard_Integer j, N, ind; Standard_Integer j, N, ind;
@ -211,8 +208,8 @@ Standard_Boolean IntWalk_IWalking::TestArretPassage
Standard_Boolean Arrive = Standard_False; Standard_Boolean Arrive = Standard_False;
// test de passage sur point pouvant demarrer une boucle;les marquer traites // crossing test on point that can start a loop; mark
// si passe sur la ligne ouverte // as processed if passes through an open line
if (!reversed) { if (!reversed) {
previousPoint.ParametersOnS2(Up,Vp); previousPoint.ParametersOnS2(Up,Vp);
@ -259,7 +256,7 @@ Standard_Boolean IntWalk_IWalking::TestArretPassage
} }
} }
// test d arret sur point donne en entree et non encore traite // stop test on point given at input and not yet processed
// Modified by Sergey KHROMOV - Tue Nov 20 10:55:01 2001 Begin // Modified by Sergey KHROMOV - Tue Nov 20 10:55:01 2001 Begin
// Check of all path points in the following order: // Check of all path points in the following order:
@ -361,18 +358,17 @@ Standard_Boolean IntWalk_IWalking::TestArretPassage
const Standard_Integer Index, const Standard_Integer Index,
Standard_Integer& Irang) Standard_Integer& Irang)
{ {
// Umult, Vmult : tableau des points d arret (ou passant) sur frontiere, ici // Umult, Vmult : table of stop (or crossing) points on border, here
// on ne s interesse qu aux points passant. // only crossing points are taken into account.
// UV : le point courant. // UV : the current point.
// Index : l index du point de demarrage dans uvstart2 de la ligne en cours // Index : index of the start point in uvstart2 of the current line
// (c est un point interieur). // (this is an interior point).
// Irang : en sortie : donne l index du point passant dans uvstart1 ou 0. // Irang : at output : gives the index of the point passing in uvstart1 or 0.
// on considere qu on ne risque de passer que sur un seul point // consider that there is risk to cross only one crossing point.
// passant.
// test d arret pour une ligne d intersection FERMEE. // test of stop for a CLOSED intersection line.
// 1) test de passage sur l ensemble des points interieur // 1) test of crossing on all interior points.
// 2) test de passage sur les points passant. // 2) test of crossing on all crossing points.
Standard_Real Up, Vp, Scal; Standard_Real Up, Vp, Scal;
Standard_Boolean Arrive = Standard_False; Standard_Boolean Arrive = Standard_False;
@ -382,7 +378,7 @@ Standard_Boolean IntWalk_IWalking::TestArretPassage
Standard_Real tolv = tolerance(2); Standard_Real tolv = tolerance(2);
// tests d arret et de passage sur points interieurs. // tests of stop and of crossing on all interior points.
if (!reversed) { if (!reversed) {
previousPoint.ParametersOnS2(Up,Vp); previousPoint.ParametersOnS2(Up,Vp);
@ -395,8 +391,8 @@ Standard_Boolean IntWalk_IWalking::TestArretPassage
Standard_Real UV2=UV(2); Standard_Real UV2=UV(2);
//-- On met tout le monde ds une boite 0 1 x 0 1 //-- Put everything in one box 0 1 x 0 1
//-- en tourte rigueur il faudrait faire les test en 3d //-- actually it is necessary to carry out tests in 3D
Standard_Real deltau=UM-Um; Standard_Real deltau=UM-Um;
Standard_Real deltav=VM-Vm; Standard_Real deltav=VM-Vm;
@ -426,7 +422,7 @@ Standard_Boolean IntWalk_IWalking::TestArretPassage
&& (UV2mVtest<tolv2 && UV2mVtest>-tolv2)) { && (UV2mVtest<tolv2 && UV2mVtest>-tolv2)) {
if(Index!=k) { if(Index!=k) {
//-- cout<<"* etat2 : ("<<k<<")"<<endl; //-- cout<<"* etat2 : ("<<k<<")"<<endl;
wd2[k].etat=-wd2[k].etat; //-- marque le point comme point de passage wd2[k].etat=-wd2[k].etat; //-- mark the point as a crossing point
} }
else { //-- Index == k else { //-- Index == k
//-- cout<<"* Arrive"<<endl; //-- cout<<"* Arrive"<<endl;
@ -453,18 +449,18 @@ Standard_Boolean IntWalk_IWalking::TestArretPassage
} }
else { else {
//-- cout<<"*** etat2 : ("<<k<<")"<<endl; //-- cout<<"*** etat2 : ("<<k<<")"<<endl;
wd2[k].etat = -wd2[k].etat; // marque le point point de passage wd2[k].etat = -wd2[k].etat; // mark the point as a crossing point
} }
} }
else if(k!=Index) { else if(k!=Index) {
if(dPreviousStart < dPreviousCurrent*0.25) { if(dPreviousStart < dPreviousCurrent*0.25) {
wd2[k].etat = -wd2[k].etat; // marque le point point de passage wd2[k].etat = -wd2[k].etat; // mark the point as a crossing point
//-- cout<<"**** etat2 : ("<<k<<")"<<endl; //-- cout<<"**** etat2 : ("<<k<<")"<<endl;
} }
else { else {
if(dCurrentStart < dPreviousCurrent*0.25) { if(dCurrentStart < dPreviousCurrent*0.25) {
//-- cout<<"***** etat2 : ("<<k<<")"<<endl; //-- cout<<"***** etat2 : ("<<k<<")"<<endl;
wd2[k].etat = -wd2[k].etat; // marque le point point de passage wd2[k].etat = -wd2[k].etat; // mark the point as a crossing point
} }
else { else {
Standard_Real UMidUtest = 0.5*(UV1+Up)-Utest; Standard_Real UMidUtest = 0.5*(UV1+Up)-Utest;
@ -473,7 +469,7 @@ Standard_Boolean IntWalk_IWalking::TestArretPassage
if(dMiddleStart < dPreviousCurrent*0.5) { if(dMiddleStart < dPreviousCurrent*0.5) {
//-- cout<<"*********** etat2 : ("<<k<<")"<<endl; //-- cout<<"*********** etat2 : ("<<k<<")"<<endl;
wd2[k].etat = -wd2[k].etat; // marque le point point de passage wd2[k].etat = -wd2[k].etat; // mark the point as a crossing point
} }
} }
} }
@ -482,11 +478,11 @@ Standard_Boolean IntWalk_IWalking::TestArretPassage
} }
} }
// test de passage sur points passant. // crossing test on crossing points.
Irang =0; Irang =0;
for (i = 1; i < (int)wd1.size(); i++) { for (i = 1; i < (int)wd1.size(); i++) {
if (wd1[i].etat > 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; Utest = wd1[i].ustart;
Vtest = wd1[i].vstart; Vtest = wd1[i].vstart;
Utest/=deltau; Utest/=deltau;
@ -522,12 +518,11 @@ Standard_Boolean IntWalk_IWalking::TestArretAjout
Standard_Integer& Irang, Standard_Integer& Irang,
IntSurf_PntOn2S& Psol) IntSurf_PntOn2S& Psol)
// test d arret sur les points rajoutes // test of stop on added points
// ces points sont des points sur frontiere naturelle qui n ont pas ete // these are the points on the natural biorder that were not given at input
// donnes en entree // return : Psol, the added point.
// on renvoit : Psol, le point rajoute. // Irang, index in the iterator of added points.
// Irang, l index dans l iterateur des points rajoutes. // UV, parameter of the added point.
// UV, parametre du point rajoute.
// //
{ {
Standard_Boolean Arrive = Standard_False; Standard_Boolean Arrive = Standard_False;
@ -545,10 +540,10 @@ Standard_Boolean IntWalk_IWalking::TestArretAjout
for (Standard_Integer i = 1; i <= nbAjout; i++) { for (Standard_Integer i = 1; i <= nbAjout; i++) {
Irang = seqAjout.Value(i); Irang = seqAjout.Value(i);
// on rajoute le test Abs(Irang) <= lines.Length() pour le cas ou // add test Abs(Irang) <= lines.Length() for the case when
// on ouvre une ligne fermee suite a l ajout 1 point sur cette meme // a closed line is opened by adding a 1 point on this same
// ligne. De toute facon on a un gros pb , car on va avoir 2 points // line. Anyway there is a huge problem as 2 points will be
// rajoutes sur cette ligne... // added on this line...
if (Abs(Irang) <= lines.Length()) { if (Abs(Irang) <= lines.Length()) {
@ -590,14 +585,13 @@ void IntWalk_IWalking::TestArretCadre
math_Vector& UV, math_Vector& UV,
Standard_Integer& Irang) Standard_Integer& Irang)
// test d arret alors qu on est sur frontiere. // test of stop when located on border.
// on a essaye tous les tests d arret et on est arrive. // tried all tests of stop and arrived.
// test d arret sur les points donne au depart deja marques et sur // test of stop on all given departure points already marked and on the entire current line.
// l ensemble de la ligne courante. Cette ligne peut etre racourcie si // This line can be shortened if the stop point is found.
// on trouve in point d arret. // Abs(Irang) = index in the iterator of departure points or 0
// Abs(Irang) = index dans l iterateur des points de depart ou 0 // if Irang <0 , it is necessary to add this point on the line (no Line->Cut)
// si Irang <0 , il faut ajouter ce point a la ligne ( pas de Line->Cut) // UV = parameter of the departure point
// UV = parametre du point de depart
{ {
Standard_Real Scal, Up, Vp, Uc, Vc; Standard_Real Scal, Up, Vp, Uc, Vc;
Standard_Integer N; Standard_Integer N;
@ -607,7 +601,7 @@ void IntWalk_IWalking::TestArretCadre
Irang =0; Irang =0;
for (Standard_Integer i = 1; i < (int)wd1.size(); i++) { for (Standard_Integer i = 1; i < (int)wd1.size(); i++) {
if (wd1[i].etat < 0) { if (wd1[i].etat < 0) {
N=0; // rang dans UVMult. N=0; // range in UVMult.
if (nbMultiplicities[i] > 0) { if (nbMultiplicities[i] > 0) {
for (Standard_Integer k = 1; k < i; k++) for (Standard_Integer k = 1; k < i; k++)
N+=nbMultiplicities[k]; N+=nbMultiplicities[k];
@ -629,7 +623,7 @@ void IntWalk_IWalking::TestArretCadre
Scal = (Up-wd1[i].ustart) * (Uc-wd1[i].ustart) + Scal = (Up-wd1[i].ustart) * (Uc-wd1[i].ustart) +
(Vp-wd1[i].vstart) * (Vc-wd1[i].vstart); (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) { if (Scal < 0) {
Line->Cut(j); nbp= Line->NbPoints(); Line->Cut(j); nbp= Line->NbPoints();
Irang = i; Irang = i;
@ -681,7 +675,7 @@ void IntWalk_IWalking::TestArretCadre
gp_Vec Dir3d = sp.Direction3d(); gp_Vec Dir3d = sp.Direction3d();
gp_Vec Dir3d1 = gp_Vec(Line->Value(j-2).Value(),Line->Value(j-1).Value()); gp_Vec Dir3d1 = gp_Vec(Line->Value(j-2).Value(),Line->Value(j-1).Value());
Standard_Real dot = Dir3d.Dot(Dir3d1); 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(); Dir3d.Reverse();
//-- cout<<" IntWalk_IWalking_2.gxx REVERSE "<<endl; //-- cout<<" IntWalk_IWalking_2.gxx REVERSE "<<endl;
} }
@ -700,9 +694,8 @@ void IntWalk_IWalking::TestArretCadre
Vp = Vc; Vp = Vc;
} }
// et maintenant on compare le dernier point de la ligne et le dernier // now the last point of the line and the last calculated point are compated.
// point calcule. // there will be no need to "Cut"
// il n y aura pas besoin de "Cuter"
Scal = (Up-wd1[i].ustart) * (UV(1)-wd1[i].ustart) + Scal = (Up-wd1[i].ustart) * (UV(1)-wd1[i].ustart) +
// (Vp-wd1[i].vstart) * (UV(2)-wd1[i].vstart); // (Vp-wd1[i].vstart) * (UV(2)-wd1[i].vstart);

View File

@ -17,12 +17,11 @@
// and conditions governing the rights and limitations under the License. // and conditions governing the rights and limitations under the License.
namespace { namespace {
static const Standard_Real CosRef3D = 0.98;// regle par tests dans U4 static const Standard_Real CosRef3D = 0.98;// rule by tests in U4
// correspond a 11.478 d // correspond to 11.478 d
static const Standard_Real CosRef2D = 0.88; // correspond a 25 d static const Standard_Real CosRef2D = 0.88; // correspond to 25 d
static const Standard_Integer MaxDivision = 60; // nombre maxi de division static const Standard_Integer MaxDivision = 60; // max number of step division
// du pas a cause de // because the angle is too great in 2d (U4)
// l angle trop grand en 2d (U4)
} }
IntWalk_StatusDeflection IntWalk_IWalking::TestDeflection IntWalk_StatusDeflection IntWalk_IWalking::TestDeflection
@ -34,34 +33,34 @@ IntWalk_StatusDeflection IntWalk_IWalking::TestDeflection
Standard_Real& Step, Standard_Real& Step,
const Standard_Integer StepSign) const Standard_Integer StepSign)
{ {
// Verification du pas d avancement, ET recalcul de ce pas : // Check the step of advancement, AND recalculate this step :
// //
// 1)test point confondu // 1) test point confused
// si oui les autres tests ne sont pas faits // if yes other tests are not done
// 2)test angle 3d trop grand // 2) test angle 3d too great
// si oui on divise le pas, on sort // if yes divide the step and leave
// angle3d = angle ((point precedent, point calcule), // angle3d = angle ((previous point, calculated point),
// tangente precedente) // previous tangent)
// 3)verification du pas d avancement en 2d // 3) check step of advancement in 2d
// 4)test point confondu // 4) test point confused
// 5)test angle 2d trop grand // 5) test angle 2d too great
// 6)test point de tangence // 6) test point of tangency
// si oui on sort // if yes leave
// 7)calcul de la tangente en u,v de la section // 7) calculate the tangent by u,v of the section
// 8)test angle 3d trop grand // 8) test angle 3d too great
// angle3d = angle ((point precedent, point calcule), // angle3d = angle ((previous point, calculated point),
// nouvelle tangente) // new tangent)
// 9)test angle 2d trop grand // 9) test angle 2d too great
//10)test de changement de rive(depasser le point de tangence sans le savoir) //10) test change of side (pass the tangent point not knowing it)
//11)calcul du pas d avancement en fonction de la fleche //11) calculate the step of advancement depending on the vector
//12)ajustement du pas en fonction des pas precedents //12) adjust the step depending on the previous steps
IntWalk_StatusDeflection Status = IntWalk_OK; IntWalk_StatusDeflection Status = IntWalk_OK;
//--------------------------------------------------------------------------------- //---------------------------------------------------------------------------------
//-- lbr le 4 Avril 95 : On peut se trouver ds le cas ou Status renvoie point //-- lbr le 4 Avril 95 : it is possible that the status returns points confused
//-- confondus si epsilon est assez grand (1e-11) . Dans ce cas on boucle //-- if epsilon is great enough (1e-11). In this case one loops
//-- sans jamais changer les valeurs envoyees a Rsnld. //-- without ever changing the values sent to Rsnld.
//--------------------------------------------------------------------------------- //---------------------------------------------------------------------------------
Standard_Real Paramu, Paramv, StepU,StepV; Standard_Real Paramu, Paramv, StepU,StepV;
Standard_Real Cosi, Cosi2, Norme; Standard_Real Cosi, Cosi2, Norme;
@ -70,21 +69,21 @@ IntWalk_StatusDeflection IntWalk_IWalking::TestDeflection
Norme = Corde.SquareMagnitude(); Norme = Corde.SquareMagnitude();
// if (Norme <= epsilon*epsilon) { // if (Norme <= epsilon*epsilon) {
if ((++NbPointsConfondusConsecutifs < 10) && (Norme <= epsilon)) { // le carre est deja pris dans le constructeur if ((++NbPointsConfondusConsecutifs < 10) && (Norme <= epsilon)) { // the square is already taken in the constructor
Status = IntWalk_PointConfondu; Status = IntWalk_PointConfondu;
if (StatusPrecedent == IntWalk_PasTropGrand) { if (StatusPrecedent == IntWalk_PasTropGrand) {
return IntWalk_ArretSurPointPrecedent; return IntWalk_ArretSurPointPrecedent;
} }
if(++EpsilonSembleTropGrand > 5 && NbPointsConfondusConsecutifs == 8) { //-- Provisoire if(++EpsilonSembleTropGrand > 5 && NbPointsConfondusConsecutifs == 8) { //-- Temporary
if(epsilon>0.00000000001) epsilon*=0.5; //-- Provisoire if(epsilon>0.00000000001) epsilon*=0.5; //-- Temporary
EpsilonSembleTropGrand = 0; //-- Provisoire EpsilonSembleTropGrand = 0; //-- Temporary
} }
} }
else { else {
NbPointsConfondusConsecutifs = 0; //-- Provisoire NbPointsConfondusConsecutifs = 0; //-- Temporary
EpsilonSembleTropGrand = 0; //-- Provisoire EpsilonSembleTropGrand = 0; //-- Temporary
if(Norme<1e-16) Norme = 1e-16; //-- Provisoire if(Norme<1e-16) Norme = 1e-16; //-- Temporary
Cosi = Corde * previousd3d; Cosi = Corde * previousd3d;
if (Cosi*StepSign < 0.) { // angle 3d > pi/2 !!!! if (Cosi*StepSign < 0.) { // angle 3d > pi/2 !!!!
@ -93,7 +92,7 @@ IntWalk_StatusDeflection IntWalk_IWalking::TestDeflection
else { else {
Cosi2 = Cosi * Cosi / previousd3d.SquareMagnitude() / Norme; Cosi2 = Cosi * Cosi / previousd3d.SquareMagnitude() / Norme;
} }
if (Cosi2 < CosRef3D) { //angle 3d trop grand if (Cosi2 < CosRef3D) { //angle 3d too great
Step = Step /2.0; Step = Step /2.0;
StepU = Abs(Step*previousd2d.X()); StepU = Abs(Step*previousd2d.X());
StepV = Abs(Step*previousd2d.Y()); StepV = Abs(Step*previousd2d.Y());
@ -115,19 +114,19 @@ IntWalk_StatusDeflection IntWalk_IWalking::TestDeflection
Standard_Real Dv = UV(2) - Paramv; Standard_Real Dv = UV(2) - Paramv;
Standard_Real Duv = Du * Du + Dv * Dv; Standard_Real Duv = Du * Du + Dv * Dv;
if (Abs(Du) < tolerance(1) && Abs(Dv) < tolerance(2)) 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() + Cosi = StepSign * (Du * previousd2d.X() +
Dv * previousd2d.Y()); Dv * previousd2d.Y());
if (Cosi < 0 && Status == IntWalk_PointConfondu) if (Cosi < 0 && Status == IntWalk_PointConfondu)
return IntWalk_ArretSurPointPrecedent; // on sort car retour arriere return IntWalk_ArretSurPointPrecedent; // leave as step back
// avec point confondu // with confused point
if (sp.IsTangent()) if (sp.IsTangent())
return IntWalk_ArretSurPoint; return IntWalk_ArretSurPoint;
//si au cours du cheminement on a subdivise plus de MaxDivision pour chaque //if during routing one has subdivided more than MaxDivision for each
//pas precedent,anomalie sur le carreau;on ne fait plus rien (experience U4) //previous step, bug on the square; do nothing (experience U4)
if (NbDivision < MaxDivision && if (NbDivision < MaxDivision &&
Status != IntWalk_PointConfondu && Status != IntWalk_PointConfondu &&
@ -148,7 +147,7 @@ IntWalk_StatusDeflection IntWalk_IWalking::TestDeflection
Cosi = Corde * sp.Direction3d(); Cosi = Corde * sp.Direction3d();
Cosi2 = Cosi * Cosi / sp.Direction3d().SquareMagnitude() / Norme; Cosi2 = Cosi * Cosi / sp.Direction3d().SquareMagnitude() / Norme;
if (Cosi2 < CosRef3D ){ //angle 3d trop grand if (Cosi2 < CosRef3D ){ //angle 3d too great
Step = Step / 2.; Step = Step / 2.;
StepU = Abs(Step*previousd2d.X()); StepU = Abs(Step*previousd2d.X());
StepV = Abs(Step*previousd2d.Y()); StepV = Abs(Step*previousd2d.Y());
@ -163,7 +162,7 @@ IntWalk_StatusDeflection IntWalk_IWalking::TestDeflection
Cosi2 = Cosi * Cosi / Duv; Cosi2 = Cosi * Cosi / Duv;
if (Cosi2 < CosRef2D || if (Cosi2 < CosRef2D ||
sp.Direction2d() * previousd2d < 0) { sp.Direction2d() * previousd2d < 0) {
//angle 2d trop grand ou changement de rive //angle 2d too great or change the side
Step = Step / 2.; Step = Step / 2.;
StepU = Abs(Step*previousd2d.X()); StepU = Abs(Step*previousd2d.X());
StepV = Abs(Step*previousd2d.Y()); StepV = Abs(Step*previousd2d.Y());
@ -198,10 +197,10 @@ IntWalk_StatusDeflection IntWalk_IWalking::TestDeflection
} }
else { else {
// on estime la fleche courante. // estimate the current vector.
// si fleche/2<=flechecourante<= fleche on considere que le critere est // if vector/2<=current vector<= vector it is considered that the criterion
// respecte. // is observed.
// sinon ajuster le pas en fonction du pas precedent // otherwise adjust the step depending on the previous step
/* /*
Standard_Real Dist = Sqrt(Norme)/3.; Standard_Real Dist = Sqrt(Norme)/3.;
@ -219,16 +218,16 @@ IntWalk_StatusDeflection IntWalk_IWalking::TestDeflection
Standard_Real FlecheCourante = Milieu.SquareDistance(POnCurv); 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. // 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 // Or p2 = p1 + lambda*d1 et p3 = p4 - lambda*d4
// Donc POnCurv = (p1 + p4)/2. + 3.*(lambda d1 - lambda d4)/8. // So POnCurv = (p1 + p4)/2. + 3.*(lambda d1 - lambda d4)/8.
// On calcule l'ecart avec (p1+p4)/2. . Il faut donc juste calculer // Calculate the deviation with (p1+p4)/2. . So it is just necessary to calculate
// la norme (au carre) de 3.*lambda (d1 - d4)/8. // the norm (square) of 3.*lambda (d1 - d4)/8.
// soit la norme de : // either the norm of :
// 3.*(Sqrt(Norme)/3.)*StepSign*(d1-d4)/8. // 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. // Norme * (d1-d4).SquareMagnitude()/64.
Standard_Real FlecheCourante = Standard_Real FlecheCourante =
@ -256,8 +255,8 @@ IntWalk_StatusDeflection IntWalk_IWalking::TestDeflection
} }
else { else {
// if (FlecheCourante > fleche) { // pas trop grand // if (FlecheCourante > fleche) { // not too great
if (FlecheCourante > fleche*fleche) { // pas trop grand if (FlecheCourante > fleche*fleche) { // not too great
Step = Step /2.; Step = Step /2.;
Status = IntWalk_PasTropGrand; Status = IntWalk_PasTropGrand;
} }

View File

@ -81,7 +81,7 @@ void IntWalk_IWalking::OpenLine(const Standard_Integer N,
const ThePOPIterator& Pnts1, const ThePOPIterator& Pnts1,
TheIWFunction& sp, TheIWFunction& sp,
const Handle(IntWalk_TheIWLine)& Line ) 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; ThePointOfPath PathPnt;
@ -102,9 +102,9 @@ void IntWalk_IWalking::OpenLine(const Standard_Integer N,
previousd3d = sp.Direction3d(); previousd3d = sp.Direction3d();
previousd2d = sp.Direction2d(); previousd2d = sp.Direction2d();
if (N>0) { //point de depart donne en entree if (N>0) { //departure point given at input
PathPnt = Pnts1.Value(N); 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); Line->AddStatusFirst(Standard_False,Standard_True,N,PathPnt);
@ -114,7 +114,7 @@ void IntWalk_IWalking::OpenLine(const Standard_Integer N,
else { else {
if (N <0) Line->AddPoint(Psol); if (N <0) Line->AddPoint(Psol);
Line->AddStatusFirst(Standard_False,Standard_False); 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->Reverse(); //inverser la ligne
Line->SetTangentVector(previousd3d.Reversed(),Line->NbPoints()); Line->SetTangentVector(previousd3d.Reversed(),Line->NbPoints());

View File

@ -26,7 +26,7 @@ generic class PWalking from IntWalk (
---Purpose: This class implements an algorithm to determine the ---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 -- a starting point. The intersection line
-- starts and ends on the natural surface's boundaries . -- starts and ends on the natural surface's boundaries .
@ -67,13 +67,12 @@ is
-- solution point (each point of the line). -- solution point (each point of the line).
-- It is necessary to call the Perform method to compute -- It is necessary to call the Perform method to compute
-- the intersection lines. -- the intersection lines.
-- la ligne trouvee part d'un point sur ou dans les 2 domaines -- The line found starts at a point on or in 2 natural domains
-- naturelles des surfaces .Elle peut etre fermee ;dans les -- of surfaces. It can be closed in the
-- cas standard si elle est ouverte elle s arrete et commence -- standard case if it is open it stops and begins at the
-- a une frontiere d 'un des domaines.Si une ligne ouverte -- border of one of the domains. If an open line
-- s arrete en plein milieu d'un domaine ,on s'arrete sur -- stops at the middle of a domain, one stops at the tangent point.
-- point de tangence. -- Epsilon is SquareTolerance of points confusion.
-- Epsilon tolerance au carre de confusion de points
returns PWalking; returns PWalking;
@ -93,31 +92,30 @@ is
-- TolTangency is the tolerance to find a tangent point. -- TolTangency is the tolerance to find a tangent point.
-- Func is the criterion which has to be evaluated at each -- Func is the criterion which has to be evaluated at each
-- solution point (each point of the line). -- solution point (each point of the line).
-- la ligne trouvee part d'un point sur ou dans les 2 domaines -- The line found starts at a point on or in 2 natural domains
-- naturelles des surfaces .Elle peut etre fermee ;dans les -- of surfaces. It can be closed in the
-- cas standard si elle est ouverte elle s arrete et commence -- standard case if it is open it stops and begins at the
-- a une frontiere d 'un des domaines.Si une ligne ouverte -- border of one of the domains. If an open line
-- s arrete en plein milieu d'un domaine ,on s'arrete sur -- stops at the middle of a domain, one stops at the tangent point.
-- point de tangence. -- Epsilon is SquareTolerance of points confusion.
-- Epsilon tolerance au carre de confusion de points
returns PWalking; returns PWalking;
Perform(me :in out;ParDep : Array1OfReal from TColStd) Perform(me :in out;ParDep : Array1OfReal from TColStd)
---Purpose: calcule la ligne d 'intersection ---Purpose: calculate the line of intersection
is static; is static;
Perform(me :in out;ParDep : Array1OfReal from TColStd; Perform(me :in out;ParDep : Array1OfReal from TColStd;
u1min,v1min,u2min,v2min,u1max,v1max,u2max,v2max: Real from Standard) u1min,v1min,u2min,v2min,u1max,v1max,u2max,v2max: Real from Standard)
---Purpose: calcule la ligne d 'intersection le reglage des ---Purpose: calculate the line of intersection. The regulation
-- pas est fait a partir des valeurs min max sur u et -- of steps is done using min and max values on u and
-- v. (si ces donnees ne sont pas presentes comme -- v. (if this data is not presented as in the
-- dans la methode precedente, les pas initiaux sont -- previous method, the initial steps are calculated
-- calcules a partir des min max uv des faces). -- starting from min and max uv of faces).
is static; is static;
@ -126,7 +124,7 @@ is
ParDep : Array1OfReal from TColStd; ParDep : Array1OfReal from TColStd;
FirstPoint: in out PntOn2S from IntSurf) 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 returns Boolean from Standard
@ -275,12 +273,12 @@ fields
indextg : Integer from Standard; indextg : Integer from Standard;
tgdir : Dir from gp; tgdir : Dir from gp;
fleche : Real from Standard; -- fleche maxi autorisee fleche : Real from Standard; -- max possible vector
pasMax : Real from Standard; -- ratio uv maximum autorise pasMax : Real from Standard; -- max possible uv ratio
tolconf : Real from Standard; -- tol de confusion de 2 points tolconf : Real from Standard; -- tol of confusion of 2 points
pasuv : Real from Standard[4];-- pas uv sur les caros pasuv : Real from Standard[4];-- uv step on squares
pasSav : Real from Standard[4];-- premier pas sauvegarde pasSav : Real from Standard[4];-- first saved step
pasInit : Real from Standard[4];-- sauvegarde des pas pasInit : Real from Standard[4];-- saving of steps
Um1 : Real from Standard; Um1 : Real from Standard;
UM1 : Real from Standard; UM1 : Real from Standard;
@ -299,9 +297,9 @@ fields
sensCheminement : Integer from Standard; sensCheminement : Integer from Standard;
choixIsoSav : ConstIsoparametric from IntImp; choixIsoSav : ConstIsoparametric from IntImp;
-- sauvegarde du choix 1 iere iso -- save 1st iso choice
previousPoint : PntOn2S from IntSurf; previousPoint : PntOn2S from IntSurf;
-- point d 'intersection precedent -- previous intersection point
previoustg : Boolean from Standard; previoustg : Boolean from Standard;
previousd : Dir from gp; previousd : Dir from gp;
previousd1 : Dir2d from gp; previousd1 : Dir2d from gp;

View File

@ -28,8 +28,8 @@
//================================================================================== //==================================================================================
// function : IntWalk_PWalking::IntWalk_PWalking // function : IntWalk_PWalking::IntWalk_PWalking
// purpose : // purpose :
// estimation des max pas : Pour eviter des changenets // estimate of max step : To avoid abrupt changes
// trop brusques lors des changements d isos // during change of isos
//================================================================================== //==================================================================================
void ComputePasInit(Standard_Real *pasuv, void ComputePasInit(Standard_Real *pasuv,
Standard_Real Um1,Standard_Real UM1, Standard_Real Um1,Standard_Real UM1,
@ -54,9 +54,9 @@ void ComputePasInit(Standard_Real *pasuv,
Standard_Real _du2=Abs(_UM2-_Um2); Standard_Real _du2=Abs(_UM2-_Um2);
Standard_Real _dv2=Abs(_VM2-_Vm2); Standard_Real _dv2=Abs(_VM2-_Vm2);
//-- On limite la reduction de l estimation de la boite uv a 0.01 la boite naturelle //-- limit the reduction of uv box estimate to 0.01 natural box
//-- du1 : Sur boite des Inter //-- du1 : On box of Inter
//-- _du1 : Sur espace parametrique //-- _du1 : On parametric space
if(_du1<1e50 && du1<0.01*_du1) du1=0.01*_du1; if(_du1<1e50 && du1<0.01*_du1) du1=0.01*_du1;
if(_dv1<1e50 && dv1<0.01*_dv1) dv1=0.01*_dv1; if(_dv1<1e50 && dv1<0.01*_dv1) dv1=0.01*_dv1;
if(_du2<1e50 && du2<0.01*_du2) du2=0.01*_du2; 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.; 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); Um1 = ThePSurfaceTool::FirstUParameter(Caro1);
Vm1 = ThePSurfaceTool::FirstVParameter(Caro1); Vm1 = ThePSurfaceTool::FirstVParameter(Caro1);
UM1 = ThePSurfaceTool::LastUParameter(Caro1); UM1 = ThePSurfaceTool::LastUParameter(Caro1);
@ -230,7 +230,7 @@ IntWalk_PWalking::IntWalk_PWalking(const ThePSurface& Caro1,
{ {
Standard_Real KELARG=20.; 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); Um1 = ThePSurfaceTool::FirstUParameter(Caro1);
Vm1 = ThePSurfaceTool::FirstVParameter(Caro1); Vm1 = ThePSurfaceTool::FirstVParameter(Caro1);
@ -386,7 +386,7 @@ Standard_Boolean IntWalk_PWalking::PerformFirstPoint (const TColStd_Array1OfRea
aTmp = ParDep(i); aTmp = ParDep(i);
Param(i) = ParDep(i); Param(i) = ParDep(i);
} }
//-- calcul du premier point solution //-- calculate the first solution point
math_FunctionSetRoot Rsnld(myIntersectionOn2S.Function()); math_FunctionSetRoot Rsnld(myIntersectionOn2S.Function());
// //
myIntersectionOn2S.Perform(Param,Rsnld); myIntersectionOn2S.Perform(Param,Rsnld);
@ -475,13 +475,13 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
aTmp=ParDep(i); aTmp=ParDep(i);
Param(i)=ParDep(i); Param(i)=ParDep(i);
} }
//-- reprise des pas uv lies aux surfaces Caro1 et Caro2 //-- reproduce steps uv connected to surfaces Caro1 and Caro2
//-- pasuv[] et pasSav[] sont modifies lors du cheminement //-- pasuv[] and pasSav[] are modified during the marching
for(i = 0; i < 4; ++i) { for(i = 0; i < 4; ++i) {
pasMaxSV[i] = pasSav[i] = pasuv[i] = pasInit[i]; pasMaxSV[i] = pasSav[i] = pasuv[i] = pasInit[i];
} }
//-- calcul du premier point solution //-- calculate the first solution point
math_FunctionSetRoot Rsnld(myIntersectionOn2S.Function()); math_FunctionSetRoot Rsnld(myIntersectionOn2S.Function());
// //
ChoixIso = myIntersectionOn2S.Perform(Param,Rsnld); ChoixIso = myIntersectionOn2S.Perform(Param,Rsnld);
@ -517,9 +517,9 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
tgfirst = tglast = Standard_False; tgfirst = tglast = Standard_False;
choixIsoSav = ChoixIso; choixIsoSav = ChoixIso;
//------------------------------------------------------------ //------------------------------------------------------------
//-- On Teste si le premier point de cheminement correspond //-- Test if the first point of marching corresponds
//-- a un point sur frontiere. //-- to a point on borders.
//-- Dans ce cas, DejaReparti est initialise a True //-- In this case, DejaReparti is initialized as True
//-- //--
pf = previousPoint.Value(); pf = previousPoint.Value();
Standard_Boolean bTestFirstPoint = Standard_True; Standard_Boolean bTestFirstPoint = Standard_True;
@ -599,7 +599,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
ChoixIso= myIntersectionOn2S.Perform(Param, Rsnld, ChoixIso); ChoixIso= myIntersectionOn2S.Perform(Param, Rsnld, ChoixIso);
// //
if (!myIntersectionOn2S.IsDone()) { if (!myIntersectionOn2S.IsDone()) {
//arret de la ligne,division //end of line, division
Arrive = Standard_False; Arrive = Standard_False;
Param(1)=SvParam[0]; Param(1)=SvParam[0];
Param(2)=SvParam[1]; Param(2)=SvParam[1];
@ -608,7 +608,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
RepartirOuDiviser(DejaReparti, ChoixIso, Arrive); RepartirOuDiviser(DejaReparti, ChoixIso, Arrive);
} }
else {//009 else {//009
//== Le calcul du point exact a partir de Param(.) est possible //== Calculation of exact point from Param(.) is possible
if (myIntersectionOn2S.IsEmpty()) { if (myIntersectionOn2S.IsEmpty()) {
Standard_Real u1,v1,u2,v2; Standard_Real u1,v1,u2,v2;
previousPoint.Parameters(u1,v1,u2,v2); previousPoint.Parameters(u1,v1,u2,v2);
@ -638,7 +638,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
} }
else {//008 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) { if(NoTestDeflection) {
NoTestDeflection = Standard_False; NoTestDeflection = Standard_False;
@ -797,7 +797,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
case IntWalk_OK: case IntWalk_OK:
case IntWalk_ArretSurPoint: {//006 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 //xft arrive here
Arrive = TestArret(DejaReparti,Param,ChoixIso); Arrive = TestArret(DejaReparti,Param,ChoixIso);
@ -807,7 +807,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
if(Arrive==Standard_False && Status==IntWalk_ArretSurPoint) { if(Arrive==Standard_False && Status==IntWalk_ArretSurPoint) {
Arrive=Standard_True; Arrive=Standard_True;
#ifdef DEB #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)"<<endl; cout << "IntWalk_PWalking_1.gxx (lbr le 1erdec98)"<<endl;
#endif #endif
} }
@ -816,10 +816,10 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
} }
if(!Arrive) {//005 if(!Arrive) {//005
//===================================================== //=====================================================
//== Param(.) est dans les bornes == //== Param(.) is in the limits ==
//== et ne finit pas une ligne fermee == //== and does not end a closed line ==
//===================================================== //=====================================================
//== Verification sur Le Point Courant de myInters //== Check on the current point of myInters
Standard_Boolean pointisvalid = Standard_False; Standard_Boolean pointisvalid = Standard_False;
{ {
Standard_Real u1,v1,u2,v2; Standard_Real u1,v1,u2,v2;
@ -841,7 +841,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
previousd2 = myIntersectionOn2S.DirectionOnS2(); previousd2 = myIntersectionOn2S.DirectionOnS2();
} }
//===================================================== //=====================================================
//== Verification sur Previous Point //== Check on the previous Point
{ {
Standard_Real u1,v1,u2,v2; Standard_Real u1,v1,u2,v2;
previousPoint.Parameters(u1,v1,u2,v2); previousPoint.Parameters(u1,v1,u2,v2);
@ -894,7 +894,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
} }
else {//$$$ else {//$$$
//==================================================== //====================================================
//== Param n etait pas dans les bornes (a ete recadre) //== Param was not in the limits (was reframed)
//==================================================== //====================================================
Standard_Boolean bPrevNotTangent = !previoustg || !myIntersectionOn2S.IsTangent(); Standard_Boolean bPrevNotTangent = !previoustg || !myIntersectionOn2S.IsTangent();
@ -902,7 +902,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
ChoixIso = myIntersectionOn2S.Perform(Param,Rsnld,ChoixIso); ChoixIso = myIntersectionOn2S.Perform(Param,Rsnld,ChoixIso);
// //
if(!myIntersectionOn2S.IsEmpty()) { //002 if(!myIntersectionOn2S.IsEmpty()) { //002
// debordement sur le carreau reciproque ou intersection en coin // mutially outpasses in the square or intersection in corner
if(TestArret(Standard_True,Param,ChoixIso)) { if(TestArret(Standard_True,Param,ChoixIso)) {
NbPasOKConseq = -10; NbPasOKConseq = -10;
ChoixIso = myIntersectionOn2S.Perform(Param,Rsnld,ChoixIso); ChoixIso = myIntersectionOn2S.Perform(Param,Rsnld,ChoixIso);
@ -938,7 +938,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
RepartirOuDiviser(DejaReparti,ChoixIso,Arrive); RepartirOuDiviser(DejaReparti,ChoixIso,Arrive);
} }
else { else {
//echec cadrage diviser le pas //fail framing divides the step
Arrive = Standard_False; Arrive = Standard_False;
RepartirOuDiviser(DejaReparti,ChoixIso,Arrive); RepartirOuDiviser(DejaReparti,ChoixIso,Arrive);
NoTestDeflection = Standard_True; NoTestDeflection = Standard_True;
@ -963,10 +963,14 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
previousd2 = myIntersectionOn2S.DirectionOnS2(); previousd2 = myIntersectionOn2S.DirectionOnS2();
} }
//======================================== //========================================
//== Verification sur PreviousPoint @@ //== Check on PreviousPoint @@
{ {
Standard_Real u1,v1,u2,v2; Standard_Real u1,v1,u2,v2;
previousPoint.Parameters(u1,v1,u2,v2); previousPoint.Parameters(u1,v1,u2,v2);
//To save initial 2d points
gp_Pnt2d ParamPntOnS1(Param(1), Param(2));
gp_Pnt2d ParamPntOnS2(Param(3), Param(4));
///////////////////////////
Param(1) = u1; Param(1) = u1;
Param(2) = v1; Param(2) = v1;
Param(3) = u2; Param(3) = u2;
@ -998,6 +1002,27 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
bTestFirstPoint = Standard_False; bTestFirstPoint = Standard_False;
} }
} }
//To avoid walking around the same point
//in the tangent zone near a border
if (previoustg)
{
Standard_Real prevU1, prevV1, prevU2, prevV2;
previousPointSave.Parameters(prevU1, prevV1, prevU2, prevV2);
gp_Pnt2d prevPntOnS1(prevU1, prevV1), prevPntOnS2(prevU2, prevV2);
gp_Pnt2d curPntOnS1(u1, v1), curPntOnS2(u2, v2);
gp_Vec2d PrevToParamOnS1(prevPntOnS1, ParamPntOnS1);
gp_Vec2d PrevToCurOnS1(prevPntOnS1, curPntOnS1);
gp_Vec2d PrevToParamOnS2(prevPntOnS2, ParamPntOnS2);
gp_Vec2d PrevToCurOnS2(prevPntOnS2, curPntOnS2);
Standard_Real MaxAngle = 3*M_PI/4;
if (Abs(PrevToParamOnS1.Angle(PrevToCurOnS1)) > MaxAngle &&
Abs(PrevToParamOnS2.Angle(PrevToCurOnS2)) > MaxAngle)
{
Arrive = Standard_True;
break;
}
}
////////////////////////////////////////
AddAPoint(line,previousPoint); AddAPoint(line,previousPoint);
RejectIndex++; RejectIndex++;
if(RejectIndex >= 250000) { if(RejectIndex >= 250000) {
@ -1040,20 +1065,20 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
} }
} }
}//else !TestArret() $ }//else !TestArret() $
} //$$ fin succes cadrage sur frontiere (!myIntersectionOn2S.IsEmpty()) } //$$ end successful framing on border (!myIntersectionOn2S.IsEmpty())
else { else {
//echec cadrage sur frontiere;division du pas //echec framing on border; division of step
Arrive = Standard_False; Arrive = Standard_False;
NoTestDeflection = Standard_True; NoTestDeflection = Standard_True;
RepartirOuDiviser(DejaReparti,ChoixIso,Arrive); RepartirOuDiviser(DejaReparti,ChoixIso,Arrive);
} }
}//$$$ fin cadrage sur frontiere (!close) }//$$$ end framing on border (!close)
} //004 fin TestArret retourne Arrive = True } //004 fin TestArret return Arrive = True
} // 006case IntWalk_ArretSurPoint: fin Traitement Status = OK ou ArretSurPoint } // 006case IntWalk_ArretSurPoint: end Processing Status = OK or ArretSurPoint
} //007 switch(Status) } //007 switch(Status)
} //008 fin traitement point en court (TEST DEFLECTION) } //008 end processing point (TEST DEFLECTION)
} //009 fin traitement ligne (else if myIntersectionOn2S.IsDone()) } //009 end processing line (else if myIntersectionOn2S.IsDone())
} //010 fin si premier point de depart a permis un cheminement while(!Arrive) } //010 end if first departure point allows marching while (!Arrive)
done = Standard_True; done = Standard_True;
} }
// =========================================================================================================== // ===========================================================================================================

View File

@ -27,14 +27,14 @@ void IntWalk_PWalking::
IntImp_ConstIsoparametric& ChoixIso, IntImp_ConstIsoparametric& ChoixIso,
Standard_Boolean& Arrive) Standard_Boolean& Arrive)
// au voisinage d '1 point ,il y a echec du cheminement // at the neighborhood of a point, there is a fail of marching
// il faut diviser le pas pour essayer de continuer // it is required to divide the steps to try to continue
//si le pas est trop petit ou si on est arrive sur une frontiere // if the step is too small if we are on border
// repartir dans l autre sens si cela n a pas ete deja fait sinon arret // restart in another direction if it was not done, otherwise stop
{ {
// Standard_Integer i; // Standard_Integer i;
if (Arrive) { //repartir dans l autre sens if (Arrive) { //restart in the other direction
if (!DejaReparti ) { if (!DejaReparti ) {
Arrive = Standard_False; Arrive = Standard_False;
DejaReparti = Standard_True; DejaReparti = Standard_True;
@ -80,10 +80,10 @@ void IntWalk_PWalking::
&& pasuv[3]*0.5 < ResoV2 && pasuv[3]*0.5 < ResoV2
) { ) {
if (!previoustg) { 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; DejaReparti = Standard_True;
previousPoint = line->Value(1); previousPoint = line->Value(1);
previoustg = Standard_False; previoustg = Standard_False;

View File

@ -30,18 +30,18 @@ static const Standard_Real d = 7.0;
IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection() IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection()
// tester si fleche respectee en calculant un majorant de fleche // test if vector is observed by calculating an increase of vector
// soit le point precedent et sa tangente ,le point nouveau calcule et sa // or the previous point and its tangent, the new calculated point and its
// tangente ;on peut trouver une cubique passant par ces 2 points et ayant // tangent; it is possible to find a cube passing by the 2 points and having as a
// pour derivee les tangentes de l intersection // derivative the tangents of the intersection
// calculer le point au parametre 0.5 sur la cubique=p1 // calculate the point with parameter 0.5 on cube=p1
// calculer le point milieu des 2 points d intersection=p2 // calculate the medium point of 2 points of intersection=p2
// si fleche/2<=||p1p2||<= fleche on considere que l on respecte la fleche // if arrow/2<=||p1p2||<= arrow consider that the vector is observed
// sinon ajuster le pas en fonction du rapport ||p1p2||/fleche et du pas // otherwise adjust the step depending on the ratio ||p1p2||/vector
// precedent // and the previous step
// tester si dans les 2 plans tangents des surfaces on a pas un angle2d trop // test if in 2 tangent planes of surfaces there is no too great angle2d
// grand : si oui diviser le pas // grand : if yes divide the step
// tester s il n y a pas changement de rive // test if there is no change of side
// //
{ {
if(line->NbPoints() ==1 ) { if(line->NbPoints() ==1 ) {
@ -54,7 +54,7 @@ IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection()
const IntSurf_PntOn2S& CurrentPoint = myIntersectionOn2S.Point(); 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()) { if (myIntersectionOn2S.IsTangent()) {
return IntWalk_ArretSurPoint; return IntWalk_ArretSurPoint;
@ -63,14 +63,14 @@ IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection()
const gp_Dir& TgCourante = myIntersectionOn2S.Direction(); 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) { if (TgCourante.Dot(previousd)<0) {
//------------------------------------------------------------ //------------------------------------------------------------
//-- Risque de point d inflexion : On divise le pas par 2 //-- Risk of inflexion point : Divide the step by 2
//-- On initialise STATIC_PRECEDENT_INFLEXION pour qu a //-- Initialize STATIC_PRECEDENT_INFLEXION so that
//-- l appel suivant, on retourne Pas_OK si il n y a //-- at the next call to return Pas_OK if there is no
//-- plus de risque de point d inflexion //-- more risk of the point of inflexion
//------------------------------------------------------------ //------------------------------------------------------------
pasuv[0]*=0.5; 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(). Standard_Real Dist = previousPoint.Value().
@ -122,7 +122,7 @@ IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection()
AbsDv1 = Abs(Dv1); AbsDv1 = Abs(Dv1);
AbsDv2 = Abs(Dv2); 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 if ( AbsDu1 < ResoU1 && AbsDv1 < ResoV1
&& AbsDu2 < ResoU2 && AbsDv2 < ResoV2) { && AbsDu2 < ResoU2 && AbsDv2 < ResoV2) {
@ -176,10 +176,10 @@ IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection()
CosRef2 = CosRef2D/tolCoeff2; CosRef2 = CosRef2D/tolCoeff2;
// //
//================================================================================== //==================================================================================
//== Les points ne sont pas confondus : == //== The points are not confused : ==
//== 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 == //== 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 ==
//== P a s T r o p G r a n d (angle dans Esp UV) == //== N o t T o o G r e a t (angle in space UV) ==
//== C h a n g e m e n t d e r i v e == //== C h a n g e o f s i d e ==
//================================================================================== //==================================================================================
if (Status != IntWalk_PointConfondu) { if (Status != IntWalk_PointConfondu) {
if(Cosi1*Cosi1 < CosRef1*Duv1 || Cosi2*Cosi2 < CosRef2*Duv2) { if(Cosi1*Cosi1 < CosRef1*Duv1 || Cosi2*Cosi2 < CosRef2*Duv2) {
@ -201,8 +201,8 @@ IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection()
AngRef1 = AngRef2D*tolCoeff1; AngRef1 = AngRef2D*tolCoeff1;
AngRef2 = AngRef2D*tolCoeff2; AngRef2 = AngRef2D*tolCoeff2;
//------------------------------------------------------- //-------------------------------------------------------
//-- Test : Angle trop grand dans l espace UV ----- //-- Test : Angle too great in space UV -----
//-- Changement de rive ----- //-- Change of side -----
//------------------------------------------------------- //-------------------------------------------------------
if(Cosi1*Cosi1 < CosRef1*Duv1 || Cosi2*Cosi2 < CosRef2*Duv2 || Ang1 > AngRef1 || Ang2 > AngRef2) { 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; 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) //<-OCC431(apo)
//================================================================================== //==================================================================================
//== D e t e c t i o n d e : Pas Trop Petit //== D e t e c t i o n o f : Step Too Small
//== Pas Trop Grand //== STEP TOO Great
//================================================================================== //==================================================================================
//--------------------------------------- //---------------------------------------
//-- Estimation de la fleche -- //-- Estimate of the vector --
//--------------------------------------- //---------------------------------------
FlecheCourante = FlecheCourante =
Sqrt(Abs((previousd.XYZ()-TgCourante.XYZ()).SquareModulus()*Dist))/8.; 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) { if(FlecheCourante>1e-16) {
Ratio = 0.5*(fleche/FlecheCourante); Ratio = 0.5*(fleche/FlecheCourante);
} }
@ -236,9 +236,9 @@ IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection()
Standard_Real pasSu2 = pasuv[2]; Standard_Real pasSu2 = pasuv[2];
Standard_Real pasSv2 = pasuv[3]; Standard_Real pasSv2 = pasuv[3];
//-- Dans les cas ou lorsqu on demande //-- In case if
//-- un point a U+DeltaU , .... //-- a point at U+DeltaU is required, ....
//-- on recupere un point a U + Epsilon //-- return a point at U + Epsilon
//-- Epsilon << DeltaU. //-- Epsilon << DeltaU.
if(pasuv[0]< AbsDu1) pasuv[0] = AbsDu1; if(pasuv[0]< AbsDu1) pasuv[0] = AbsDu1;
@ -269,12 +269,12 @@ IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection()
} }
if(Status == IntWalk_OK) { if(Status == IntWalk_OK) {
STATIC_BLOCAGE_SUR_PAS_TROP_GRAND=0; STATIC_BLOCAGE_SUR_PAS_TROP_GRAND=0;
//-- On tente d augmenter le pas //-- Try to increase the step
} }
return Status; return Status;
} }
else { //-- FlecheCourante > fleche*0.5 else { //-- CurrentVector > vector*0.5
if (FlecheCourante > fleche) { //-- Pas Courant Trop Grand if (FlecheCourante > fleche) { //-- Current step too Great
Ratio = fleche/FlecheCourante; Ratio = fleche/FlecheCourante;
pasuv[0] = Ratio*pasuv[0]; pasuv[0] = Ratio*pasuv[0];
pasuv[1] = Ratio*pasuv[1]; pasuv[1] = Ratio*pasuv[1];
@ -285,7 +285,7 @@ IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection()
return IntWalk_PasTropGrand; return IntWalk_PasTropGrand;
//} //}
} }
else { //-- fleche/2 < FlecheCourante <= fleche else { //-- vector/2 < CurrentVector <= vector
Ratio = 0.75 * (fleche / FlecheCourante); Ratio = 0.75 * (fleche / FlecheCourante);
} }
} }

View File

@ -17,16 +17,15 @@
// and conditions governing the rights and limitations under the License. // and conditions governing the rights and limitations under the License.
//-- //--
//-- Modif du 5 Octobre 94 (LBR) //-- Modif of 5 October 94 (LBR)
//-- if(Trouve) ... //-- if(Trouve) ...
//-- On deborde sur une frontiere, Duv[.] = -1 -1 -1 -1 //-- outpasses a border, Duv[.] = -1 -1 -1 -1
//-- donc on garde la meme iso bloquee (voir if(k!=1) ) //-- keep the same iso limited (see if(k!=1) )
//-- //--
//-- Modif du 8 juillet 96 (LBR) //-- Modif of 8 July 96 (LBR)
//-- simplifaication du traitement des auto-intersections. //-- simplify processing of auto-intersections.
//-- Idee : //-- Idea : Test closed loop in 3d and in 2d.
//-- Tester la boucle fermee en 3d et en 2d.
//-- //--
#include <gp_Pnt2d.hxx> #include <gp_Pnt2d.hxx>
@ -38,11 +37,11 @@ Standard_Boolean IntWalk_PWalking::
IntImp_ConstIsoparametric& ChoixIso) IntImp_ConstIsoparametric& ChoixIso)
// //
// tester si le point d intersection donne par ces parametres reste dans le // test if the point of intersection set by these parameters remains in the
// domaine naturelle de chaque carreau. // natural domain of each square.
// si le point deborde cadrer de facon a trouver la meilleure iso (frontiere) // if the point outpasses reframe to find the best iso (border)
// qui intersecte le plus franchement l autre carreau // that intersects easiest the other square
// sinon tester si presence de ligne fermee // otherwise test if closed line is present
// //
{ {
Standard_Real Uvd[4],Uvf[4],Epsuv[4],Duv[4],Uvp[4],dv,dv2,ParC[4]; 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[2] = ResoU2;
Epsuv[3] = ResoV2; Epsuv[3] = ResoV2;
previousPoint.Parameters(Uvp[0],Uvp[1],Uvp[2],Uvp[3]); 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; Standard_Boolean Trouve = Standard_False;
Uvd[0]=Um1; Uvf[0]=UM1; Uvd[1]=Vm1; Uvf[1]=VM1; 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 3: k=4; break;
case 4: k=3; 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; //-- Trouve = Standard_True; //--
DPc = Uvp[im1]-Param(i); //-- Previous - Current DPc = Uvp[im1]-Param(i); //-- Previous - Current
DPb = Uvp[im1]-Uvd[im1]; //-- Previous - Bound Inf DPb = Uvp[im1]-Uvd[im1]; //-- Previous - Bound Inf
ParC[im1] = Uvd[im1]; //-- ParamCorrige 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; 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] = DPc*DPb + dv2;
Duv[im1] = Duv[im1]*Duv[im1]/(DPc*DPc+dv2)/(DPb*DPb+dv2); Duv[im1] = Duv[im1]*Duv[im1]/(DPc*DPc+dv2)/(DPb*DPb+dv2);
} }
else { else {
Duv[im1]=-1.0; //-- Si Pas de prgogression, on ne change pas Duv[im1]=-1.0; //-- If no progress, do not change
} //-- le choix de l iso } //-- 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; //-- Trouve = Standard_True; //--
DPc = Param(i)-Uvp[im1]; //-- Current - Previous DPc = Param(i)-Uvp[im1]; //-- Current - Previous
DPb = Uvf[im1]-Uvp[im1]; //-- Bound Sup - Previous DPb = Uvf[im1]-Uvp[im1]; //-- Bound Sup - Previous
ParC[im1] = Uvf[im1]; //-- Param Corrige 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; 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] = DPc*DPb + dv2;
Duv[im1] = Duv[im1]*Duv[im1]/(DPc*DPc+dv2)/(DPb*DPb+dv2); Duv[im1] = Duv[im1]*Duv[im1]/(DPc*DPc+dv2)/(DPb*DPb+dv2);
} }
else { else {
Duv[im1]=-1.0; //-- Si Pas de prgogression, on ne change pas Duv[im1]=-1.0; //-- If no progress, do not change
} //-- le choix de l iso } //-- the choice of iso
} }
else { else {
Duv[im1]= -1.; Duv[im1]= -1.;
@ -104,10 +111,10 @@ Standard_Boolean IntWalk_PWalking::
if (Trouve) { if (Trouve) {
//-------------------------------------------------- //--------------------------------------------------
//-- Un des Parametres u1,v1,u2,v2 est en dehors -- //-- One of Parameters u1,v1,u2,v2 is outside of --
//-- des bornes naturelles. -- //-- the natural limits. --
//-- On cherche la meilleure direction de -- //-- Find the best direction of --
//-- progression et on recadre les params. -- //-- progress and reframe the parameters. --
//-------------------------------------------------- //--------------------------------------------------
Standard_Real ddv = -1.0; Standard_Real ddv = -1.0;
k=-1; k=-1;
@ -140,7 +147,7 @@ Standard_Boolean IntWalk_PWalking::
} }
else else
{ {
if (!DejaReparti) { // recherche si ligne fermee if (!DejaReparti) { // find if line closed
Standard_Real u,v; Standard_Real u,v;
const IntSurf_PntOn2S& POn2S1=line->Value(1); const IntSurf_PntOn2S& POn2S1=line->Value(1);

View File

@ -2,6 +2,7 @@ if { [info exists square] } {
set prop "square" set prop "square"
set mass $square set mass $square
if { [info exists tol_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 regexp {Mass +: +([-0-9.+eE]+)} [sprops result $tol_square] full m
} else { } else {
regexp {Mass +: +([-0-9.+eE]+)} [sprops result] full m regexp {Mass +: +([-0-9.+eE]+)} [sprops result] full m

View File

@ -66,5 +66,5 @@ copy r_1 result
# An exception was caught Standard_ConstructionError: # An exception was caught Standard_ConstructionError:
# ** Exception ** Standard_ConstructionError: # ** Exception ** Standard_ConstructionError:
set square 1.63191e+07 set square 1.65227e+07
set 2dviewer 0 set 2dviewer 0

29
tests/bugs/modalg_5/bug24140 Executable file
View File

@ -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