099f3513 |
1 | puts "========" |
2 | puts "OCC27739" |
3 | puts "========" |
4 | puts "" |
5 | ################################################################## |
6 | puts "Visualization, TKV3d - implement individual acceleration data structure for selection of 2D persistent objects" |
7 | ################################################################## |
8 | |
9 | # Create view |
10 | set win_width 409 |
11 | set win_height 409 |
12 | vinit View1 w=$win_width h=$win_height |
13 | vclear |
14 | |
15 | # Display several different presentation types with orthographic camera |
16 | vcamera -ortho |
17 | vtrihedron tri1 |
18 | box box3d 100 100 100 |
19 | box box2d 100 100 1 |
20 | box box2d_pos 100 100 1 |
21 | box box2d_loc 100 100 1 |
22 | box box_zoom 100 100 100 |
23 | |
24 | vdisplay box3d -dispMode 1 -highMode 0 |
25 | vdisplay box2d -dispMode 1 -highMode 1 -2d |
26 | vdisplay box2d_pos -dispMode 1 -highMode 1 -2d -trsfPersPos -1 -1 |
27 | vdisplay box2d_loc -dispMode 1 -highMode 1 -2d |
28 | vdisplay box_zoom -dispMode 1 -highMode 0 -trsfPers zoom |
29 | vdisplay box2d |
30 | vsetlocation box2d_loc 100 0 0 |
31 | vsetlocation box_zoom -100 -100 100 |
32 | |
33 | vsetmaterial box3d box2d box2d_pos box2d_loc box_zoom PLASTIC |
34 | vsetcolor box3d GOLD |
35 | vsetcolor box2d GREEN |
36 | vsetcolor box2d_pos GREEN |
37 | vsetcolor box2d_loc GREEN |
38 | vsetcolor box_zoom RED |
39 | vfit |
40 | |
41 | # ========================================== |
42 | # Test selection for orthographic projection |
43 | # ========================================== |
44 | |
45 | set test_1 {220 120}; # box2d |
46 | set test_2 {350 150}; # box2d_pos |
47 | set test_3 { 50 350}; # box2d_loc |
48 | |
49 | vmoveto {*}$test_1 |
50 | if {[vreadpixel {*}$test_1 name] != "CYAN1 1"} { puts "ERROR: zoom persistent box is not detected!" } |
51 | vdump $imagedir/${casename}_1.png |
52 | |
53 | vmoveto {*}$test_2 |
54 | if {[vreadpixel {*}$test_2 name] != "CYAN1 1"} { puts "ERROR: zoom persistent box is not detected!" } |
55 | vdump $imagedir/${casename}_2.png |
56 | |
57 | vmoveto {*}$test_3 |
58 | if {[vreadpixel {*}$test_3 name] != "CYAN1 1"} { puts "ERROR: zoom persistent box is not detected!" } |
59 | vdump $imagedir/${casename}_3.png |
60 | |
61 | # ========================================= |
62 | # Test selection for perspective projection |
63 | # ========================================= |
64 | |
65 | vcamera -persp |
66 | vcamera -distance 1000 |
67 | set test_1 {220 120}; # box2d |
68 | set test_2 {350 150}; # box2d_pos |
69 | set test_3 { 50 350}; # box2d_loc |
70 | |
71 | vmoveto {*}$test_1 |
72 | if {[vreadpixel {*}$test_1 name] != "CYAN1 1"} { puts "ERROR: zoom persistent box is not detected!" } |
73 | vdump $imagedir/${casename}_4.png |
74 | |
75 | vmoveto {*}$test_2 |
76 | if {[vreadpixel {*}$test_2 name] != "CYAN1 1"} { puts "ERROR: zoom persistent box is not detected!" } |
77 | vdump $imagedir/${casename}_5.png |
78 | |
79 | vmoveto {*}$test_3 |
80 | if {[vreadpixel {*}$test_3 name] != "CYAN1 1"} { puts "ERROR: zoom persistent box is not detected!" } |
81 | vdump $imagedir/${casename}_6.png |