diff --git a/src/BOPTest/BOPTest_BOPCommands.cxx b/src/BOPTest/BOPTest_BOPCommands.cxx index f0e99e4624..edf17415e2 100644 --- a/src/BOPTest/BOPTest_BOPCommands.cxx +++ b/src/BOPTest/BOPTest_BOPCommands.cxx @@ -647,6 +647,7 @@ Standard_Integer bopcurves (Draw_Interpretor& di, aToApproxC2dOnS2, anAppTol); aFF.SetList(aListOfPnts); + aFF.SetFuzzyValue (BOPTest_Objects::FuzzyValue()); // aFF.Perform (aF1, aF2); // diff --git a/src/IntPatch/IntPatch_ImpImpIntersection_4.gxx b/src/IntPatch/IntPatch_ImpImpIntersection_4.gxx index 6ccc8b5bfb..8fe2d216a3 100644 --- a/src/IntPatch/IntPatch_ImpImpIntersection_4.gxx +++ b/src/IntPatch/IntPatch_ImpImpIntersection_4.gxx @@ -3507,8 +3507,8 @@ static IntPatch_ImpImpIntersection::IntStatus const IntSurf_PntOn2S& aPntLWL1 = aWLine1->Point(aWLine1->NbPnts()); const IntSurf_PntOn2S aPntCur = theSPnt.Value(aNbPnt).PntOn2S(); - if (aPntCur.IsSame(aPntFWL1, Precision::Confusion()) || - aPntCur.IsSame(aPntLWL1, Precision::Confusion())) + if (aPntCur.IsSame(aPntFWL1, aTol3D) || + aPntCur.IsSame(aPntLWL1, aTol3D)) { theSPnt.Remove(aNbPnt); aNbPnt--; diff --git a/tests/bugs/modalg_7/bug31499_1 b/tests/bugs/modalg_7/bug31499_1 new file mode 100644 index 0000000000..fcb8aee87f --- /dev/null +++ b/tests/bugs/modalg_7/bug31499_1 @@ -0,0 +1,79 @@ +puts "=============================================================================================" +puts "OCC31499: Boolean Operations - Custom fuzzy value corrupts the result of CUT" +puts "=============================================================================================" +puts "" + +restore [locate_data_file bug31499.brep] s + +# perform operation with default fuzzy value +bfuzzyvalue 1.e-7 + +tcopy s s1 +explode s1 So + +bclearobjects +bcleartools +baddobjects s1_1 +baddtools s1_2 s1_3 s1_4 +bfillds + +bbop r1_0 0 +bbop r1_1 1 +bbop r1_2 2 +bbop r1_3 3 +bbop r1_4 4 +bbuild r1_5 + + +# perform operation with custom fuzzy value +bfuzzyvalue 1.e-5 + +tcopy s s2 +explode s2 So + +bclearobjects +bcleartools +baddobjects s2_1 +baddtools s2_2 s2_3 s2_4 +bfillds + +bbop r2_0 0 +bbop r2_1 1 +bbop r2_2 2 +bbop r2_3 3 +bbop r2_4 4 +bbuild r2_5 + +foreach j {1 2} { + foreach i {0 1 2 3 4 5} { + checkshape r${j}_$i + if {![regexp "OK" [bopcheck r${j}_$i]]} { + puts "Error: r${j}_$i is self-intersecting shape" + } + } +} + +checkprops r1_0 -s 858.419 -v 687.948 +checknbshapes r1_0 -wire 21 -face 21 -shell 3 -solid 3 -t + +checkprops r1_1 -s 29829.2 -v 219732 +checknbshapes r1_1 -wire 34 -face 34 -shell 1 -solid 1 -t + +checkprops r1_2 -s 1987.39 -v 6408.07 +checknbshapes r1_2 -wire 19 -face 19 -shell 1 -solid 1 -t + +checkprops r1_3 -s 37868.2 -v 212636 +checknbshapes r1_3 -wire 60 -face 60 -shell 6 -solid 6 -t + +checkprops r1_4 -l 379.04 +checksection r1_4 -r 0 + +checkprops r1_5 -s 40714 -v 219732 +checknbshapes r1_5 -wire 79 -face 79 -shell 10 -solid 10 -t + +foreach i {0 1 2 3 4 5} { + checkprops r2_$i -equal r1_$i + checknbshapes r2_$i -ref [nbshapes r2_$i] +} + +checkview -display r2_2 -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_7/bug31499_2 b/tests/bugs/modalg_7/bug31499_2 new file mode 100644 index 0000000000..b9ac3975e7 --- /dev/null +++ b/tests/bugs/modalg_7/bug31499_2 @@ -0,0 +1,36 @@ +puts "=============================================================================================" +puts "OCC31499: Boolean Operations - Custom fuzzy value corrupts the result of CUT" +puts "=============================================================================================" +puts "" + +restore [locate_data_file bug31499.brep] s + +explode s So +explode s_1 f; copy s_1_3 f1 +explode s_2 f; copy s_2_4 f2 + +foreach c [directory c_*] { unset $c } + +bfuzzyvalue 1.e-7 +regexp {Tolerance Reached=([-0-9.+eE]*)} [bopcurves f1 f2 -2d] full tol3D1 + +set length1 0.0 +foreach c [directory c_*] { + set length1 [dval $length1+[dval [lindex [length $c] 4]]] +} + +foreach c [directory c_*] { unset $c } + +bfuzzyvalue 1.e-5 +regexp {Tolerance Reached=([-0-9.+eE]*)} [bopcurves f1 f2 -2d] full tol3D2 + +set length2 0.0 +foreach c [directory c_*] { + set length2 [dval $length2+[dval [lindex [length $c] 4]]] +} + +checkreal "Length of curves" $length2 $length1 1.e-7 1.e-7 + +if {$tol3D2 > 1.e-5} { + puts "Error: Face/Face intersection tolerance is too big when using fuzzy value" +}