0024105: ShapeFix algorithm produces not correct result.
[occt.git] / tests / bugs / moddata_2 / bug22809_3
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
9set BugNumber OCC22809
10
11#
12proc GetPercent {Value GoodValue} {
13 set Percent 0.
14 if {${GoodValue} != 0.} {
15 set Percent [expr abs(${Value} - ${GoodValue}) / abs(double(${GoodValue})) * 100.]
16 } elseif {${Value} != 0.} {
17 set Percent [expr abs(${GoodValue} - ${Value}) / abs(double(${Value})) * 100.]
18 } else {
19 set Percent 0.
20 }
21 return ${Percent}
22}
23
24set percent_max 0.1
25#
26
27psphere a 100
28nurbsconvert r1 a
29line l -0.000001 0.0000000001 -100 0 0 1
30BRepIntCS l r1
31
32regexp {.* is a ([A-Za-z0-9]*)} [ whatis brics_1] full info1
33
34# N.B. multiple result points are to be processed by other algorithms
35# Now there are 3 result points
36regexp {.* is a ([A-Za-z0-9]*)} [ whatis brics_2 ] full info2
37
38set word1 [string compare $info1 "point"]
39set word2 [string compare $info2 "point"]
40
41set status_point 0
42if { ${word1} == 0 && ${word2} == 0 } {
43 set status_point 0
44} else {
45 set status_point 1
46}
47
48regexp {.* is a ([A-Za-z0-9]*)} [ whatis brics_3 ] full info3
49set word3 [string compare $info3 "a"]
50
51set status_nb 0
52if { ${word3} == 0 } {
53 set status_nb 0
54} else {
55 set status_nb 1
56 # N.B. multiple result points are to be processed by other algorithms
57 set status_nb 0
58}
59
60set dump1 [ dump brics_1 ]
61
62regexp {Point : ([-0-9.+eE]+), ([-0-9.+eE]+), ([-0-9.+eE]+)} $dump1 full x1 y1 z1
63
64set good_x1 -1.000000000000000e-06
65set good_y1 1.000000000000000e-10
66set good_z1 -1.000000000000000e+02
67
68set status_xyz1 0
69set x1_percent [GetPercent ${x1} ${good_x1}]
70puts "x1_percent = ${x1_percent}"
71if { ${x1_percent} > ${percent_max} } {
72 puts "x1: Faulty ${BugNumber}"
73 set status_xyz1 1
74} else {
75 puts "x1: OK ${BugNumber}"
76}
77
78set y1_percent [GetPercent ${y1} ${good_y1}]
79puts "y1_percent = ${y1_percent}"
80if { ${y1_percent} > ${percent_max} } {
81 puts "y1: Faulty ${BugNumber}"
82 set status_xyz1 1
83} else {
84 puts "y1: OK ${BugNumber}"
85}
86
87set z1_percent [GetPercent ${z1} ${good_z1}]
88puts "z1_percent = ${z1_percent}"
89if { ${z1_percent} > ${percent_max} } {
90 puts "z1: Faulty ${BugNumber}"
91 set status_xyz1 1
92} else {
93 puts "z1: OK ${BugNumber}"
94}
95
96set dump2 [ dump brics_2 ]
97# N.B. multiple result points are to be processed by other algorithms
98set dump2 [ dump brics_2 ]
99
100regexp {Point : ([-0-9.+eE]+), ([-0-9.+eE]+), ([-0-9.+eE]+)} $dump2 full x2 y2 z2
101
102set good_x2 -1.000000000000000e-06
103set good_y2 1.000000000000000e-10
104set good_z2 1.000000000000000e+02
105
106set status_xyz2 0
107set x2_percent [GetPercent ${x2} ${good_x2}]
108puts "x2_percent = ${x2_percent}"
109if { ${x2_percent} > ${percent_max} } {
110 puts "x2: Faulty ${BugNumber}"
111 set status_xyz2 1
112} else {
113 puts "x2: OK ${BugNumber}"
114}
115
116set y2_percent [GetPercent ${y2} ${good_y2}]
117puts "y2_percent = ${y2_percent}"
118if { ${y2_percent} > ${percent_max} } {
119 puts "y2: Faulty ${BugNumber}"
120 set status_xyz2 1
121} else {
122 puts "y2: OK ${BugNumber}"
123}
124
125set z2_percent [GetPercent ${z2} ${good_z2}]
126puts "z2_percent = ${z2_percent}"
127if { ${z2_percent} > ${percent_max} } {
128 puts "z2: Faulty ${BugNumber}"
129 set status_xyz2 1
130} else {
131 puts "z2: OK ${BugNumber}"
132}
133
134# Resume
135puts ""
136if { ${status_point} == 0 && ${status_nb} == 0 && ${status_xyz1} == 0 && ${status_xyz2} == 0 } {
137 puts "OK ${BugNumber}"
138} else {
139 puts "Faulty ${BugNumber}"
140}
141