View Issue Details

IDProjectCategoryView StatusLast Update
0023453CommunityOCCT:Modeling Algorithmspublic2012-11-16 13:17
Reporterabv Assigned Toabv  
Status closedResolutionfixed 
Product Version6.5.3 
Target Version6.5.4Fixed in Version6.5.4 
Summary0023453: Infinite loop on cut operation
DescriptionThe problem is reported by Paul Jimenez on OCCT forum


I am using BRepAlgoAPI_Cut to cut a Compound of Faces with another Compound of Faces. The process occurs interactively. I was forcing the application to perform the algorithm over and over again with different faces that constantly changed. After a few seconds of doing this the application stopped responding. Fortunately, it was running in the debugger, so I was able to find the place it got stuck in.

 The function where it occurs is IntTools_FClass2d::Init. The loop begins at line 188 in my copy of inttools_fclass2d.cxx. It is as follows:

      do {
       gp_Pnt P3db=C3d.Value(u);
       if(P3da.SquareDistance(P3db)) {

 Local variables:

 plbid: 6451.7439502819680
 u: 6451.7439502819643
 du: 3.6379788070917132e-013

 "u+=du" is not updating "u"s value because du is too small. plbid and u are the same up to the 11th decimal, which should be enough to exit the loop. In other words, a precision problem is causing this infinite loop.


Proposed patch:

 File: inttools_fclass2d.cxx
 Line: 183
 From: du=(plbid-pfbid)*0.1;
 To: du=(plbid-pfbid+BRep_Tool::Tolerance(edge))*0.1;

 I am not sure if that's the best tolerance value to use there, but at least it will guarantee a decent du.
TagsNo tags attached.
Test case numberNot needed



2012-09-29 09:58

manager   ~0021600

Last edited: 2012-09-29 11:02

The fix is integrated to branch CR23453, please review.
Note that no test case is available, thus the fix is speculative: do {} while {} loop is replaced by for {} to make sure it is always finite.


2012-10-03 10:28

developer   ~0021628

Reviewed with correction of misprint


2012-10-04 17:42

tester   ~0021660

Dear BugMaster,
Branch CR23453 (and products from GIT master) was compiled on Linux and Windows platforms and tested.

Not detected

Not detected

Testing cases:
Not needed

Related Changesets

occt: master 2478cd9d

2012-10-05 09:58:17


Committer: abv Details Diff
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
Affected Issues
mod - src/IntTools/IntTools_FClass2d.cxx Diff File

Issue History

Date Modified Username Field Change
2012-09-29 09:41 abv New Issue
2012-09-29 09:41 abv Assigned To => jgv
2012-09-29 09:58 abv Note Added: 0021600
2012-09-29 09:58 abv Status new => resolved
2012-09-29 11:02 abv Note Edited: 0021600
2012-10-03 10:28 jgv Note Added: 0021628
2012-10-03 10:28 jgv Status resolved => reviewed
2012-10-03 18:13 mkv Assigned To jgv => mkv
2012-10-03 18:13 mkv Test case number => Not needed
2012-10-04 17:42 mkv Note Added: 0021660
2012-10-04 17:43 mkv Assigned To mkv => bugmaster
2012-10-04 17:43 mkv Status reviewed => tested
2012-10-08 16:14 abv Changeset attached => occt master 2478cd9d
2012-10-08 16:15 abv Assigned To bugmaster => abv
2012-10-08 16:15 abv Status tested => verified
2012-10-08 16:15 abv Resolution open => fixed
2012-11-16 13:14 bugmaster Fixed in Version => 6.5.4
2012-11-16 13:17 bugmaster Status verified => closed