From 3e1b1da77c49807199e464ffcff10a7386ce3e5b Mon Sep 17 00:00:00 2001 From: jgv Date: Thu, 20 Aug 2015 16:38:43 +0300 Subject: [PATCH] 0026554: Error in IntPatch_PrmPrmIntersection: initial step for walking line is not related with actual tolerance Test case for issue CR26554 Small corrections for issue CR26554 --- src/IntWalk/IntWalk_PWalking.cxx | 23 +++++++++++++++---- tests/boolean/bsection/R9 | 2 +- tests/bugs/modalg_6/bug26493 | 8 +++---- tests/bugs/modalg_6/bug26554 | 32 ++++++++++++++++++++++++++ tests/bugs/moddata_1/bug13 | 39 ++++++++------------------------ 5 files changed, 65 insertions(+), 39 deletions(-) create mode 100644 tests/bugs/modalg_6/bug26554 diff --git a/src/IntWalk/IntWalk_PWalking.cxx b/src/IntWalk/IntWalk_PWalking.cxx index eb71123b01..658bccd3f3 100644 --- a/src/IntWalk/IntWalk_PWalking.cxx +++ b/src/IntWalk/IntWalk_PWalking.cxx @@ -48,9 +48,10 @@ void ComputePasInit(Standard_Real *pasuv, Standard_Real _Vm1,Standard_Real _VM1, Standard_Real _Um2,Standard_Real _UM2, Standard_Real _Vm2,Standard_Real _VM2, - const Handle(Adaptor3d_HSurface)& , - const Handle(Adaptor3d_HSurface)& , - const Standard_Real Increment) + const Handle(Adaptor3d_HSurface)& Caro1, + const Handle(Adaptor3d_HSurface)& Caro2, + const Standard_Real Increment, + const Standard_Real tolconf) { Standard_Real du1=Abs(UM1-Um1); Standard_Real dv1=Abs(VM1-Vm1); @@ -74,6 +75,20 @@ void ComputePasInit(Standard_Real *pasuv, pasuv[1]=Increment*dv1; pasuv[2]=Increment*du2; pasuv[3]=Increment*dv2; + + Standard_Real ResoU1tol = Adaptor3d_HSurfaceTool::UResolution(Caro1, tolconf); + Standard_Real ResoV1tol = Adaptor3d_HSurfaceTool::VResolution(Caro1, tolconf); + Standard_Real ResoU2tol = Adaptor3d_HSurfaceTool::UResolution(Caro2, tolconf); + Standard_Real ResoV2tol = Adaptor3d_HSurfaceTool::VResolution(Caro2, tolconf); + + if (pasuv[0] < 2*ResoU1tol) + pasuv[0] = 2*ResoU1tol; + if (pasuv[1] < 2*ResoV1tol) + pasuv[1] = 2*ResoV1tol; + if (pasuv[2] < 2*ResoU2tol) + pasuv[2] = 2*ResoU2tol; + if (pasuv[3] < 2*ResoV2tol) + pasuv[3] = 2*ResoV2tol; } //======================================================================= @@ -703,7 +718,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep, const Standard_Real VLast2 = Adaptor3d_HSurfaceTool::LastVParameter (Caro2); // ComputePasInit(pasuv,u1min,u1max,v1min,v1max,u2min,u2max,v2min,v2max, - Um1,UM1,Vm1,VM1,Um2,UM2,Vm2,VM2,Caro1,Caro2,pasMax+pasMax); + Um1,UM1,Vm1,VM1,Um2,UM2,Vm2,VM2,Caro1,Caro2,pasMax+pasMax,tolconf); // if(pasuv[0]<100.0*ResoU1) { pasuv[0]=100.0*ResoU1; diff --git a/tests/boolean/bsection/R9 b/tests/boolean/bsection/R9 index 0a1a9e026c..37d251b5ca 100644 --- a/tests/boolean/bsection/R9 +++ b/tests/boolean/bsection/R9 @@ -7,4 +7,4 @@ restore [locate_data_file buc60462b.brep] b bsection result a b -set length 261.53 +set length 268.348 \ No newline at end of file diff --git a/tests/bugs/modalg_6/bug26493 b/tests/bugs/modalg_6/bug26493 index 5561e4a299..b1059da01a 100755 --- a/tests/bugs/modalg_6/bug26493 +++ b/tests/bugs/modalg_6/bug26493 @@ -13,18 +13,18 @@ prj res wire plate 0 0 -1 renamevar res_1 result -set length 1003.94 +set length 1189.91 set nbshapes_expected " Number of shapes in shape - VERTEX : 2 - EDGE : 1 + VERTEX : 3 + EDGE : 2 WIRE : 1 FACE : 0 SHELL : 0 SOLID : 0 COMPSOLID : 0 COMPOUND : 0 - SHAPE : 4 + SHAPE : 6 " checknbshapes result -ref ${nbshapes_expected} -t -m "fuzzy booleans with multiple tools" diff --git a/tests/bugs/modalg_6/bug26554 b/tests/bugs/modalg_6/bug26554 new file mode 100644 index 0000000000..f4d6aa08c5 --- /dev/null +++ b/tests/bugs/modalg_6/bug26554 @@ -0,0 +1,32 @@ +puts "============" +puts "OCC26554" +puts "============" +puts "" +####################################################################### +# Error in IntPatch_PrmPrmIntersection: initial step for walking line is not related with actual tolerance +####################################################################### + +restore [locate_data_file bug26554_a.brep] a +restore [locate_data_file bug26554_b.brep] b + +bop a b +bopsection result + +set length 0.00502025 + +set nbshapes_expected " +Number of shapes in shape + VERTEX : 2 + EDGE : 1 + WIRE : 0 + FACE : 0 + SHELL : 0 + SOLID : 0 + COMPSOLID : 0 + COMPOUND : 1 + SHAPE : 4 + +" +checknbshapes result -ref ${nbshapes_expected} -t -m "result" + +set 2dviewer 1 diff --git a/tests/bugs/moddata_1/bug13 b/tests/bugs/moddata_1/bug13 index 2f58908458..e01f1bc748 100755 --- a/tests/bugs/moddata_1/bug13 +++ b/tests/bugs/moddata_1/bug13 @@ -7,36 +7,15 @@ puts "" ################################################## restore [locate_data_file OCC13-1.draw] su1 -############### checkshape su1 # is not a topological shape restore [locate_data_file OCC13-2.draw] su2 -############### checkshape su2 # is not a topological shape -#Try to intersect two surfaces with tolerance 0.1 -#note that distance between shapes is about 0.005942345501409 +mkface f1 su1 +mkface f2 su2 -catch {intersect res su1 su2 0.1 } result -set nom 0 - set j 1 - repeat 10 { - set che [whatis res_$j] - set che1 [whatis res_$j] - set err [lindex $che [expr [llength $che] - 1]] - set err1 [lindex $che1 [expr [llength $che1] - 2]] - if { $err != "curve" && $err1 != "3d"} { - break - } else { - set nom [expr $nom + 1] - - #Check, if curve has non-zero length - set info [length res_$j] - regexp {The length res_1 is+ +([-0-9.+eE]+)} $info full ll - if {${ll} < 1.0e-7} { - puts "Error : res_$j has null-length" - } - - incr j - } - } -if { $nom == 0} { - puts "Error : Intersection was made WRONGLY" -} +bop f1 f2 +bopsection result + +tolerance result +checkshape result + +set 3dviewer 1