2 puts "OCC24307 Objects clipping algorithm using BVH performance test: Solid spheres test"
5 # define objects' location parameters and their characteristics
9 set PERCENT_OF_INNER_SPHERES 30
12 set SMALL_WIN_WIDTH 512
13 set SMALL_WIN_HEIGHT 512
16 array set aSphereNames {}
18 set aWithoutClippingSnapshot $imagedir/${casename}_without.png
19 set aWithClippingSnapshot $imagedir/${casename}_with.png
20 set aDiffImage $imagedir/${casename}_diff.png
22 pload VISUALIZATION MODELING
23 vinit name=small_wnd l=32 t=32 w=$SMALL_WIN_WIDTH h=$SMALL_WIN_HEIGHT
27 vviewparams -scale 1.953125 -eye 0.57735026918962573 -0.57735026918962573 0.57735026918962573
32 puts [vdrawsphere tmp_sph $SPHERE_FINENESS]
33 vremove -noinfo tmp_sph
35 set aInnerSpheresNum [expr $SPHERES_NUM * $PERCENT_OF_INNER_SPHERES / 100]
37 set aDebugInfo "Total number of visible objects: "
38 append aDebugInfo $aInnerSpheresNum
42 puts "Start displaying spheres without clipping..."
43 set aInnerWidthStep [expr $SMALL_WIN_WIDTH / ($aInnerSpheresNum + 1)]
44 set aInnerHeightStep [expr $SMALL_WIN_HEIGHT / ($aInnerSpheresNum + 1)]
45 set aOuterStep [expr $SPERE_RADIUS * 3 / ($SPHERES_NUM - $aInnerSpheresNum + 1)]
46 for {set i 0} {$i < $aInnerSpheresNum} {incr i} {
47 set aCurrName "inner_sph"
49 set aX [expr - $SMALL_WIN_WIDTH / 2 + ($i + 1) * $aInnerWidthStep ]
50 set aY [expr - $SMALL_WIN_HEIGHT / 2 + ($i + 1) * $aInnerHeightStep ]
51 vdrawsphere $aCurrName $SPHERE_FINENESS $aX $aY 0 $SPERE_RADIUS 0 0
52 set aSphereNames($i) $aCurrName
54 for {set i $aInnerSpheresNum} {$i < $SPHERES_NUM} {incr i} {
55 set aCurrName "outer_sph"
57 set aX [expr - $SMALL_WIN_WIDTH - $SPERE_RADIUS * 3 + ($i - $aInnerSpheresNum + 1) * $aOuterStep ]
58 set aY [expr - $SMALL_WIN_HEIGHT - $SPERE_RADIUS * 3 + ($i - $aInnerSpheresNum + 1) * $aOuterStep ]
59 vdrawsphere $aCurrName $SPHERE_FINENESS $aX $aY 0 $SPERE_RADIUS 0 0
60 set aSphereNames($i) $aCurrName
63 vdump $aWithoutClippingSnapshot
64 puts "All spheres were displayed."
69 puts "Start displaying spheres with clipping..."
73 vdump $aWithClippingSnapshot
74 puts "All spheres were displayed."
77 set aDiffImageResult [diffimage $aWithClippingSnapshot $aWithoutClippingSnapshot 0.1 0 0 $aDiffImage]
78 if {$aDiffImageResult != 0} {
79 puts "ERROR : Test failed: there is a difference between images rendered with and without clipping"