0027976: Unstable work of 2d intersection algorithm for two lines
[occt.git] / tests / lowalgos / 2dinter / bug25593
CommitLineData
1d19db8d 1puts "============"
2puts "OCC25593"
3puts "============"
4puts ""
5#########################################################################
6# Number of intersection points for 2d curves depends on the order of arguments in command "2dintersect"
7#########################################################################
8
9restore [locate_data_file bug25593_face1.brep] b
10pcurve b
11
12puts "Intersection 1"
4bc805bf 13set info1 [2dintersect b_2 b_3 -tol 1.e-10]
1d19db8d 14regexp {Intersection point 1 : +([-0-9.+eE]+) +([-0-9.+eE]+)} $info1 full p1x p1y
15regexp {parameter on the fist: +([-0-9.+eE]+) +parameter on the second: +([-0-9.+eE]+)} $info1 full par1f par1s
16
17puts "Intersection 2"
4bc805bf 18set info2 [2dintersect b_3 b_2 -tol 1.e-10]
1d19db8d 19regexp {Intersection point 1 : +([-0-9.+eE]+) +([-0-9.+eE]+)} $info2 full p2x p2y
20regexp {parameter on the fist: +([-0-9.+eE]+) +parameter on the second: +([-0-9.+eE]+)} $info2 full par2f par2s
21
22set NbIP1 1
23if { [regexp "Intersection point 1" $info1] != 1 } {
24 puts "Error : Intersection 1 should have one point"
25 set NbIP1 0
26}
27if { [regexp "Intersection point 2" $info1] == 1 } {
28 puts "Error : Intersection 1 should have one point"
29 set NbIP1 2
30}
31puts "NbIP1=$NbIP1"
32
33set NbIP2 1
34if { [regexp "Intersection point 1" $info2] != 1 } {
35 puts "Error : Intersection 2 should have one point"
36 set NbIP2 0
37}
38if { [regexp "Intersection point 2" $info2] == 1 } {
39 puts "Error : Intersection 2 should have one point"
40 set NbIP2 2
41}
42puts "NbIP2=$NbIP2"
43
44if { $NbIP1 != 1 || $NbIP2 != 1 } {
45 puts "ERROR: Wrong solutions number"
46} else {
47 puts "p1x=$p1x p1y=$p1y par1f=$par1f $par1s"
48 puts "p2x=$p2x p2y=$p2y par2f=$par2f $par2s"
49 set sqd [expr ($p1x-$p2x)*($p1x-$p2x)+($p1y-$p2y)*($p1y-$p2y)]
50 if { $sqd > 1.0e-14 } {
51 puts "ERROR: Intersection points are different"
52 } else {
53 puts "OK: Intersection points are equal"
54 }
55 if { (abs($par1f - $par2s) > 1.0e-9) || (abs($par1s - $par2f) > 1.0e-9) } {
56 puts "ERROR: Parameters on intersecting curves are not coincided"
57 } else {
58 puts "OK: Parameters on intersecting curves are coincided"
59 }
60}