52e3f20d69e7f1e536a727d14735ed0417dfe4dc
[occt.git] / tests / bugs / modalg_5 / bug25292_36
1 puts "================"
2 puts "OCC25292"
3 puts "================"
4 puts ""
5 #######################################################################
6 # Face/Face intersection algorithm gives different results for different order of the arguments
7 #######################################################################
8
9 proc GetRange { curve } {
10   global U1
11   global U2
12   
13   set log [uplevel dump $curve]
14   
15   regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
16   puts "Degree=${Degree}"
17   puts "Poles=${Poles}"
18   puts "KnotsPoles=${KnotsPoles}"
19   puts ""
20
21   set Knot 1
22   set exp_string "Knots :\n\n +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
23   regexp ${exp_string} ${log} full U1 Mult1
24
25   set Knot ${KnotsPoles}
26   set exp_string " +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
27   regexp ${exp_string} ${log} full U2 Mult2
28 }
29
30 puts "##############################"
31 puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
32 puts "##############################"
33 puts ""
34 puts ""
35
36 # intersect command for trimmed surfaces
37
38 #This value must be equal to the analogical value in bug25292_35 and bug25292_36 of "bugs modalg_5" testgrid. 
39 set GoodNbCurv 2
40
41 restore [locate_data_file bug25292_f1.brep] f1
42 restore [locate_data_file bug25292_f2.brep] f2
43
44 mksurface s1 f1
45 mksurface s2 f2
46
47 # trim s1 in accordance with the UV-bounds of f1:
48 trimv s1t s1 19.1600000005 19.6600000005
49
50 # trim s2 in accordance with the UV-bounds of f2:
51 trim s2t s2 0. 1.570796326795 -275 275
52
53 ###################
54 intersect res s2t s1t
55 ###################
56
57 set che [whatis res]
58 set ind [string first "3d curve" $che]
59 if {${ind} >= 0} {
60   #Only variable "res" exists
61   
62   if { $GoodNbCurv == 1 } {
63     puts "OK: Curve Number is good!"
64   } else {
65     puts "Error: Curve Number is bad!"
66   }
67   
68   set U1 0.0
69   set U2 0.0
70   
71   GetRange res
72
73   puts "U1 = ${U1}"
74   puts "U2 = ${U2}"
75
76   if {[expr {$U2 - $U1}] < 1.0e-20} {
77     puts "Error: Wrong curve's range!"
78   }
79   
80   xdistcs res s1 ${U1} ${U2} 10 1e-7
81   xdistcs res s2 ${U1} ${U2} 10 1e-7
82 } else {
83   set ic 1
84   set AllowRepeate 1
85   while { $AllowRepeate != 0 } {
86     set che [whatis res_$ic]
87     set ind [string first "3d curve" $che]
88     if {${ind} < 0} {
89       set AllowRepeate 0
90     } else {
91       set U1 0.0
92       set U2 0.0
93       
94       GetRange res_$ic
95       
96       puts "U1 = ${U1}"
97       puts "U2 = ${U2}"
98       
99       if {[expr {$U2 - $U1}] < 1.0e-20} {
100         puts "Error: Wrong curve's range!"
101       }
102       
103       xdistcs res_$ic s1 ${U1} ${U2} 10 1e-7
104       xdistcs res_$ic s2 0 1 10 1e-7
105       
106       incr ic
107     }
108   }
109   
110   if {[expr {$ic - 1}] == $GoodNbCurv} {
111     puts "OK: Curve Number is good!"
112   } else {
113     puts "Error: Curve Number is bad!"
114   }
115 }