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