0025982: Wrong result obtained by General Fuse operator.
[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   dlog reset
81   dlog on
82   xdistcs res s1 ${U1} ${U2} 10
83   set Log1 [dlog get]
84   set List1 [split ${Log1} {TD= \t\n}]
85   set Tolerance 1.0e-7
86   set Limit_Tol 1.0e-7
87   set D_good 0.
88   checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
89   
90   dlog reset
91   dlog on
92   xdistcs res s2 ${U1} ${U2} 10
93   set Log1 [dlog get]
94   set List1 [split ${Log1} {TD= \t\n}]
95   set Tolerance 1.0e-7
96   set Limit_Tol 1.0e-7
97   set D_good 0.
98   checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
99 } else {
100   set ic 1
101   set AllowRepeate 1
102   while { $AllowRepeate != 0 } {
103     set che [whatis res_$ic]
104     set ind [string first "3d curve" $che]
105     if {${ind} < 0} {
106       set AllowRepeate 0
107     } else {
108       set U1 0.0
109       set U2 0.0
110       
111       GetRange res_$ic
112       
113       puts "U1 = ${U1}"
114       puts "U2 = ${U2}"
115       
116       if {[expr {$U2 - $U1}] < 1.0e-20} {
117         puts "Error: Wrong curve's range!"
118       }
119       
120       dlog reset
121       dlog on
122       xdistcs res_$ic s1 ${U1} ${U2} 10
123       set Log1 [dlog get]
124       set List1 [split ${Log1} {TD= \t\n}]
125       set Tolerance 1.0e-7
126       set Limit_Tol 1.0e-7
127       set D_good 0.
128       checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
129       
130       dlog reset
131       dlog on
132       xdistcs res_$ic s2 0 1 10
133       set Log1 [dlog get]
134       set List1 [split ${Log1} {TD= \t\n}]
135       set Tolerance 1.0e-7
136       set Limit_Tol 1.0e-7
137       set D_good 0.
138       checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
139       
140       incr ic
141     }
142   }
143   
144   if {[expr {$ic - 1}] == $GoodNbCurv} {
145     puts "OK: Curve Number is good!"
146   } else {
147     puts "Error: Curve Number is bad!"
148   }
149 }