0024863: CLang warnings -Wint-to-void-pointer-cast
[occt.git] / tests / bugs / moddata_2 / bug23165
1 puts "================"
2 puts "OCC23165"
3 puts "================"
4 puts ""
5 ###################################################################################################################
6 # BndLib_Add3dCurve::Add incorrectly segmented original B-Spline what resulting in wrong bounding box or exception.
7 ###################################################################################################################
8
9 catch { pload XDE }
10
11 set BugNumber OCC23165
12
13 smallview 
14
15 # 1 step
16 set exception_status 0
17 set e1_status 0
18 set status 0
19
20 set percent_max 0.1
21
22 proc GetPercent {Value GoodValue} {
23     set Percent 0.
24     if {${GoodValue} != 0.} {
25         set Percent [expr abs(${Value} - ${GoodValue}) / abs(double(${GoodValue})) * 100.]
26     } elseif {${Value} != 0.} {
27         set Percent [expr abs(${GoodValue} - ${Value}) / abs(double(${Value})) * 100.]
28     } else {
29         set Percent 0.
30     }
31     return ${Percent}
32 }
33
34 restore [locate_data_file OCC23165-edge1.brep] e1 
35
36 donly e1
37 catch { bounding e1 } msg
38 fit
39
40 set index [lsearch $msg exception]
41 if {$index > -1} {
42   set exception_status 1
43 } else {
44   set e1_result [bounding e1]
45
46   set e1_x1 [lindex ${e1_result} 0]
47   set e1_y1 [lindex ${e1_result} 1]
48   set e1_z1 [lindex ${e1_result} 2]
49   set e1_x2 [lindex ${e1_result} 3]
50   set e1_y2 [lindex ${e1_result} 4]
51   set e1_z2 [lindex ${e1_result} 5]
52
53   set e1_good_x1 -17.610622244944413
54   set e1_good_y1 -0.010622244944394899
55   set e1_good_z1 -3.0106222449443973
56   set e1_good_x2 -17.589377755055537
57   set e1_good_y2 5.7106222251726582
58   set e1_good_z2 -1.6146050638816589
59
60   set e1_x1_percent [GetPercent ${e1_x1} ${e1_good_x1}]
61   set e1_y1_percent [GetPercent ${e1_y1} ${e1_good_y1}]
62   set e1_z1_percent [GetPercent ${e1_z1} ${e1_good_z1}]
63   set e1_x2_percent [GetPercent ${e1_x2} ${e1_good_x2}]
64   set e1_y2_percent [GetPercent ${e1_y2} ${e1_good_y2}]
65   set e1_z2_percent [GetPercent ${e1_z2} ${e1_good_z2}]
66
67   if {${e1_x1_percent} > ${percent_max}} {
68         puts "Faulty ${BugNumber} : x1 for e1 is wrong"
69         set e1_status 1
70   }
71   if {${e1_y1_percent} > ${percent_max}} {
72         puts "Faulty ${BugNumber} : y1 for e1 is wrong"
73         set e1_status 1
74   }
75   if {${e1_z1_percent} > ${percent_max}} {
76         puts "Faulty ${BugNumber} : z1 for e1 is wrong"
77         set e1_status 1
78   }
79   if {${e1_x2_percent} > ${percent_max}} {
80         puts "Faulty ${BugNumber} : x2 for e1 is wrong"
81         set e1_status 1
82   }
83   if {${e1_y2_percent} > ${percent_max}} {
84         puts "Faulty ${BugNumber} : y2 for e1 is wrong"
85         set e1_status 1
86   }
87   if {${e1_z2_percent} > ${percent_max}} {
88         puts "Faulty ${BugNumber} : z2 for e1 is wrong"
89         set e1_status 1
90   }
91
92 }
93
94 # 2 step
95 restore [locate_data_file OCC23165-curve.rle] c 
96 mkedge result c 20 36
97
98 donly result
99 set res [bounding result]
100 fit
101
102 set x1 [lindex ${res} 0]
103 set y1 [lindex ${res} 1]
104 set z1 [lindex ${res} 2]
105 set x2 [lindex ${res} 3]
106 set y2 [lindex ${res} 4]
107 set z2 [lindex ${res} 5]
108
109 set good_x1 -17.6105835090592
110 set good_y1 -4.7133570660117909
111 set good_z1 -4.3679100133425806
112 set good_x2 -17.589416490940806
113 set good_y2 5.7105834892874094
114 set good_z2 -1.6146437997669054
115
116 set x1_percent [GetPercent ${x1} ${good_x1}]
117 set y1_percent [GetPercent ${y1} ${good_y1}]
118 set z1_percent [GetPercent ${z1} ${good_z1}]
119 set x2_percent [GetPercent ${x2} ${good_x2}]
120 set y2_percent [GetPercent ${y2} ${good_y2}]
121 set z2_percent [GetPercent ${z2} ${good_z2}]
122
123 if {${x1_percent} > ${percent_max}} {
124    puts "Faulty ${BugNumber} : x1 is wrong"
125    set status 1
126 }
127 if {${y1_percent} > ${percent_max}} {
128    puts "Faulty ${BugNumber} : y1 is wrong"
129    set status 1
130 }
131 if {${z1_percent} > ${percent_max}} {
132    puts "Faulty ${BugNumber} : z1 is wrong"
133    set status 1
134 }
135 if {${x2_percent} > ${percent_max}} {
136    puts "Faulty ${BugNumber} : x2 is wrong"
137    set status 1
138 }
139 if {${y2_percent} > ${percent_max}} {
140    puts "Faulty ${BugNumber} : y2 is wrong"
141    set status 1
142 }
143 if {${z2_percent} > ${percent_max}} {
144    puts "Faulty ${BugNumber} : z2 is wrong"
145    set status 1
146 }
147
148 if { ${status} == 0 && ${exception_status} == 0&& ${e1_status} == 0 } {
149    puts "${BugNumber}: OK"
150 } else {
151    puts "${BugNumber}: Faulty"
152 }
153
154 set 2dviewer 1
155 set length 15.8888
156