625e1958 |
1 | puts "==================================" |
2 | puts "AIS_Manipulator - rotate 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_1 5 10 |
16 | pcylinder c1_2 3 10 |
17 | pcylinder c2 10 20 |
18 | ttranslate c1_1 100 0 20 |
19 | ttranslate c1_2 100 0 20 |
20 | trotate c1_2 100 0 25 0 1 0 90 |
21 | trotate c1_2 100 0 25 0 0 1 10 |
22 | ttranslate c2 100 0 0 |
23 | |
24 | compound c1_1 c1_2 c1 |
25 | |
26 | # ------------------------------------ |
27 | # display manipulated objects (test 1) |
28 | # ------------------------------------ |
29 | |
30 | vdisplay c1 |
31 | vdisplay c2 |
32 | vsetdispmode 1 |
33 | vaxo |
34 | vfit |
35 | |
36 | # ------------------ |
37 | # attach manipulator |
38 | # ------------------ |
39 | |
91d96372 |
40 | vmanipulator m -attach c1 -adjustPosition 1 -adjustSize 0 -enableModes 1 -size 40 |
625e1958 |
41 | |
42 | # ---------------------------------------------------- |
43 | # test rotation around x axis (object reference frame) |
44 | # ---------------------------------------------------- |
45 | |
46 | vmanipulator m -followRotation 1 |
47 | |
48 | set mouse_pick {201 092} |
49 | set mouse_drag {176 142} |
50 | |
51 | vmoveto {*}$mouse_pick |
52 | vselect {*}$mouse_pick |
53 | vmanipulator m -startTransform {*}$mouse_pick |
54 | vmanipulator m -transform {*}$mouse_drag |
55 | vmanipulator m -stopTransform |
56 | vselect 0 0 |
57 | vmoveto {*}$mouse_drag |
58 | vdump $anImage1 |
59 | |
60 | # ---------------------------------------------------- |
61 | # test rotation around y axis (object reference frame) |
62 | # ---------------------------------------------------- |
63 | |
64 | vmanipulator m -followRotation 1 |
65 | |
66 | set mouse_pick {173 137} |
67 | set mouse_drag {233 140} |
68 | |
69 | vmoveto {*}$mouse_pick |
70 | vselect {*}$mouse_pick |
71 | vmanipulator m -startTransform {*}$mouse_pick |
72 | vmanipulator m -transform {*}$mouse_drag |
73 | vmanipulator m -stopTransform |
74 | vselect 0 0 |
75 | vmoveto {*}$mouse_drag |
76 | vdump $anImage2 |
77 | |
78 | # ---------------------------------------------------- |
79 | # test rotation around z axis (object reference frame) |
80 | # ---------------------------------------------------- |
81 | |
82 | vmanipulator m -followRotation 1 |
83 | |
84 | set mouse_pick {200 094} |
85 | set mouse_drag {182 117} |
86 | |
87 | vmoveto {*}$mouse_pick |
88 | vselect {*}$mouse_pick |
89 | vmanipulator m -startTransform {*}$mouse_pick |
90 | vmanipulator m -transform {*}$mouse_drag |
91 | vmanipulator m -stopTransform |
92 | vselect 0 0 |
93 | vmoveto {*}$mouse_drag |
94 | vdump $anImage3 |
95 | |
96 | # ------------------------------------ |
97 | # display manipulated objects (test 2) |
98 | # ------------------------------------ |
99 | |
100 | vremove -all |
101 | vdisplay c1 |
102 | vdisplay c2 |
103 | vsetdispmode 1 |
104 | vaxo |
105 | vfit |
106 | |
91d96372 |
107 | vmanipulator m -attach c1 -adjustPosition 1 -adjustSize 0 -enableModes 1 -size 40 |
625e1958 |
108 | vmanipulator m -followRotation 0 |
109 | |
110 | # --------------------------------------------------- |
111 | # test rotation around y axis (world reference frame) |
112 | # --------------------------------------------------- |
113 | |
114 | set mouse_pick {211 095} |
115 | set mouse_drag {230 127} |
116 | |
117 | vmoveto {*}$mouse_pick |
118 | vselect {*}$mouse_pick |
119 | vmanipulator m -startTransform {*}$mouse_pick |
120 | vmanipulator m -transform {*}$mouse_drag |
121 | vmanipulator m -stopTransform |
122 | vselect 0 0 |
123 | vmoveto {*}$mouse_drag |
124 | vdump $anImage4 |
125 | |
126 | # --------------------------------------------------- |
127 | # test rotation around z axis (world reference frame) |
128 | # --------------------------------------------------- |
129 | |
130 | set mouse_pick {225 143} |
131 | set mouse_drag {184 143} |
132 | |
133 | vmoveto {*}$mouse_pick |
134 | vselect {*}$mouse_pick |
135 | vmanipulator m -startTransform {*}$mouse_pick |
136 | vmanipulator m -transform {*}$mouse_drag |
137 | vmanipulator m -stopTransform |
138 | vselect 0 0 |
139 | vmoveto {*}$mouse_drag |
140 | vdump $anImage5 |
141 | |
142 | set to_dump_screen 0 |