0029311: Implementation of the Oriented Bounding Boxes (OBB) functionality
[occt.git] / tests / bugs / modalg_7 / bug29311_16
1 puts "========"
2 puts "OCC29311"
3 puts "========"
4 puts ""
5 #################################################
6 # Implementation of the Oriented Bounding Boxes (OBB) functionality
7 #################################################
8
9
10 set NbIters 31
11 set step [expr 360.0/($NbIters-1) ]
12
13 restore [locate_data_file OCC26443-shell_2.brep] a
14
15 # Check PCA-algorithm
16 tclean a
17
18 set VMax -1.0e200
19 set VMin 1.0e200
20
21 set MaxIteration 0
22 set MinIteration 0
23
24 for {set i 1} { $i <= $NbIters} { incr i } {
25   bounding -s a -obb -shape rr$i
26   
27   regexp {Mass +: +([-0-9.+eE]+)} [vprops rr$i 1.0e-12 -full] full Vreal
28   
29   if { $Vreal > $VMax } {
30     set VMax $Vreal
31     set MaxIteration $i
32     copy a amax
33   }
34   
35   if { $Vreal < $VMin } {
36     set VMin $Vreal
37     set MinIteration $i
38     copy a amin
39   }  
40   
41   if { $i != $NbIters } { trotate a 283 162 317 2 7 9 $step }
42 }
43
44 checkreal {Transformed BndBoxes} $VMax $VMin 0.0 0.001
45
46 puts "The box with maximal volume is achieved in $MaxIteration iteration. See \"amax\" shape."
47 puts "The box with minimal volume is achieved in $MinIteration iteration. See \"amin\" shape."
48
49 bounding -s amax -obb -dump
50 bounding -s amin -obb -dump
51