0023886: Visualizing planar faces with "notches" depends heavily on the deflection...
[occt.git] / tests / bugs / vis / bug24307_1
CommitLineData
b7cd4ba7 1puts "========"
2puts "OCC24307 Objects clipping algorithm using BVH performance test: Solid spheres test"
3puts "========"
4
5# define objects' location parameters and their characteristics
6set SPHERES_NUM 10
7set SPERE_RADIUS 100
8set SPHERE_FINENESS 10
9set PERCENT_OF_INNER_SPHERES 30
10
11# window parameters
12set SMALL_WIN_WIDTH 512
13set SMALL_WIN_HEIGHT 512
14
15# other
16array set aSphereNames {}
17
18set aWithoutClippingSnapshot $imagedir/${casename}_without.png
19set aWithClippingSnapshot $imagedir/${casename}_with.png
20set aDiffImage $imagedir/${casename}_diff.png
21
22pload VISUALIZATION MODELING
23vinit name=small_wnd l=32 t=32 w=$SMALL_WIN_WIDTH h=$SMALL_WIN_HEIGHT
24vactivate small_wnd
25vfrustumculling 0
26vautozfit 0
27vviewparams -scale 1.953125 -eye 0.57735026918962573 -0.57735026918962573 0.57735026918962573
28vzrange 1 512
29vclear
30vremove -all -noinfo
31
32puts [vdrawsphere tmp_sph $SPHERE_FINENESS]
33vremove -noinfo tmp_sph
34
35set aInnerSpheresNum [expr $SPHERES_NUM * $PERCENT_OF_INNER_SPHERES / 100]
36puts ""
37set aDebugInfo "Total number of visible objects: "
38append aDebugInfo $aInnerSpheresNum
39puts $aDebugInfo
40puts ""
41
42puts "Start displaying spheres without clipping..."
43set aInnerWidthStep [expr $SMALL_WIN_WIDTH / ($aInnerSpheresNum + 1)]
44set aInnerHeightStep [expr $SMALL_WIN_HEIGHT / ($aInnerSpheresNum + 1)]
45set aOuterStep [expr $SPERE_RADIUS * 3 / ($SPHERES_NUM - $aInnerSpheresNum + 1)]
46for {set i 0} {$i < $aInnerSpheresNum} {incr i} {
47 set aCurrName "inner_sph"
48 append aCurrName $i
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
53}
54for {set i $aInnerSpheresNum} {$i < $SPHERES_NUM} {incr i} {
55 set aCurrName "outer_sph"
56 append aCurrName $i
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
61}
62puts [vfps]
63vdump $aWithoutClippingSnapshot
64puts "All spheres were displayed."
65puts ""
66
67verase
68
69puts "Start displaying spheres with clipping..."
70vfrustumculling 1
71vdisplayall
72puts [vfps]
73vdump $aWithClippingSnapshot
74puts "All spheres were displayed."
75puts ""
76
77set aDiffImageResult [diffimage $aWithClippingSnapshot $aWithoutClippingSnapshot 0.1 0 0 $aDiffImage]
78if {$aDiffImageResult != 0} {
79 puts "ERROR : Test failed: there is a difference between images rendered with and without clipping"
80}
81
82verase