puts "============"
puts "OCC24623_2"
puts "============"
puts ""
#######################################################################
puts "Visualization - improve selection mechanism"
# tests performance of selection algorithm. Creates a spiral via polyline
# and checks its selection in neutral point. For representative result,
# increase the number of points in POINTS_NUM and check time measurements
# in comparison to previous OCCT versions.
#######################################################################

set POINTS_NUM 1000
set STEP 0.3

pload ALL

set aCoef 0.2
set aZ 0
# unset aPointCoords
list aPointCoords
for {set i 0} {$i < $POINTS_NUM} {incr i} {
  set aX [expr $aCoef * $aZ * cos($aZ)]
  set aY [expr $aCoef * $aZ * sin($aZ)]
  set aZ [expr $aZ + $STEP]
  lappend aPointCoords $aX
  lappend aPointCoords $aY
  lappend aPointCoords $aZ
}

vinit
set aMemInit [meminfo h]
puts "Initial mem: [expr $aMemInit   / (1024 * 1024)] MiB ([expr $aMemInit])"
polyline p {*}$aPointCoords
vdisplay p

vfit

vmoveto 223 236
vmoveto 0 0
vmoveto 223 236

puts ""
puts "Applying transformations..."
vtranslateview 1 0 0
vrotate 100 100 100

puts ""
puts "Selection time after the transformations:"
dchrono aTimer restart
vmoveto 115 160
dchrono aTimer stop counter vmoveto_1
vmoveto 0 0
dchrono aTimer restart
vmoveto 115 160
dchrono aTimer stop counter vmoveto_2

set aMemSel [meminfo h]
puts "Selection mem: [expr $aMemSel   / (1024 * 1024)] MiB ([expr $aMemSel])"

checkcolor 131 195 0 1 1
