3bea4c16 |
1 | puts "============" |
2 | puts "OCC22809" |
3 | puts "============" |
4 | puts "" |
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 | |
22 | set BugNumber OCC22809 |
23 | |
24 | # |
25 | proc 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 | } |
36 | set percent_max 0.1 |
37 | # |
38 | |
39 | psphere a 100 |
40 | scalexyz r2 a 2 1 1 |
41 | line l 0 0 -100 0 0 1 |
42 | BRepIntCS l r2 |
43 | |
44 | regexp {.* 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 |
48 | regexp {.* is a ([A-Za-z0-9]*)} [ whatis brics_23 ] full info2 |
49 | |
50 | set word1 [string compare $info1 "point"] |
51 | set word2 [string compare $info2 "point"] |
52 | |
53 | set status_point 0 |
54 | if { ${word1} == 0 && ${word2} == 0 } { |
55 | set status_point 0 |
56 | } else { |
57 | set status_point 1 |
58 | } |
59 | |
60 | regexp {.* is a ([A-Za-z0-9]*)} [ whatis brics_3 ] full info3 |
61 | set word3 [string compare $info3 "a"] |
62 | |
63 | set status_nb 0 |
64 | if { ${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 | |
72 | set good_x1 0.000000000000000e+00 |
73 | set good_y1 0.000000000000000e+00 |
74 | set good_z1 -1.000000000000000e+02 |
75 | |
76 | set good_x2 0.000000000000000e+00 |
77 | set good_y2 0.000000000000000e+00 |
78 | set good_z2 1.000000000000000e+02 |
79 | |
80 | set dump1 [ dump brics_1 ] |
81 | |
82 | regexp {Point : ([-0-9.+eE]+), ([-0-9.+eE]+), ([-0-9.+eE]+)} $dump1 full x1 y1 z1 |
83 | |
84 | set status_xyz1 0 |
85 | set x1_percent [GetPercent ${x1} ${good_x1}] |
86 | puts "x1_percent = ${x1_percent}" |
87 | if { ${x1_percent} > ${percent_max} } { |
88 | puts "x1: Faulty ${BugNumber}" |
89 | set status_xyz1 1 |
90 | } else { |
91 | puts "x1: OK ${BugNumber}" |
92 | } |
93 | |
94 | set y1_percent [GetPercent ${y1} ${good_y1}] |
95 | puts "y1_percent = ${y1_percent}" |
96 | if { ${y1_percent} > ${percent_max} } { |
97 | puts "y1: Faulty ${BugNumber}" |
98 | set status_xyz1 1 |
99 | } else { |
100 | puts "y1: OK ${BugNumber}" |
101 | } |
102 | |
103 | set z1_percent [GetPercent ${z1} ${good_z1}] |
104 | puts "z1_percent = ${z1_percent}" |
105 | if { ${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 | |
118 | set dump2 [ dump brics_2 ] |
119 | # N.B. multiple result points are to be processed by other algorithms |
120 | set dump2 [ dump brics_23 ] |
121 | regexp {Point : ([-0-9.+eE]+), ([-0-9.+eE]+), ([-0-9.+eE]+)} $dump2 full x2 y2 z2 |
122 | |
123 | set status_xyz2 0 |
124 | set x2_percent [GetPercent ${x2} ${good_x2}] |
125 | puts "x2_percent = ${x2_percent}" |
126 | if { ${x2_percent} > ${percent_max} } { |
127 | puts "x2: Faulty ${BugNumber}" |
128 | set status_xyz2 1 |
129 | } else { |
130 | puts "x2: OK ${BugNumber}" |
131 | } |
132 | |
133 | set y2_percent [GetPercent ${y2} ${good_y2}] |
134 | puts "y2_percent = ${y2_percent}" |
135 | if { ${y2_percent} > ${percent_max} } { |
136 | puts "y2: Faulty ${BugNumber}" |
137 | set status_xyz2 1 |
138 | } else { |
139 | puts "y2: OK ${BugNumber}" |
140 | } |
141 | |
142 | set z2_percent [GetPercent ${z2} ${good_z2}] |
143 | puts "z2_percent = ${z2_percent}" |
144 | if { ${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 |
158 | puts "" |
159 | if { ${status_point} == 0 && ${status_nb} == 0 && ${status_xyz1} == 0 && ${status_xyz2} == 0 } { |
160 | puts "OK ${BugNumber}" |
161 | } else { |
162 | puts "Faulty ${BugNumber}" |
163 | } |
164 | |