mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-05-21 10:55:33 +03:00
0025321: Test case bugs/modalg_5(010)/bug24981 hangs in Debug mode on Debian60-64 platform
Eliminated possible inifite loop when projecting curve on surface.
This commit is contained in:
parent
eb7404bf16
commit
7da00517d4
@ -95,9 +95,11 @@ void Approx_ComputeCLine::Perform(const MultiLine& Line)
|
|||||||
Standard_Real myfirstU = UFirst;
|
Standard_Real myfirstU = UFirst;
|
||||||
Standard_Real mylastU = ULast;
|
Standard_Real mylastU = ULast;
|
||||||
|
|
||||||
if (!mycut) {
|
if (!mycut)
|
||||||
|
{
|
||||||
alldone = Compute(Line, UFirst, ULast, thetol3d, thetol2d);
|
alldone = Compute(Line, UFirst, ULast, thetol3d, thetol2d);
|
||||||
if (!alldone) {
|
if (!alldone)
|
||||||
|
{
|
||||||
tolreached = Standard_False;
|
tolreached = Standard_False;
|
||||||
myfirstparam.Append(UFirst);
|
myfirstparam.Append(UFirst);
|
||||||
mylastparam.Append(ULast);
|
mylastparam.Append(ULast);
|
||||||
@ -106,32 +108,39 @@ void Approx_ComputeCLine::Perform(const MultiLine& Line)
|
|||||||
Tolers2d.Append(currenttol2d);
|
Tolers2d.Append(currenttol2d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
|
|
||||||
// previous decision to be taken if we get worse with next cut (eap)
|
// previous decision to be taken if we get worse with next cut (eap)
|
||||||
AppParCurves_MultiCurve KeptMultiCurve;
|
AppParCurves_MultiCurve KeptMultiCurve;
|
||||||
Standard_Real KeptUfirst = 0., KeptUlast = 0., KeptT3d = RealLast(), KeptT2d = 0.;
|
Standard_Real KeptUfirst = 0., KeptUlast = 0., KeptT3d = RealLast(), KeptT2d = 0.;
|
||||||
Standard_Integer NbWorseDecis = 0, NbAllowedBadDecis = 10;
|
|
||||||
|
|
||||||
while (!Finish) {
|
while (!Finish)
|
||||||
|
{
|
||||||
|
|
||||||
// Gestion du decoupage de la multiline pour approximer:
|
// Gestion du decoupage de la multiline pour approximer:
|
||||||
if (!begin) {
|
if (!begin)
|
||||||
if (Ok) {
|
{
|
||||||
|
if (Ok)
|
||||||
|
{
|
||||||
// Calcul de la partie a approximer.
|
// Calcul de la partie a approximer.
|
||||||
myfirstU = mylastU;
|
myfirstU = mylastU;
|
||||||
mylastU = ULast;
|
mylastU = ULast;
|
||||||
if (Abs(ULast-myfirstU) <= RealEpsilon()) {
|
if (Abs(ULast-myfirstU) <= RealEpsilon())
|
||||||
|
{
|
||||||
Finish = Standard_True;
|
Finish = Standard_True;
|
||||||
alldone = Standard_True;
|
alldone = Standard_True;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
KeptT3d = RealLast(); KeptT2d = 0;
|
KeptT3d = RealLast(); KeptT2d = 0;
|
||||||
NbWorseDecis = 0;
|
KeptUfirst = myfirstU;
|
||||||
|
KeptUlast = mylastU;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
// keep best decison
|
// keep best decison
|
||||||
if ((thetol3d + thetol2d) < (KeptT3d + KeptT2d)) {
|
if ((thetol3d + thetol2d) < (KeptT3d + KeptT2d))
|
||||||
|
{
|
||||||
KeptMultiCurve = TheMultiCurve;
|
KeptMultiCurve = TheMultiCurve;
|
||||||
KeptUfirst = myfirstU;
|
KeptUfirst = myfirstU;
|
||||||
KeptUlast = mylastU;
|
KeptUlast = mylastU;
|
||||||
@ -144,21 +153,14 @@ void Approx_ComputeCLine::Perform(const MultiLine& Line)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Abs(myfirstU-mylastU) <= TolU) /*break;*/ // pour ne pas planter
|
|
||||||
NbAllowedBadDecis /= 2; // la station.
|
|
||||||
|
|
||||||
// Calcul des parametres sur ce nouvel intervalle.
|
// Calcul des parametres sur ce nouvel intervalle.
|
||||||
Ok = Compute(Line, myfirstU, mylastU, thetol3d, thetol2d);
|
Ok = Compute(Line, myfirstU, mylastU, thetol3d, thetol2d);
|
||||||
|
|
||||||
//cout << myfirstU << " - " << mylastU << " tol : " << thetol3d << " " << thetol2d << endl;
|
//cout << myfirstU << " - " << mylastU << " tol : " << thetol3d << " " << thetol2d << endl;
|
||||||
|
|
||||||
// is new decision better?
|
// is new decision better?
|
||||||
if ( !Ok && (thetol3d + thetol2d) > (KeptT3d + KeptT2d) )
|
if (!Ok && Abs(myfirstU-mylastU) <= TolU)
|
||||||
{
|
{
|
||||||
NbWorseDecis++;
|
|
||||||
|
|
||||||
if (NbWorseDecis > NbAllowedBadDecis) {
|
|
||||||
|
|
||||||
Ok = Standard_True; // stop interval cutting, approx the rest part
|
Ok = Standard_True; // stop interval cutting, approx the rest part
|
||||||
mylastU = KeptUlast;
|
mylastU = KeptUlast;
|
||||||
|
|
||||||
@ -169,7 +171,6 @@ void Approx_ComputeCLine::Perform(const MultiLine& Line)
|
|||||||
myfirstparam.Append (KeptUfirst);
|
myfirstparam.Append (KeptUfirst);
|
||||||
mylastparam.Append (KeptUlast);
|
mylastparam.Append (KeptUlast);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
begin = Standard_False;
|
begin = Standard_False;
|
||||||
} // while (!Finish)
|
} // while (!Finish)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user