0025593: Number of intersection points for 2d curves depends on the order of argument...
[occt.git] / tests / bugs / modalg_6 / bug25593
1 puts "============"
2 puts "OCC25593"
3 puts "============"
4 puts ""
5 #########################################################################
6 # Number of intersection points for 2d curves depends on the order of arguments in command "2dintersect"
7 #########################################################################
8
9 restore [locate_data_file bug25593_face1.brep] b
10 pcurve b
11
12 puts "Intersection 1"
13 set info1 [2dintersect b_2 b_3 1.e-10]
14 regexp {Intersection point 1 : +([-0-9.+eE]+) +([-0-9.+eE]+)} $info1 full p1x p1y
15 regexp {parameter on the fist: +([-0-9.+eE]+) +parameter on the second: +([-0-9.+eE]+)} $info1 full par1f par1s
16
17 puts "Intersection 2"
18 set info2 [2dintersect b_3 b_2 1.e-10]
19 regexp {Intersection point 1 : +([-0-9.+eE]+) +([-0-9.+eE]+)} $info2 full p2x p2y
20 regexp {parameter on the fist: +([-0-9.+eE]+) +parameter on the second: +([-0-9.+eE]+)} $info2 full par2f par2s
21
22 set NbIP1 1
23 if { [regexp "Intersection point 1" $info1] != 1  } {
24    puts "Error : Intersection 1 should have one point"
25    set NbIP1 0
26 }
27 if { [regexp "Intersection point 2" $info1] == 1  } {
28    puts "Error : Intersection 1 should have one point"
29    set NbIP1 2
30 }
31 puts "NbIP1=$NbIP1"
32
33 set NbIP2 1
34 if { [regexp "Intersection point 1" $info2] != 1  } {
35    puts "Error : Intersection 2 should have one point"
36    set NbIP2 0
37 }
38 if { [regexp "Intersection point 2" $info2] == 1  } {
39    puts "Error : Intersection 2 should have one point"
40    set NbIP2 2
41 }
42 puts "NbIP2=$NbIP2"
43
44 if { $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 }