DiscussionsIssue archiveOCCT:Modeling Algorithms

Archived issue #0024359

Crash on BRepAlgoAPI_Fuse

CommunityOCCT:Modeling Algorithmsclosed7 public notes

Search issues

Description

When fusing 27 spheres of radius 2 at (x, y, z) where x = 1, 2 or 3, y = 1, 2, or 3, and z = 1, 2, or 3, it crashes.

Steps to reproduce

Try the following code in draw.exe. It crashes. I tried 6.7.0 beta, 6.6.0, 6.5.x. All crash.

psphere s01 2; ttranslate s01 1 1 1
psphere s02 2; ttranslate s02 1 1 2
psphere s03 2; ttranslate s03 1 1 3
psphere s04 2; ttranslate s04 1 2 1
psphere s05 2; ttranslate s05 1 2 2
psphere s06 2; ttranslate s06 1 2 3
psphere s07 2; ttranslate s07 1 3 1
psphere s08 2; ttranslate s08 1 3 2
psphere s09 2; ttranslate s09 1 3 3
psphere s10 2; ttranslate s10 2 1 1
psphere s11 2; ttranslate s11 2 1 2
psphere s12 2; ttranslate s12 2 1 3
psphere s13 2; ttranslate s13 2 2 1
psphere s14 2; ttranslate s14 2 2 2
psphere s15 2; ttranslate s15 2 2 3
psphere s16 2; ttranslate s16 2 3 1
psphere s17 2; ttranslate s17 2 3 2
psphere s18 2; ttranslate s18 2 3 3
psphere s19 2; ttranslate s19 3 1 1
psphere s20 2; ttranslate s20 3 1 2
psphere s21 2; ttranslate s21 3 1 3
psphere s22 2; ttranslate s22 3 2 1
psphere s23 2; ttranslate s23 3 2 2
psphere s24 2; ttranslate s24 3 2 3
psphere s25 2; ttranslate s25 3 3 1
psphere s26 2; ttranslate s26 3 3 2
psphere s27 2; ttranslate s27 3 3 3

bop s01 s02; bopfuse s
bop s s03; bopfuse s
bop s s04; bopfuse s
bop s s05; bopfuse s
bop s s06; bopfuse s
bop s s07; bopfuse s
bop s s08; bopfuse s
bop s s09; bopfuse s
bop s s10; bopfuse s
bop s s11; bopfuse s
bop s s12; bopfuse s
bop s s13; bopfuse s
bop s s14; bopfuse s
bop s s15; bopfuse s
bop s s16; bopfuse s
bop s s17; bopfuse s
bop s s18; bopfuse s
bop s s19; bopfuse s
bop s s20; bopfuse s
bop s s21; bopfuse s
bop s s22; bopfuse s
bop s s23; bopfuse s
bop s s24; bopfuse s
bop s s25; bopfuse s
bop s s26; bopfuse s
bop s s27; bopfuse s

Additional information

C++ code to do it. Crashes also.

TopoDS_Shape r = BRepPrimAPI_MakeSphere(gp_Pnt(10,0,0), 2);
for (int i = 1; i < 4; i++)
  for (int j = 1; j < 4; j++)
    for (int k = 1; k < 4; k++)
      r = BRepAlgoAPI_Fuse(r, BRepPrimAPI_MakeSphere(gp_Pnt(i,j,k), 2));

Public activity

7 archived notes

Participants are labeled by their role within this record.

01Commenter 1
Just for information: I have tried this code on OCCT 6.7.0.beta built with VC9 32-bit on Windows; DRAW script produced valid result after some time (~ 25 min, notably all operations until s19 are done quite fast, as well as the last one, s27, so there is performance issue with at least s19). No crash detected.

02Author
It takes so long time that I think it crashes. I retried it and got a valid result after an overnight running. I also tried the old BRepAlgo_Fuse. It has no such performance issue.

03Commenter 3
The problem in the algorithm of projection of 3d curve on the surface. It takes nearly five minutes to project part of the circle on the sphere. Try the sub case in draw:

psphere p1 2; ttranslate p1 1 1 3
psphere p2 2; ttranslate p2 3 1 1
explode p1 f; copy p1_1 f1
explode p2 f; copy p2_1 f2
mksurface s1 f1
mksurface s2 f2
intersect i s1 s2
trim c i_2 5.1724665738417412 6.2831853071795862
don c s1; fit
chrono t reset; chrono t start;
project c2d c s1
#Projection Failed
chrono t stop; chrono t show
#Elapsed time: 0 Hours 4 Minutes 56.3626932083 Seconds
#CPU user time: 295.2942929 seconds
#CPU system time: 0.0312002 seconds
04Commenter 4
Please review CR24359
05Commenter 5
No remarks.
06Commenter 6
Dear Commenter 1,

Branch CR24359 (and products from GIT master) was compiled on Linux and Windows platforms and tested.
[revision removed]

Number of compiler warnings:

occt component :
Linux: 103 (103 on master)
Windows: 0 (0 on master)

products component :
Linux: 188 (188 on master)
Windows: 237 (237 on master)

Regressions/Differences:
No regressions/differences

Testing cases:
http://occt-tests/CR24359-master-occt/Debian60-64/bugs/modalg_5/bug24359.html
http://occt-tests/CR24359-master-occt/Windows-32-VC9/bugs/modalg_5/bug24359.html
bugs modalg_5(010) bug24359: OK

Testing on Linux:
Total MEMORY difference: 358518844 / 358740848
Total CPU difference: 40388.93000000013 / 45679.10000000019

Testing on Windows:
Total MEMORY difference: 413107660 / 412495636
Total CPU difference: 31279.09375 / 33996.28125

There are not differences in images found by testdiff.
07Commenter 7
The test modalg_5 bug24359 fails on 64-bit windows on current master