diff --git a/src/DrawTrSurf/DrawTrSurf.cxx b/src/DrawTrSurf/DrawTrSurf.cxx index adba8f4511..7acc396812 100644 --- a/src/DrawTrSurf/DrawTrSurf.cxx +++ b/src/DrawTrSurf/DrawTrSurf.cxx @@ -284,7 +284,7 @@ static Standard_Integer drawpoles(Draw_Interpretor&, } } - if ( n<2) return 1; + if ( n<2) return 0; Handle(DrawTrSurf_BezierSurface) BZS; BZS = GetBezierSurface(a[1]); diff --git a/tests/lowalgos/intss/begin b/tests/lowalgos/intss/begin index 1c0cb8dd13..af6e07dbf3 100644 --- a/tests/lowalgos/intss/begin +++ b/tests/lowalgos/intss/begin @@ -47,4 +47,28 @@ proc CheckIntersectionResult {theSurf1 theSurf2 theListOfCurves theNbPoints theT xdistcs aCurve s1 U1 U2 $theNbPoints $theTolerS1 xdistcs aCurve s2 U1 U2 $theNbPoints $theTolerS2 } -} \ No newline at end of file +} + +# Check whether given list contain overlapped curves +help CheckOverlapIntCurves { theListOfCurves } +proc CheckOverlapIntCurves { theListOfCurves {theTolerance 1.0e-7} } { + set NbEdges [expr [llength $theListOfCurves] - 1 ] + for { set i1 0 } { $i1 < $NbEdges } { incr i1 } { + for { set i2 [expr $i1 + 1] } { $i2 <= $NbEdges } { incr i2 } { + upvar #0 [ lindex $theListOfCurves $i1 ] aCurve1 + upvar #0 [ lindex $theListOfCurves $i2 ] aCurve2 + + mkedge e1 aCurve1 + mkedge e2 aCurve2 + + set coe [ checkoverlapedges e1 e2 $theTolerance ] + + if { [regexp "Edges is not overlaped" $coe] != 1 } { + set cIdx1 [ expr $i1 + 1 ] + set cIdx2 [ expr $i2 + 1 ] + + puts "Error: Curves $cIdx1 and $cIdx2 are overlapped" + } + } + } +} diff --git a/tests/lowalgos/intss/bug21494_2 b/tests/lowalgos/intss/bug21494_2 index d13d7126c5..3f66f312c0 100644 --- a/tests/lowalgos/intss/bug21494_2 +++ b/tests/lowalgos/intss/bug21494_2 @@ -1,10 +1,7 @@ puts "========" -puts "OCC21494" +puts "OCC21494: Intersection between cone and sphere fails" puts "========" puts "" -############################################ -# Intersection between cone and sphere fails -############################################ foreach a [directory res*] {unset $a} diff --git a/tests/lowalgos/intss/bug25950 b/tests/lowalgos/intss/bug25950 new file mode 100644 index 0000000000..cabd35ee4a --- /dev/null +++ b/tests/lowalgos/intss/bug25950 @@ -0,0 +1,88 @@ +puts "=========" +puts "0025950: Bad performance of intersection algorithm." +puts "=========" +puts "" + +cpulimit 200 + +puts "TODO 0025950 ALL: Error: 0 vertices are expected but 2 are found." +puts "TODO 0025950 ALL: Error : The length of result shape is 18.8605" + +set aGoodNbCurves 3 + +foreach a [directory res*] {unset $a} + +restore [locate_data_file bug25950_b1.brep] b1 +restore [locate_data_file bug25950_b2.brep] b2 + +mksurface s1 b1 +mksurface s2 b2 + +don s1 s2 +clpoles s1 +clpoles s2 +clknots + +dchrono z reset +dchrono z start + +intersect res s1 s2 + +dchrono z stop counter Bug25950IntSS +dchrono z show + +smallview +Y+Z +fit +checkview -screenshot -2d -path ${imagedir}/${test_image}_2d.png + +set che [whatis res] +set ind [string first "3d curve" $che] +if {${ind} >= 0} { + #Only variable "res" exists + renamevar res res_1 +} + +bclearobjects +bcleartools +compound IntEdges + +set CurvesList {} + +set ic 1 +set AllowRepeat 1 +while { $AllowRepeat != 0 } { + set che [whatis res_$ic] + set ind [string first "3d curve" $che] + if {${ind} < 0} { + set AllowRepeat 0 + } else { + lappend CurvesList res_$ic + mkedge ee res_$ic + baddobjects ee + incr ic + } +} + +set ic [expr $ic - 1] + +if { $ic != $aGoodNbCurves } { + puts "Error: $aGoodNbCurves curves is expected but $ic ones are found" +} else { + CheckIntersectionResult s1 s2 $CurvesList 100 7.0e-5 2.0e-4 + CheckOverlapIntCurves $CurvesList + if {$ic > 1} { + bfillds + bbuild result + } elseif {$ic > 0} { + mkedge result res_1 + } + + # Check gaps between intersection curves + checksection result -r 0 + checkmaxtol result -min_tol 2.0e-7 + + checknbshapes result -edge 3 -vertex 4 + checkprops result -l 37.721 +} + +checkview -display result -2d -path ${imagedir}/${test_image}_3d.png \ No newline at end of file