From 63fa56bc83f2f366068fd2e67fce3ea4ff0c5ee3 Mon Sep 17 00:00:00 2001 From: azv Date: Fri, 8 Apr 2022 11:03:53 +0300 Subject: [PATCH] 0032915: Geom2dAPI_InterCurveCurve, The algorithm lost an intersection point. Get rid of strange code: preliminary check of self-intersections is made on a polygonal representation of a curve, it is able to find possible intersections, but after that it filter out segments neighbor to the pair of non-intersected segments. Test case de step_4 I1 has been marked BAD, because the self-intersection is treated correctly, but the projection algorithm generates such crooked 2D curve. Reference data in test cases heal split_angle_advanced ZA5 and ZA6 has been updated, because those shapes have self-intersected edges, which are being detected now. --- src/IntCurve/IntCurve_IntPolyPolyGen.gxx | 18 +----------------- tests/bugs/modalg_8/bug32915 | 18 ++++++++++++++++++ tests/de/step_4/I1 | 1 + tests/heal/data/advanced/ZA5 | 2 +- tests/heal/data/advanced/ZA6 | 2 +- 5 files changed, 22 insertions(+), 19 deletions(-) create mode 100644 tests/bugs/modalg_8/bug32915 diff --git a/src/IntCurve/IntCurve_IntPolyPolyGen.gxx b/src/IntCurve/IntCurve_IntPolyPolyGen.gxx index 6675efbb85..96dbc6243c 100644 --- a/src/IntCurve/IntCurve_IntPolyPolyGen.gxx +++ b/src/IntCurve/IntCurve_IntPolyPolyGen.gxx @@ -388,9 +388,6 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1 } } - Standard_Integer Nelarg=(Poly1.NbSegments()/20); - if(Nelarg<2) Nelarg=2; - for(Standard_Integer sp=1; sp <= Nbsp; sp++) { if(TriIndex[sp]>0) { const Intf_SectionPoint& SPnt = InterPP.PntValue(TriIndex[sp]); @@ -401,20 +398,7 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1 if(Abs(SegIndex1-SegIndex2)>1) { EIP.Perform(Poly1,Poly1,SegIndex1,SegIndex2,ParamOn1,ParamOn2); - if(EIP.NbRoots()==0) { - //-- All neighbor segments are removed - for(Standard_Integer k=sp+1;k<=Nbsp;k++) { - Standard_Integer kk=TriIndex[k]; - // --- avoid negative indices as well as in outer done - if( kk > 0 ) { - if( Abs(SegIndex1-PtrSegIndex1[kk])< Nelarg - && Abs(SegIndex2-PtrSegIndex2[kk])< Nelarg) { - TriIndex[k]=-k; - } - } - } - } - else if(EIP.NbRoots()>=1) { + if(EIP.NbRoots()>=1) { //-------------------------------------------------------------------- //-- It is checked if the found point is a root //-------------------------------------------------------------------- diff --git a/tests/bugs/modalg_8/bug32915 b/tests/bugs/modalg_8/bug32915 new file mode 100644 index 0000000000..a6ffebb42b --- /dev/null +++ b/tests/bugs/modalg_8/bug32915 @@ -0,0 +1,18 @@ +puts "=================================================" +puts "0032915: Geom2dAPI_InterCurveCurve, The algorithm lost an intersection point." +puts "=================================================" +puts "" + +restore [locate_data_file bug32915.brep] e +mkcurve c3d e +plane p 0 0 1 +project c2d c3d p + +set inter [2dintersect c2d] +if {[regexp -all "Intersection point" $inter] != 29} { + puts "Error: Wrong number of self-intersections (expected 29 points)." +} + +v2d +2dfit +checkview -screenshot -2d -path ${imagedir}/${test_image}.png diff --git a/tests/de/step_4/I1 b/tests/de/step_4/I1 index 97c04743c8..dd5aad33ad 100644 --- a/tests/de/step_4/I1 +++ b/tests/de/step_4/I1 @@ -1,4 +1,5 @@ # !!!! This file is generated automatically, do not edit manually! See end script +puts "TODO ALL: Error : 1 differences with reference data found" set filename PRO7187.stp diff --git a/tests/heal/data/advanced/ZA5 b/tests/heal/data/advanced/ZA5 index 3ded5f2d5c..6f79cc914b 100644 --- a/tests/heal/data/advanced/ZA5 +++ b/tests/heal/data/advanced/ZA5 @@ -1,5 +1,5 @@ if {[string compare $command "SplitAngle"] == 0 } { - puts "TODO OCC23127 ALL: Faulty shapes in variables faulty_1 to faulty_4 " + puts "TODO OCC23127 ALL: Faulty shapes in variables faulty_1 to faulty_" } restore [locate_data_file SEB-1.brep] a diff --git a/tests/heal/data/advanced/ZA6 b/tests/heal/data/advanced/ZA6 index ae6df8112e..86ae5b50c2 100644 --- a/tests/heal/data/advanced/ZA6 +++ b/tests/heal/data/advanced/ZA6 @@ -1,5 +1,5 @@ if {[string compare $command "SplitAngle"] == 0 } { - puts "TODO OCC23127 ALL: Faulty shapes in variables faulty_1 to faulty_4 " + puts "TODO OCC23127 ALL: Faulty shapes in variables faulty_1 to faulty_" } restore [locate_data_file SEB-1B.brep] a