0027986: Visualization - AIS_InteractiveContext::SetLocation() does not update dynami...
[occt.git] / tests / bugs / vis / bug24623_1
CommitLineData
f751596e 1puts "============"
2puts "OCC24623_1"
3puts "============"
4puts ""
5#######################################################################
6puts "Visualization - improve selection mechanism"
7# tests performance of selection algorithm. Creates a grid of spheres with
8# size DISCRETISATION * DISCRETISATION. To get representative performance
9# test results, increase the size of grid in DISCRETISATION and check time
10# measurments in comparsion to previous OCCT versions. You may also check
11# the time of selection when all BVH trees are built via uncommenting
12# the code in "Start building all trees" section.
13#######################################################################
14
15set DISCRETISATION 10
16set RADIUS 100
17
18pload ALL
19
20set aStep [expr $RADIUS * 0.1]
21
22# unset aNames
23list aNames
24set aX 0
25set aY 0
26for {set i 0} {$i < $DISCRETISATION} {incr i} {
27 for {set j 0} {$j < $DISCRETISATION} {incr j} {
28 set aCurrName "sph"
29 append aCurrName [expr $i * $DISCRETISATION + $j]
30 lappend aNames $aCurrName
31 psphere $aCurrName $RADIUS
32 set aX [expr $i * ($aStep + $RADIUS)]
33 set aY [expr - $j * ($aStep + $RADIUS)]
34 ttranslate $aCurrName $aX $aY 0
35 }
36}
37
38set aSpheresNbInfo "Total spheres number:"
39append aSpheresNbInfo [expr $DISCRETISATION * $DISCRETISATION]
40puts $aSpheresNbInfo
41
42vinit
43set aMemInit [meminfo h]
44puts "Initial mem: [expr $aMemInit / (1024 * 1024)] MiB ([expr $aMemInit])"
45vsetdispmode 1
46set aMemInit [meminfo h]
47vdisplay {*}$aNames
48vfit
49
50puts "Selection of spheres without BVH trees built:"
51chrono aTimer reset
52chrono aTimer start
53vmoveto 224 269
54chrono aTimer stop
55chrono aTimer show
56
57puts ""
58puts "Applying the transformations..."
59vtranslateview 1 0 0
60vrotate 100 100 100
61
62puts ""
63puts "Selection time with transformations applied without BVH built:"
64chrono aTimer reset
65chrono aTimer start
66vmoveto 102 224
67chrono aTimer stop
68chrono aTimer show
69
70# puts ""
71# puts "Start building all trees..."
72# vtop
73# vfit
74# set aStartPt [expr round(400 / double($DISCRETISATION)) + 5]
75# set aPtStep [expr round(double(round(100*(400 / double($DISCRETISATION))))/100 * 2)]
76# for {set i 0} {$i < $DISCRETISATION / 2} {incr i} {
77# for {set j 0} {$j < $DISCRETISATION / 2} {incr j} {
78# set aX [expr $aStartPt + $i * $aPtStep]
79# set aY [expr $aStartPt + $j * $aPtStep]
80# vmoveto $aX $aY 1
81# }
82# }
83
84# puts ""
85# puts "Selection time with all BVHs built:"
86# chrono aTimer reset
87# chrono aTimer start
88# vmoveto 200 200
89# chrono aTimer stop
90# chrono aTimer show
91
92set aMemSel [meminfo h]
93puts "Selection mem: [expr $aMemSel / (1024 * 1024)] MiB ([expr $aMemSel])"
94
95checkcolor 115 221 0 1 1