0027976: Unstable work of 2d intersection algorithm for two lines
authornbv <nbv@opencascade.com>
Thu, 29 Nov 2018 07:02:14 +0000 (10:02 +0300)
committerapn <apn@opencascade.com>
Fri, 21 Dec 2018 12:38:03 +0000 (15:38 +0300)
1. Test case for the issue has been created.
The problem is still reproduced on MASTER.

2. Some test cases have been moved to lowalgos/2dinter grid.

23 files changed:
tests/bugs/modalg_5/bug23706_4 [deleted file]
tests/bugs/modalg_5/bug23706_5 [deleted file]
tests/bugs/modalg_6/bug25593 [deleted file]
tests/bugs/modalg_6/bug26099 [deleted file]
tests/bugs/modalg_7/bug29162 [deleted file]
tests/bugs/moddata_2/bug23587 [deleted file]
tests/bugs/moddata_2/bug4426_1 [deleted file]
tests/bugs/moddata_2/bug4426_2 [deleted file]
tests/bugs/moddata_3/bug24800 [deleted file]
tests/bugs/moddata_3/bug25876 [deleted file]
tests/bugs/step/bug24100 [deleted file]
tests/lowalgos/2dinter/bug23587 [new file with mode: 0644]
tests/lowalgos/2dinter/bug23706_4 [new file with mode: 0644]
tests/lowalgos/2dinter/bug23706_5 [new file with mode: 0644]
tests/lowalgos/2dinter/bug24100 [new file with mode: 0644]
tests/lowalgos/2dinter/bug24800 [new file with mode: 0644]
tests/lowalgos/2dinter/bug25593 [new file with mode: 0644]
tests/lowalgos/2dinter/bug25876 [new file with mode: 0644]
tests/lowalgos/2dinter/bug26099 [new file with mode: 0644]
tests/lowalgos/2dinter/bug27976 [new file with mode: 0644]
tests/lowalgos/2dinter/bug29162 [new file with mode: 0644]
tests/lowalgos/2dinter/bug4426_1 [new file with mode: 0644]
tests/lowalgos/2dinter/bug4426_2 [new file with mode: 0644]

diff --git a/tests/bugs/modalg_5/bug23706_4 b/tests/bugs/modalg_5/bug23706_4
deleted file mode 100755 (executable)
index e84fa2b..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-puts "============"
-puts "OCC23706"
-puts "============"
-puts ""
-#########################################################################
-# Cannot project point on curve
-#########################################################################
-
-2dbsplinecurve c1 2 5 0 3 0.2 1 0.3 1 0.4 1 0.5 3 2 0 1 3 -1 1 5 5 1 5 5 1 6 8 1 4 7 1
-2dbsplinecurve c3 2 4 1 3 2 1 3 1 5 3 6 3 1 5.001 5.01 1 5.001 5.01 1 3 9 1 2 11 1
-set info [2dintersect c1 c3]
-
-if { [regexp "Intersection point 1" $info] != 1  } {
-   puts "Error : Intersection should have two points"
-} else {
-   regexp {Intersection point 1 +: +([-0-9.+eE]+)} $info full p11t
-   regexp {Intersection point 1 +: +[-0-9.+eE]+ +([-0-9.+eE]+)} $info full p12t
-}
-
-if { [regexp "Intersection point 2" $info] != 1  } {
-   puts "Error : Intersection should have two points"
-} else {
-   regexp {Intersection point 2 +: +([-0-9.+eE]+)} $info full p21t
-   regexp {Intersection point 2 +: +[-0-9.+eE]+ +([-0-9.+eE]+)} $info full p22t
-}
-
-set p11 [expr round($p11t*10000)]
-set p12 [expr round($p12t*10000)]
-set p21 [expr round($p21t*10000)]
-set p22 [expr round($p22t*10000)]
-
-if { ${p11} != 50024 || ${p12} != 50072 || ${p21} != 40024 || ${p22} != 70012 } {
-    puts "Error : Points of intersection have wrong coordinates"
-} else {
-    puts "OK: Points of intersection are right"
-}
-
diff --git a/tests/bugs/modalg_5/bug23706_5 b/tests/bugs/modalg_5/bug23706_5
deleted file mode 100755 (executable)
index 19d169f..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-puts "============"
-puts "OCC23706"
-puts "============"
-puts ""
-#########################################################################
-# Cannot project point on curve
-#########################################################################
-
-2dbsplinecurve c1 2 5 0 3 0.2 1 0.3 1 0.4 1 0.5 3 2 0 1 3 -1 1 5 5 1 5 5 1 6 8 1 4 7 1
-2dbsplinecurve c2 2 4 1 3 2 1 3 1 5 3 6 3 1 5 5 1 5 5 1 3 9 1 2 11 1
-set info [2dintersect c1 c2]
-
-if { [regexp "Intersection point 1" $info] != 1  } {
-   puts "Error : Intersection should have two points"
-} else {
-   regexp {Intersection point 1 +: +([-0-9.+eE]+)} $info full p11
-   regexp {Intersection point 1 +: +[-0-9.+eE]+ +([-0-9.+eE]+)} $info full p12
-}
-
-if { [regexp "Intersection point 2" $info] != 1  } {
-   puts "Error : Intersection should have two points"
-} else {
-   regexp {Intersection point 2 +: +([-0-9.+eE]+)} $info full p21t
-   regexp {Intersection point 2 +: +[-0-9.+eE]+ +([-0-9.+eE]+)} $info full p22t
-}
-
-set p21 [expr int($p21t)]
-set p22 [expr int($p22t)]
-
-if { ${p11} != 5 || ${p12} != 5 || ${p21} != 4 || ${p22} != 7 } {
-    puts "Error : Points of intersection have wrong coordinates"
-} else {
-    puts "OK: Points of intersection are right"
-}
diff --git a/tests/bugs/modalg_6/bug25593 b/tests/bugs/modalg_6/bug25593
deleted file mode 100755 (executable)
index 9917a0d..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-puts "============"
-puts "OCC25593"
-puts "============"
-puts ""
-#########################################################################
-# Number of intersection points for 2d curves depends on the order of arguments in command "2dintersect"
-#########################################################################
-
-restore [locate_data_file bug25593_face1.brep] b
-pcurve b
-
-puts "Intersection 1"
-set info1 [2dintersect b_2 b_3 -tol 1.e-10]
-regexp {Intersection point 1 : +([-0-9.+eE]+) +([-0-9.+eE]+)} $info1 full p1x p1y
-regexp {parameter on the fist: +([-0-9.+eE]+) +parameter on the second: +([-0-9.+eE]+)} $info1 full par1f par1s
-
-puts "Intersection 2"
-set info2 [2dintersect b_3 b_2 -tol 1.e-10]
-regexp {Intersection point 1 : +([-0-9.+eE]+) +([-0-9.+eE]+)} $info2 full p2x p2y
-regexp {parameter on the fist: +([-0-9.+eE]+) +parameter on the second: +([-0-9.+eE]+)} $info2 full par2f par2s
-
-set NbIP1 1
-if { [regexp "Intersection point 1" $info1] != 1  } {
-   puts "Error : Intersection 1 should have one point"
-   set NbIP1 0
-}
-if { [regexp "Intersection point 2" $info1] == 1  } {
-   puts "Error : Intersection 1 should have one point"
-   set NbIP1 2
-}
-puts "NbIP1=$NbIP1"
-
-set NbIP2 1
-if { [regexp "Intersection point 1" $info2] != 1  } {
-   puts "Error : Intersection 2 should have one point"
-   set NbIP2 0
-}
-if { [regexp "Intersection point 2" $info2] == 1  } {
-   puts "Error : Intersection 2 should have one point"
-   set NbIP2 2
-}
-puts "NbIP2=$NbIP2"
-
-if { $NbIP1 != 1 || $NbIP2 != 1 } {
-   puts "ERROR: Wrong solutions number"
-} else {
-   puts "p1x=$p1x p1y=$p1y par1f=$par1f $par1s"
-   puts "p2x=$p2x p2y=$p2y par2f=$par2f $par2s"
-   set sqd [expr ($p1x-$p2x)*($p1x-$p2x)+($p1y-$p2y)*($p1y-$p2y)]
-   if { $sqd > 1.0e-14 } {
-      puts "ERROR: Intersection points are different"
-   } else {
-      puts "OK: Intersection points are equal"
-   }
-   if { (abs($par1f - $par2s) > 1.0e-9) || (abs($par1s - $par2f) > 1.0e-9) } {
-      puts "ERROR: Parameters on intersecting curves are not coincided"
-   } else {
-      puts "OK: Parameters on intersecting curves are coincided"
-   }
-}
diff --git a/tests/bugs/modalg_6/bug26099 b/tests/bugs/modalg_6/bug26099
deleted file mode 100644 (file)
index 8fe535c..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-puts "========"
-puts "OCC26099"
-puts "========"
-puts ""
-##################################################
-# Wrong result done by 2d intersection algorithm
-##################################################
-
-restore [locate_data_file OCC26099-f.brep] f
-explode f e
-pcurve c4 f_4 f
-pcurve c5 f_5 f
-set bug_info [2dintersect c4 c5]
-
-if {[regexp {fist: ([\-0-9.]*) .*second: ([\-0-9.]*)} $bug_info dummy par1 par2] == 0} {
-  puts "ERROR: OCC26099 is reproduced. No intersection."
-}
-
-set refpar1 0.98989794855663704
-set refpar2 0
-if {[expr abs($par1-$refpar1)] > 0.0001 || [expr abs($par2-$refpar2)] > 0.0001} {
-  puts "ERROR: OCC26099 is reproduced. Parameters are $par1 and $par2, expected $refpar1 and $refpar2"
-}
diff --git a/tests/bugs/modalg_7/bug29162 b/tests/bugs/modalg_7/bug29162
deleted file mode 100644 (file)
index f001945..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-puts "========"
-puts "OCC29162"
-puts "========"
-puts ""
-##################################################
-# Geom2dInt_GInter algorithm does not find 
-# intersection of ellipse and line
-##################################################
-
-ellipse e -610.348096534595 -710.720096056787 0.999999902285153 0.000442074298181498 15.0066332711999 0.291884102212871
-trim e e 3.09462291909258 9.37780822627216
-
-line l -625.34430362036 -680.713463264921 -0.000252749178714602 -0.999999968058926
-trim l l 0 30.0132665523925
-
-set cx 0
-set cy 0
-
-regexp {Intersection point 1 : ([-0-9.+eE]+) ([-0-9.+eE]+)} [2dintersect e l ] full cx cy
-checkreal n1 $cx -625.35188801291508 1.e-7 1.e-7
-checkreal n2 $cy -710.72104765746838 1.e-7 1.e-7
-
diff --git a/tests/bugs/moddata_2/bug23587 b/tests/bugs/moddata_2/bug23587
deleted file mode 100755 (executable)
index ee41d79..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-puts "============"
-puts "CR23587"
-puts "==========="
-puts ""
-###############################################################################
-# Operation "2dintersect "in TestHarness can not find intersection point of two intersecting 2d curves.
-###############################################################################
-
-restore [locate_data_file bug23587_IntEdges.brep] a
-
-explode a 
-
-plane pl1 0 0 0 0 0 1
-trim trpl1 pl1 -1000 1000 -1000 1000
-mkface f1 trpl1
-pcurve c1 a_1 f1
-pcurve c2 a_2 f1
-pcurve c3 a_3 f1
-pcurve c4 a_4 f1
-set inter1 [2dintersect c1 c2 -tol 1.e-6]
-set inter2 [2dintersect c3 c2 -tol 1.e-6]
-set inter3 [2dintersect c1 c4 -tol 1.e-6]
-set inter4 [2dintersect c3 c4 -tol 1.e-6]
-set int1 [regexp {Intersection point 1} $inter1]
-set int2 [regexp {Intersection point 1} $inter2]
-set int3 [regexp {Intersection point 1} $inter3]
-set int4 [regexp {Intersection point 1} $inter4]
-
-if { $int1 == 0 || $int2 == 0 || $int3 == 0 || $int4 ==0 } {
-    puts "Error : Intersection is not found"
-} 
-
-av2d
-2dfit
-
-xwd ${imagedir}/${test_image}.png
diff --git a/tests/bugs/moddata_2/bug4426_1 b/tests/bugs/moddata_2/bug4426_1
deleted file mode 100755 (executable)
index 0fc291e..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-puts "================"
-puts "OCC4426"
-puts "================"
-puts ""
-#######################################################################################
-# Incorrect result of intersection in 2D between circle and line
-#######################################################################################
-
-v2d2
-circle c1 2 2 1
-2dfit
-2dzoom 120
-line l1 3 0 0 1
-2dintersect l1 c1
-erase l1 c1
-2dfit
-
-puts "ATTENTION! Check following:"
-puts "There is only one intersection point (green X)"
-
-checkview -display result -2d -path ${imagedir}/${test_image}.png
-
diff --git a/tests/bugs/moddata_2/bug4426_2 b/tests/bugs/moddata_2/bug4426_2
deleted file mode 100755 (executable)
index 6e7e975..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-puts "================"
-puts "OCC4426"
-puts "================"
-puts ""
-#######################################################################################
-# Incorrect result of intersection in 2D between circle and line
-#######################################################################################
-
-v2d2
-line ll1 0 0 0.3 0.7
-line ll2 0 0 0.37 0.63
-trim tll1 ll1 -0.00001 0.00001
-trim tll2 ll2 -0.00001 0.00001
-donly tll1 tll2
-2dintersect tll1 tll2
-2dfit
-
-puts "ATTENTION! Check following:"
-puts "There is the intersection point (green X) on center of grid axis"
-
-checkview -display result -2d -path ${imagedir}/${test_image}.png
-
diff --git a/tests/bugs/moddata_3/bug24800 b/tests/bugs/moddata_3/bug24800
deleted file mode 100755 (executable)
index 60b8cbc..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-puts "============"
-puts "CR24800"
-puts "==========="
-puts ""
-###############################################################################
-# Point of intersection was not found for 2d offset curve.
-###############################################################################
-
-restore [locate_data_file bug24800_curve2.draw] c2
-
-set inter1 [2dintersect c2]
-
-set int1 [regexp {Intersection point 1} ${inter1}]
-
-if { ${int1} == 0 } {
-    puts "Error : Intersection is not found"
-} 
-
-av2d
-2dfit
-
-xwd ${imagedir}/${test_image}.png
diff --git a/tests/bugs/moddata_3/bug25876 b/tests/bugs/moddata_3/bug25876
deleted file mode 100755 (executable)
index 8264857..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-puts "============"
-puts "CR25876"
-puts "==========="
-puts ""
-###############################################################################
-# Geom2dAPI_InterCurveCurve returns only one intersection point instead of two intersection points
-###############################################################################
-
-restore [locate_data_file bug25876_oc_test_firstcircle.brep] e1
-restore [locate_data_file bug25876_oc_test_secondcircle.brep] e2
-
-explode e1
-explode e2
-
-mk2dcurve c1 e1_1
-mk2dcurve c2 e2_1
-
-set inter1 [2dintersect c1 c2 -tol 1e-3]
-set int1 [regexp {Intersection point 2} ${inter1}]
-if { ${int1} == 0 } {
-    puts "Error : Second intersection is not found"
-} 
-
-#smallview -2D-
-view 1 -2D- 728 450 400 400
-2dfit
-xwd ${imagedir}/${test_image}_1.png
-donly c1 c2
-
-set inter2 [2dintersect c1 c2 -tol 1e-7]
-set int2 [regexp {Intersection point 2} ${inter2}]
-if { ${int2} == 0 } {
-    puts "Error : Second intersection is not found"
-} 
-
-xwd ${imagedir}/${test_image}_2.png
diff --git a/tests/bugs/step/bug24100 b/tests/bugs/step/bug24100
deleted file mode 100644 (file)
index 1df0bc3..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-puts "TODO OCC24100 ALL: Error : Bad pcurve is built on a face while converting the shape from STEP format"
-
-puts "========"
-puts "OCC24100"
-puts "========"
-puts ""
-############################################################################
-# Bad pcurve is built on a face while converting the shape from STEP format.
-############################################################################
-
-stepread [locate_data_file bug24100_REFLECT_CURVE_PART_5_SOL_ohne_Metadaten.stp] a *
-
-explode a_1 f
-
-pcurve a_1_686
-
-set inter2 [2dintersect a_1_686_4 a_1_686_3]
-set int2 [regexp {Intersection point 2} ${inter2}]
-if { ${int2} == 1 } {
-    puts "Error : Bad pcurve is built on a face while converting the shape from STEP format"
-} 
diff --git a/tests/lowalgos/2dinter/bug23587 b/tests/lowalgos/2dinter/bug23587
new file mode 100644 (file)
index 0000000..ee41d79
--- /dev/null
@@ -0,0 +1,36 @@
+puts "============"
+puts "CR23587"
+puts "==========="
+puts ""
+###############################################################################
+# Operation "2dintersect "in TestHarness can not find intersection point of two intersecting 2d curves.
+###############################################################################
+
+restore [locate_data_file bug23587_IntEdges.brep] a
+
+explode a 
+
+plane pl1 0 0 0 0 0 1
+trim trpl1 pl1 -1000 1000 -1000 1000
+mkface f1 trpl1
+pcurve c1 a_1 f1
+pcurve c2 a_2 f1
+pcurve c3 a_3 f1
+pcurve c4 a_4 f1
+set inter1 [2dintersect c1 c2 -tol 1.e-6]
+set inter2 [2dintersect c3 c2 -tol 1.e-6]
+set inter3 [2dintersect c1 c4 -tol 1.e-6]
+set inter4 [2dintersect c3 c4 -tol 1.e-6]
+set int1 [regexp {Intersection point 1} $inter1]
+set int2 [regexp {Intersection point 1} $inter2]
+set int3 [regexp {Intersection point 1} $inter3]
+set int4 [regexp {Intersection point 1} $inter4]
+
+if { $int1 == 0 || $int2 == 0 || $int3 == 0 || $int4 ==0 } {
+    puts "Error : Intersection is not found"
+} 
+
+av2d
+2dfit
+
+xwd ${imagedir}/${test_image}.png
diff --git a/tests/lowalgos/2dinter/bug23706_4 b/tests/lowalgos/2dinter/bug23706_4
new file mode 100644 (file)
index 0000000..e84fa2b
--- /dev/null
@@ -0,0 +1,37 @@
+puts "============"
+puts "OCC23706"
+puts "============"
+puts ""
+#########################################################################
+# Cannot project point on curve
+#########################################################################
+
+2dbsplinecurve c1 2 5 0 3 0.2 1 0.3 1 0.4 1 0.5 3 2 0 1 3 -1 1 5 5 1 5 5 1 6 8 1 4 7 1
+2dbsplinecurve c3 2 4 1 3 2 1 3 1 5 3 6 3 1 5.001 5.01 1 5.001 5.01 1 3 9 1 2 11 1
+set info [2dintersect c1 c3]
+
+if { [regexp "Intersection point 1" $info] != 1  } {
+   puts "Error : Intersection should have two points"
+} else {
+   regexp {Intersection point 1 +: +([-0-9.+eE]+)} $info full p11t
+   regexp {Intersection point 1 +: +[-0-9.+eE]+ +([-0-9.+eE]+)} $info full p12t
+}
+
+if { [regexp "Intersection point 2" $info] != 1  } {
+   puts "Error : Intersection should have two points"
+} else {
+   regexp {Intersection point 2 +: +([-0-9.+eE]+)} $info full p21t
+   regexp {Intersection point 2 +: +[-0-9.+eE]+ +([-0-9.+eE]+)} $info full p22t
+}
+
+set p11 [expr round($p11t*10000)]
+set p12 [expr round($p12t*10000)]
+set p21 [expr round($p21t*10000)]
+set p22 [expr round($p22t*10000)]
+
+if { ${p11} != 50024 || ${p12} != 50072 || ${p21} != 40024 || ${p22} != 70012 } {
+    puts "Error : Points of intersection have wrong coordinates"
+} else {
+    puts "OK: Points of intersection are right"
+}
+
diff --git a/tests/lowalgos/2dinter/bug23706_5 b/tests/lowalgos/2dinter/bug23706_5
new file mode 100644 (file)
index 0000000..19d169f
--- /dev/null
@@ -0,0 +1,34 @@
+puts "============"
+puts "OCC23706"
+puts "============"
+puts ""
+#########################################################################
+# Cannot project point on curve
+#########################################################################
+
+2dbsplinecurve c1 2 5 0 3 0.2 1 0.3 1 0.4 1 0.5 3 2 0 1 3 -1 1 5 5 1 5 5 1 6 8 1 4 7 1
+2dbsplinecurve c2 2 4 1 3 2 1 3 1 5 3 6 3 1 5 5 1 5 5 1 3 9 1 2 11 1
+set info [2dintersect c1 c2]
+
+if { [regexp "Intersection point 1" $info] != 1  } {
+   puts "Error : Intersection should have two points"
+} else {
+   regexp {Intersection point 1 +: +([-0-9.+eE]+)} $info full p11
+   regexp {Intersection point 1 +: +[-0-9.+eE]+ +([-0-9.+eE]+)} $info full p12
+}
+
+if { [regexp "Intersection point 2" $info] != 1  } {
+   puts "Error : Intersection should have two points"
+} else {
+   regexp {Intersection point 2 +: +([-0-9.+eE]+)} $info full p21t
+   regexp {Intersection point 2 +: +[-0-9.+eE]+ +([-0-9.+eE]+)} $info full p22t
+}
+
+set p21 [expr int($p21t)]
+set p22 [expr int($p22t)]
+
+if { ${p11} != 5 || ${p12} != 5 || ${p21} != 4 || ${p22} != 7 } {
+    puts "Error : Points of intersection have wrong coordinates"
+} else {
+    puts "OK: Points of intersection are right"
+}
diff --git a/tests/lowalgos/2dinter/bug24100 b/tests/lowalgos/2dinter/bug24100
new file mode 100644 (file)
index 0000000..c8b94cf
--- /dev/null
@@ -0,0 +1,22 @@
+puts "TODO OCC24100 ALL: Error : Bad pcurve is built on a face while converting the shape from STEP format"
+
+puts "========"
+puts "OCC24100"
+puts "========"
+puts ""
+############################################################################
+# Bad pcurve is built on a face while converting the shape from STEP format.
+############################################################################
+
+pload XDE
+stepread [locate_data_file bug24100_REFLECT_CURVE_PART_5_SOL_ohne_Metadaten.stp] a *
+
+explode a_1 f
+
+pcurve a_1_686
+
+set inter2 [2dintersect a_1_686_4 a_1_686_3]
+set int2 [regexp {Intersection point 2} ${inter2}]
+if { ${int2} == 1 } {
+    puts "Error : Bad pcurve is built on a face while converting the shape from STEP format"
+} 
diff --git a/tests/lowalgos/2dinter/bug24800 b/tests/lowalgos/2dinter/bug24800
new file mode 100644 (file)
index 0000000..60b8cbc
--- /dev/null
@@ -0,0 +1,22 @@
+puts "============"
+puts "CR24800"
+puts "==========="
+puts ""
+###############################################################################
+# Point of intersection was not found for 2d offset curve.
+###############################################################################
+
+restore [locate_data_file bug24800_curve2.draw] c2
+
+set inter1 [2dintersect c2]
+
+set int1 [regexp {Intersection point 1} ${inter1}]
+
+if { ${int1} == 0 } {
+    puts "Error : Intersection is not found"
+} 
+
+av2d
+2dfit
+
+xwd ${imagedir}/${test_image}.png
diff --git a/tests/lowalgos/2dinter/bug25593 b/tests/lowalgos/2dinter/bug25593
new file mode 100644 (file)
index 0000000..9917a0d
--- /dev/null
@@ -0,0 +1,60 @@
+puts "============"
+puts "OCC25593"
+puts "============"
+puts ""
+#########################################################################
+# Number of intersection points for 2d curves depends on the order of arguments in command "2dintersect"
+#########################################################################
+
+restore [locate_data_file bug25593_face1.brep] b
+pcurve b
+
+puts "Intersection 1"
+set info1 [2dintersect b_2 b_3 -tol 1.e-10]
+regexp {Intersection point 1 : +([-0-9.+eE]+) +([-0-9.+eE]+)} $info1 full p1x p1y
+regexp {parameter on the fist: +([-0-9.+eE]+) +parameter on the second: +([-0-9.+eE]+)} $info1 full par1f par1s
+
+puts "Intersection 2"
+set info2 [2dintersect b_3 b_2 -tol 1.e-10]
+regexp {Intersection point 1 : +([-0-9.+eE]+) +([-0-9.+eE]+)} $info2 full p2x p2y
+regexp {parameter on the fist: +([-0-9.+eE]+) +parameter on the second: +([-0-9.+eE]+)} $info2 full par2f par2s
+
+set NbIP1 1
+if { [regexp "Intersection point 1" $info1] != 1  } {
+   puts "Error : Intersection 1 should have one point"
+   set NbIP1 0
+}
+if { [regexp "Intersection point 2" $info1] == 1  } {
+   puts "Error : Intersection 1 should have one point"
+   set NbIP1 2
+}
+puts "NbIP1=$NbIP1"
+
+set NbIP2 1
+if { [regexp "Intersection point 1" $info2] != 1  } {
+   puts "Error : Intersection 2 should have one point"
+   set NbIP2 0
+}
+if { [regexp "Intersection point 2" $info2] == 1  } {
+   puts "Error : Intersection 2 should have one point"
+   set NbIP2 2
+}
+puts "NbIP2=$NbIP2"
+
+if { $NbIP1 != 1 || $NbIP2 != 1 } {
+   puts "ERROR: Wrong solutions number"
+} else {
+   puts "p1x=$p1x p1y=$p1y par1f=$par1f $par1s"
+   puts "p2x=$p2x p2y=$p2y par2f=$par2f $par2s"
+   set sqd [expr ($p1x-$p2x)*($p1x-$p2x)+($p1y-$p2y)*($p1y-$p2y)]
+   if { $sqd > 1.0e-14 } {
+      puts "ERROR: Intersection points are different"
+   } else {
+      puts "OK: Intersection points are equal"
+   }
+   if { (abs($par1f - $par2s) > 1.0e-9) || (abs($par1s - $par2f) > 1.0e-9) } {
+      puts "ERROR: Parameters on intersecting curves are not coincided"
+   } else {
+      puts "OK: Parameters on intersecting curves are coincided"
+   }
+}
diff --git a/tests/lowalgos/2dinter/bug25876 b/tests/lowalgos/2dinter/bug25876
new file mode 100644 (file)
index 0000000..8264857
--- /dev/null
@@ -0,0 +1,36 @@
+puts "============"
+puts "CR25876"
+puts "==========="
+puts ""
+###############################################################################
+# Geom2dAPI_InterCurveCurve returns only one intersection point instead of two intersection points
+###############################################################################
+
+restore [locate_data_file bug25876_oc_test_firstcircle.brep] e1
+restore [locate_data_file bug25876_oc_test_secondcircle.brep] e2
+
+explode e1
+explode e2
+
+mk2dcurve c1 e1_1
+mk2dcurve c2 e2_1
+
+set inter1 [2dintersect c1 c2 -tol 1e-3]
+set int1 [regexp {Intersection point 2} ${inter1}]
+if { ${int1} == 0 } {
+    puts "Error : Second intersection is not found"
+} 
+
+#smallview -2D-
+view 1 -2D- 728 450 400 400
+2dfit
+xwd ${imagedir}/${test_image}_1.png
+donly c1 c2
+
+set inter2 [2dintersect c1 c2 -tol 1e-7]
+set int2 [regexp {Intersection point 2} ${inter2}]
+if { ${int2} == 0 } {
+    puts "Error : Second intersection is not found"
+} 
+
+xwd ${imagedir}/${test_image}_2.png
diff --git a/tests/lowalgos/2dinter/bug26099 b/tests/lowalgos/2dinter/bug26099
new file mode 100644 (file)
index 0000000..8fe535c
--- /dev/null
@@ -0,0 +1,23 @@
+puts "========"
+puts "OCC26099"
+puts "========"
+puts ""
+##################################################
+# Wrong result done by 2d intersection algorithm
+##################################################
+
+restore [locate_data_file OCC26099-f.brep] f
+explode f e
+pcurve c4 f_4 f
+pcurve c5 f_5 f
+set bug_info [2dintersect c4 c5]
+
+if {[regexp {fist: ([\-0-9.]*) .*second: ([\-0-9.]*)} $bug_info dummy par1 par2] == 0} {
+  puts "ERROR: OCC26099 is reproduced. No intersection."
+}
+
+set refpar1 0.98989794855663704
+set refpar2 0
+if {[expr abs($par1-$refpar1)] > 0.0001 || [expr abs($par2-$refpar2)] > 0.0001} {
+  puts "ERROR: OCC26099 is reproduced. Parameters are $par1 and $par2, expected $refpar1 and $refpar2"
+}
diff --git a/tests/lowalgos/2dinter/bug27976 b/tests/lowalgos/2dinter/bug27976
new file mode 100644 (file)
index 0000000..2c22e42
--- /dev/null
@@ -0,0 +1,37 @@
+puts "========"
+puts "0027976: Unstable work of 2d intersection algorithm for two lines"
+puts "========"
+puts ""
+
+puts "TODO OCC27976 All: Error: wrong 2-th intersection result"
+
+set aRefPx 170.0
+set aRefPy 9620.0
+
+binrestore [locate_data_file bug27976_fe.bin] b
+explode b
+don b_1
+pcurve b_1
+
+smallview -2D-
+point p1 169.98949375765261 9619.9910661265931
+point p2 170.00862369283078 9620.0101960617721
+don p1 p2
+2dfit
+don b_1_4 b_1_5
+set log(1) [2dintersect b_1_4 b_1_5 -tol 1.e-10]
+checkview -screenshot -2d -path ${imagedir}/${test_image}_1.png
+
+trim c2d b_1_5 9610 9610.0000006891
+don b_1_4 c2d
+set log(2) [2dintersect b_1_4 c2d -tol 1.e-10]
+checkview -screenshot -2d -path ${imagedir}/${test_image}_2.png
+
+for {set i 1} {$i <= 2} {incr i} {
+  if { [regexp {Intersection point 1 : ([-0-9.+eE]+) ([-0-9.+eE]+)} $log($i) full cx($i) cy($i)] } {
+    set aDist($i) [2ddistpp $aRefPx $aRefPy $cx($i) $cy($i)]
+    checkreal Distance $aDist($i) 0.0 1.e-6 0.0
+  } else {
+    puts "Error: wrong $i-th intersection result"
+  }
+}
diff --git a/tests/lowalgos/2dinter/bug29162 b/tests/lowalgos/2dinter/bug29162
new file mode 100644 (file)
index 0000000..f001945
--- /dev/null
@@ -0,0 +1,22 @@
+puts "========"
+puts "OCC29162"
+puts "========"
+puts ""
+##################################################
+# Geom2dInt_GInter algorithm does not find 
+# intersection of ellipse and line
+##################################################
+
+ellipse e -610.348096534595 -710.720096056787 0.999999902285153 0.000442074298181498 15.0066332711999 0.291884102212871
+trim e e 3.09462291909258 9.37780822627216
+
+line l -625.34430362036 -680.713463264921 -0.000252749178714602 -0.999999968058926
+trim l l 0 30.0132665523925
+
+set cx 0
+set cy 0
+
+regexp {Intersection point 1 : ([-0-9.+eE]+) ([-0-9.+eE]+)} [2dintersect e l ] full cx cy
+checkreal n1 $cx -625.35188801291508 1.e-7 1.e-7
+checkreal n2 $cy -710.72104765746838 1.e-7 1.e-7
+
diff --git a/tests/lowalgos/2dinter/bug4426_1 b/tests/lowalgos/2dinter/bug4426_1
new file mode 100644 (file)
index 0000000..0fc291e
--- /dev/null
@@ -0,0 +1,22 @@
+puts "================"
+puts "OCC4426"
+puts "================"
+puts ""
+#######################################################################################
+# Incorrect result of intersection in 2D between circle and line
+#######################################################################################
+
+v2d2
+circle c1 2 2 1
+2dfit
+2dzoom 120
+line l1 3 0 0 1
+2dintersect l1 c1
+erase l1 c1
+2dfit
+
+puts "ATTENTION! Check following:"
+puts "There is only one intersection point (green X)"
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
+
diff --git a/tests/lowalgos/2dinter/bug4426_2 b/tests/lowalgos/2dinter/bug4426_2
new file mode 100644 (file)
index 0000000..6e7e975
--- /dev/null
@@ -0,0 +1,22 @@
+puts "================"
+puts "OCC4426"
+puts "================"
+puts ""
+#######################################################################################
+# Incorrect result of intersection in 2D between circle and line
+#######################################################################################
+
+v2d2
+line ll1 0 0 0.3 0.7
+line ll2 0 0 0.37 0.63
+trim tll1 ll1 -0.00001 0.00001
+trim tll2 ll2 -0.00001 0.00001
+donly tll1 tll2
+2dintersect tll1 tll2
+2dfit
+
+puts "ATTENTION! Check following:"
+puts "There is the intersection point (green X) on center of grid axis"
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
+