0026855: Draw commands to debug Boolean Operations Algorithm
[occt.git] / tests / bugs / moddata_2 / bug22809_2
CommitLineData
3bea4c16 1puts "============"
2puts "OCC22809"
3puts "============"
4puts ""
5############################################################################################################
6# BRepIntCS does not find intersections of an ellipsoid and a line passing through it's apex
7###########################################################################################################
8#
9# Test was corrected. See:
10#
11# http://tracker.dev.opencascade.org/view.php?id=23248
12# pkv (developer)
13# 2012-07-12 09:33
14# The checking can not provide stable result because there is no guarantee that coordinates
15# for brics_1 will always be {x1, y1, z1} but not {x2, y2, z2} and
16# for brics_42 will always be {x2, y2, z2} but not {x1, y1, z1}.
17# The coordinates of brics_1 can be both {x1, y1, z1} and {x2, y2, z2}
18# The coordinates of brics_42 can be both {x1, y1, z1} and {x2, y2, z2}
19#
20###########################################################################################################
21
22set BugNumber OCC22809
23
24#
25proc GetPercent {Value GoodValue} {
26 set Percent 0.
27 if {${GoodValue} != 0.} {
28 set Percent [expr abs(${Value} - ${GoodValue}) / abs(double(${GoodValue})) * 100.]
29 } elseif {${Value} != 0.} {
30 set Percent [expr abs(${GoodValue} - ${Value}) / abs(double(${Value})) * 100.]
31 } else {
32 set Percent 0.
33 }
34 return ${Percent}
35}
36set percent_max 0.1
37#
38
39psphere a 100
40scalexyz r2 a 2 1 1
41line l 0 0 -100 0 0 1
42BRepIntCS l r2
43
44regexp {.* is a ([A-Za-z0-9]*)} [ whatis brics_1 ] full info1
45
46# N.B. multiple result points are to be processed by other algorithms
47# Now there are 130 result points
48regexp {.* is a ([A-Za-z0-9]*)} [ whatis brics_23 ] full info2
49
50set word1 [string compare $info1 "point"]
51set word2 [string compare $info2 "point"]
52
53set status_point 0
54if { ${word1} == 0 && ${word2} == 0 } {
55 set status_point 0
56} else {
57 set status_point 1
58}
59
60regexp {.* is a ([A-Za-z0-9]*)} [ whatis brics_3 ] full info3
61set word3 [string compare $info3 "a"]
62
63set status_nb 0
64if { ${word3} == 0 } {
65 set status_nb 0
66} else {
67 set status_nb 1
68 # N.B. multiple result points are to be processed by other algorithms
69 set status_nb 0
70}
71
72set good_x1 0.000000000000000e+00
73set good_y1 0.000000000000000e+00
74set good_z1 -1.000000000000000e+02
75
76set good_x2 0.000000000000000e+00
77set good_y2 0.000000000000000e+00
78set good_z2 1.000000000000000e+02
79
80set dump1 [ dump brics_1 ]
81
82regexp {Point : ([-0-9.+eE]+), ([-0-9.+eE]+), ([-0-9.+eE]+)} $dump1 full x1 y1 z1
83
84set status_xyz1 0
85set x1_percent [GetPercent ${x1} ${good_x1}]
86puts "x1_percent = ${x1_percent}"
87if { ${x1_percent} > ${percent_max} } {
88 puts "x1: Faulty ${BugNumber}"
89 set status_xyz1 1
90} else {
91 puts "x1: OK ${BugNumber}"
92}
93
94set y1_percent [GetPercent ${y1} ${good_y1}]
95puts "y1_percent = ${y1_percent}"
96if { ${y1_percent} > ${percent_max} } {
97 puts "y1: Faulty ${BugNumber}"
98 set status_xyz1 1
99} else {
100 puts "y1: OK ${BugNumber}"
101}
102
103set z1_percent [GetPercent ${z1} ${good_z1}]
104puts "z1_percent = ${z1_percent}"
105if { ${z1_percent} > ${percent_max} } {
106 set z1_percent [GetPercent ${z1} ${good_z2}]
107 puts "z1_percent = ${z1_percent}"
108 if { ${z1_percent} > ${percent_max} } {
109 puts "z1: Faulty ${BugNumber}"
110 set status_xyz1 1
111 } else {
112 puts "z1: OK ${BugNumber}"
113 }
114} else {
115 puts "z1: OK ${BugNumber}"
116}
117
118set dump2 [ dump brics_2 ]
119# N.B. multiple result points are to be processed by other algorithms
120set dump2 [ dump brics_23 ]
121regexp {Point : ([-0-9.+eE]+), ([-0-9.+eE]+), ([-0-9.+eE]+)} $dump2 full x2 y2 z2
122
123set status_xyz2 0
124set x2_percent [GetPercent ${x2} ${good_x2}]
125puts "x2_percent = ${x2_percent}"
126if { ${x2_percent} > ${percent_max} } {
127 puts "x2: Faulty ${BugNumber}"
128 set status_xyz2 1
129} else {
130 puts "x2: OK ${BugNumber}"
131}
132
133set y2_percent [GetPercent ${y2} ${good_y2}]
134puts "y2_percent = ${y2_percent}"
135if { ${y2_percent} > ${percent_max} } {
136 puts "y2: Faulty ${BugNumber}"
137 set status_xyz2 1
138} else {
139 puts "y2: OK ${BugNumber}"
140}
141
142set z2_percent [GetPercent ${z2} ${good_z2}]
143puts "z2_percent = ${z2_percent}"
144if { ${z2_percent} > ${percent_max} } {
145 set z2_percent [GetPercent ${z2} ${good_z1}]
146 puts "z2_percent = ${z2_percent}"
147 if { ${z2_percent} > ${percent_max} } {
148 puts "z2: Faulty ${BugNumber}"
149 set status_xyz2 1
150 } else {
151 puts "z2: OK ${BugNumber}"
152 }
153} else {
154 puts "z2: OK ${BugNumber}"
155}
156
157# Resume
158puts ""
159if { ${status_point} == 0 && ${status_nb} == 0 && ${status_xyz1} == 0 && ${status_xyz2} == 0 } {
160 puts "OK ${BugNumber}"
161} else {
162 puts "Faulty ${BugNumber}"
163}
164