1bb67d38 |
1 | puts "===============================================================" |
2 | puts "0030595: Oriented Bounding Box seems not optimal for some shapes" |
3 | puts "===============================================================" |
4 | puts "" |
5 | |
6 | # test is the copy of the test case bug29311_2 |
7 | # but computing the optimal OBB comparing to tight AABB |
8 | # with 1.e-6% precision |
9 | |
10 | set NbIters 101 |
11 | set step [expr 360.0/($NbIters-1) ] |
12 | |
13 | restore [locate_data_file bug29237_no_overlap.rhs.brep] a |
14 | |
15 | # Create AABB for a and put it into "r1" variable |
16 | # Draw[]> bounding a -shape r1 |
17 | # The volume of one AABB is |
18 | # Draw[]> vprops r1 1.0e-12 -full |
19 | # 32736000.184203226 |
20 | set Vexp 32736000.184203226 |
21 | |
22 | set VMax 0 |
23 | set MaxIteration 0 |
24 | |
25 | for {set i 1} { $i <= $NbIters} { incr i } { |
26 | bounding a -obb -shape rr$i -optimal |
27 | |
28 | regexp {Mass +: +([-0-9.+eE]+)} [vprops rr$i 1.0e-12 -full] full Vreal |
29 | |
30 | if { $Vreal > $VMax } { |
31 | set VMax $Vreal |
32 | set MaxIteration $i |
33 | copy a amax |
34 | } |
35 | |
36 | if { $i != $NbIters } { trotate a 283 162 317 2 7 9 $step } |
37 | } |
38 | |
39 | set aDeltaMax [ expr 100.0*abs($VMax/$Vexp - 1.0) ] |
40 | |
41 | puts "Delta of computation not greater than $aDeltaMax %. Maximal delta is achieved in $MaxIteration iteration. See \"amax\" shape." |
42 | |
43 | if { $aDeltaMax > 1.e-6 } { |
44 | puts "Error: The obtained OBB(s) is not precise." |
45 | } |
46 | |
47 | smallview |
48 | donly amax rr${MaxIteration} |
49 | fit |
50 | checkview -screenshot -2d -path ${imagedir}/${test_image}.png |