f522ce50 |
1 | puts "=====================================" |
2 | puts "AIS_Manipulator - drag an object" |
3 | puts "=====================================" |
4 | |
5 | set anImage1 $imagedir/${casename}_1.png |
6 | set anImage2 $imagedir/${casename}_2.png |
7 | set anImage3 $imagedir/${casename}_3.png |
8 | set anImage4 $imagedir/${casename}_4.png |
9 | set anImage5 $imagedir/${casename}_5.png |
10 | |
11 | # ------------------------------------- |
12 | # create manipulated and helper objects |
13 | # ------------------------------------- |
14 | |
15 | pcylinder c1 5 10 |
16 | pcylinder c2 10 20 |
17 | ttranslate c1 105 0 20 |
18 | ttranslate c2 100 0 0 |
19 | trotate c1 100 0 25 0 1 0 90 |
20 | trotate c1 100 0 25 0 0 1 10 |
21 | |
22 | # ------------------------------------- |
23 | # display manipulated objects |
24 | # ------------------------------------- |
25 | |
26 | vdisplay c1 |
27 | vdisplay c2 |
28 | vsetdispmode 1 |
29 | vaxo |
30 | vfit |
31 | |
32 | # ------------------ |
33 | # attach manipulator |
34 | # ------------------ |
35 | |
36 | vmanipulator m -attach c1 -adjustPosition 1 -adjustSize 0 -enableModes 1 -size 40 |
37 | vmanipulator m -followRotation 1 |
38 | vmanipulator m -followTranslation 1 |
39 | vdump $anImage1 |
40 | |
41 | # ---------------------------------------------------- |
42 | # test xz plane dragging transform (world reference frame) |
43 | # ---------------------------------------------------- |
44 | |
45 | set mouse_pick {211 129} |
46 | set mouse_drag {284 248} |
47 | |
48 | vmoveto {*}$mouse_pick |
49 | vselect {*}$mouse_pick |
50 | vmanipulator m -startTransform {*}$mouse_pick |
51 | vmanipulator m -transform {*}$mouse_drag |
52 | vmanipulator m -stopTransform |
53 | vselect 0 0 |
54 | vmoveto {*}$mouse_drag |
55 | vdump $anImage2 |
56 | |
57 | # ------------------------------------------- |
58 | # rotate around y axis |
59 | # ------------------------------------------- |
60 | |
61 | set mouse_pick {316 257} |
62 | set mouse_drag {279 286} |
63 | |
64 | vmoveto {*}$mouse_pick |
65 | vselect {*}$mouse_pick |
66 | vmanipulator m -startTransform {*}$mouse_pick |
67 | vmanipulator m -transform {*}$mouse_drag |
68 | vmanipulator m -stopTransform |
69 | vselect 0 0 |
70 | vmoveto {*}$mouse_drag |
71 | vdump $anImage3 |
72 | |
73 | # ---------------------------------------------------- |
74 | # test xy plane dragging transform (world reference frame) |
75 | # ---------------------------------------------------- |
76 | |
77 | set mouse_pick {278 267} |
78 | set mouse_drag {156 276} |
79 | |
80 | vmoveto {*}$mouse_pick |
81 | vselect {*}$mouse_pick |
82 | vmanipulator m -startTransform {*}$mouse_pick |
83 | vmanipulator m -transform {*}$mouse_drag |
84 | vmanipulator m -stopTransform |
85 | vselect 0 0 |
86 | vmoveto {*}$mouse_drag |
87 | vdump $anImage4 |
88 | |
89 | # ---------------------------------------------------- |
90 | # test yz plane dragging transform (world reference frame) |
91 | # ---------------------------------------------------- |
92 | |
93 | set mouse_pick {168 258} |
94 | set mouse_drag {166 182} |
95 | |
96 | vmoveto {*}$mouse_pick |
97 | vselect {*}$mouse_pick |
98 | vmanipulator m -startTransform {*}$mouse_pick |
99 | vmanipulator m -transform {*}$mouse_drag |
100 | vmanipulator m -stopTransform |
101 | vselect 0 0 |
102 | vmoveto {*}$mouse_drag |
103 | vdump $anImage5 |