From 9d083161b6c8c22a0674a60f09971b170a1d3910 Mon Sep 17 00:00:00 2001 From: nbv Date: Fri, 9 Nov 2018 18:00:46 +0300 Subject: [PATCH] 0025952: Wrong intersection curve Test cases for the issue have been created. --- tests/lowalgos/intss/begin | 4 +-- tests/lowalgos/intss/bug25952_1 | 28 +++++++++++++++++ tests/lowalgos/intss/bug25952_2 | 56 +++++++++++++++++++++++++++++++++ tests/lowalgos/intss/bug25952_3 | 53 +++++++++++++++++++++++++++++++ 4 files changed, 139 insertions(+), 2 deletions(-) create mode 100644 tests/lowalgos/intss/bug25952_1 create mode 100644 tests/lowalgos/intss/bug25952_2 create mode 100644 tests/lowalgos/intss/bug25952_3 diff --git a/tests/lowalgos/intss/begin b/tests/lowalgos/intss/begin index b6734b105d..1c0cb8dd13 100644 --- a/tests/lowalgos/intss/begin +++ b/tests/lowalgos/intss/begin @@ -4,7 +4,7 @@ # theCosMaxAngle sets the maximal rotation angle between two adjacent segments. This value must be equal to the cosine of this angle. help CheckLoops {curve CosMaxAngle theNbPoints } -proc CheckLoops {theCurve theCosMaxAngle {theNbPoints 1000.0}} { +proc CheckLoops {theCurve {theCosMaxAngle 0.8} {theNbPoints 1000.0}} { upvar #0 $theCurve aCurve bounds aCurve U1 U2 @@ -20,7 +20,7 @@ proc CheckLoops {theCurve theCosMaxAngle {theNbPoints 1000.0}} { set dp [ dval dx1*dx2+dy2*dy2+dz1*dz2 ] if {$dp < [ expr $theCosMaxAngle * sqrt($nv1 * $nv2) ] } { - puts "Error: The curve aCurve is possible to have a bend at parameter $p. Please check carefully" + puts "Error: The curve $theCurve is possible to have a bend at parameter $p. Please check carefully" } dset dx1 dx2 diff --git a/tests/lowalgos/intss/bug25952_1 b/tests/lowalgos/intss/bug25952_1 new file mode 100644 index 0000000000..41c36f6beb --- /dev/null +++ b/tests/lowalgos/intss/bug25952_1 @@ -0,0 +1,28 @@ +puts "========" +puts "0025952: Wrong intersection curve" +puts "========" +puts "" + +puts "TODO OCC25952 ALL: Error: The curve c_1 is possible to have a bend at" + +restore [locate_data_file bug25952_shape.brep] q +explode q +copy q_1 b1 +copy q_2 b2 + +regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} [bopcurves b1 b2 -2d] full Toler NbCurv + +checkreal Tolerance $Toler 1.0e-7 1.0e-7 0.0 +if {$NbCurv != 1} { + puts "Error: Please check NbCurves for intersector" +} else { + checklength c_1 -l 0.00068663591416249451 + CheckLoops c_1 +} + +smallview +don c_* +fit +disp b1 b2 + +checkview -screenshot -2d -path ${imagedir}/${test_image}.png diff --git a/tests/lowalgos/intss/bug25952_2 b/tests/lowalgos/intss/bug25952_2 new file mode 100644 index 0000000000..307a89f1d4 --- /dev/null +++ b/tests/lowalgos/intss/bug25952_2 @@ -0,0 +1,56 @@ +puts "========" +puts "0025952: Wrong intersection curve" +puts "========" +puts "" + +puts "TODO OCC25952 ALL: Error: The curve res_1 is possible to have a bend at parameter" + +set aGoodNbCurves 1 + +restore [locate_data_file bug25952_shape.brep] q +explode q +copy q_1 b1 +copy q_2 b2 + +mksurface s1 b1 +mksurface s2 b2 + +trimv s2t s2 0.24999939999991502 1 + +intersect res s1 s2t + +set che [whatis res] +set ind [string first "3d curve" $che] +if {${ind} >= 0} { + #Only variable "res" exists + renamevar res res_1 +} + +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 + CheckLoops res_$ic + 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 2.0e-7 2.0e-7 +} + + +smallview +don res_* +fit + +checkview -screenshot -2d -path ${imagedir}/${test_image}.png diff --git a/tests/lowalgos/intss/bug25952_3 b/tests/lowalgos/intss/bug25952_3 new file mode 100644 index 0000000000..411cf51c9d --- /dev/null +++ b/tests/lowalgos/intss/bug25952_3 @@ -0,0 +1,53 @@ +puts "========" +puts "0025952: Wrong intersection curve" +puts "========" +puts "" + +puts "TODO OCC26510 ALL: Error: 1 curve is expected but 0 ones are found" + +set aGoodNbCurves 1 + +restore [locate_data_file bug25952_shape.brep] q +explode q +copy q_1 b1 +copy q_2 b2 + +mksurface s1 b1 +mksurface s2 b2 + +intersect res s1 s2 + +set che [whatis res] +set ind [string first "3d curve" $che] +if {${ind} >= 0} { + #Only variable "res" exists + renamevar res res_1 +} + +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 + CheckLoops res_$ic + incr ic + } +} + +set ic [expr $ic - 1] + +if { $ic != $aGoodNbCurves } { + puts "Error: $aGoodNbCurves curve is expected but $ic ones are found" +} else { + CheckIntersectionResult s1 s2 $CurvesList 100 2.0e-7 2.0e-7 +} + +smallview +don res_* +fit + +checkview -screenshot -2d -path ${imagedir}/${test_image}.png