1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0023453: Infinite loop on cut operation

In IntTools_FClass2d.cxx, do {} while {} cycle is replaced by for () cycle to avoid possible infinite loop.
Check for degeneration is made with Precision::Confusion() precision instead of comparison with 0.
Correction of misprint
This commit is contained in:
abv
2012-10-05 13:58:17 +04:00
parent 08cd2f6bb1
commit 2478cd9d9f

View File

@@ -194,25 +194,24 @@ IntTools_FClass2d::IntTools_FClass2d()
// //
//-- Verification of cases when forgotten to code degenereted //-- Verification of cases when forgotten to code degenereted
if(!degenerated) { if(!degenerated) {
Standard_Real aR2; // check that whole curve is located in vicinity of its middle point
gp_Pnt P3da, P3db; // (within sphere of Precision::Confusion() diameter)
//
C3d.Initialize (edge, Face); C3d.Initialize (edge, Face);
du=(plbid-pfbid)*0.1; gp_Pnt P3da = C3d.Value (0.5 * (pfbid + plbid));
u=pfbid+du; du = plbid - pfbid;
P3da=C3d.Value(u); const int NBSTEPS = 10;
Standard_Real aPrec2 = 0.25 * Precision::Confusion() * Precision::Confusion();
degenerated = Standard_True; degenerated = Standard_True;
u+=du; for (Standard_Integer i=0; i <= NBSTEPS; i++)
do { {
P3db=C3d.Value(u); Standard_Real u = pfbid + i * du / NBSTEPS;
aR2=P3da.SquareDistance(P3db); gp_Pnt P3db = C3d.Value (u);
if(aR2>0.) { Standard_Real aR2 = P3da.SquareDistance (P3db);
if (aR2 > aPrec2) {
degenerated = Standard_False; degenerated = Standard_False;
break; break;
} }
u+=du;
} }
while(u<plbid);
}//if(!degenerated) }//if(!degenerated)
//-- ---------------------------------------- //-- ----------------------------------------
Tole = BRep_Tool::Tolerance(edge); Tole = BRep_Tool::Tolerance(edge);