| 1 |
;;; |
| 2 |
;;; Graphic example with Sunview I or Xview Toolkit |
| 3 |
;;; 1988.8.16 by M.Inaba |
| 4 |
;;; 1988.10.29 use new viewport.l |
| 5 |
;;; 1989.11.24 use rpy-matrix and |
| 6 |
;;; (coordmenu) |
| 7 |
;;; |
| 8 |
(defclass coordmenu |
| 9 |
:super sunview-frame |
| 10 |
:slots |
| 11 |
( |
| 12 |
apickport |
| 13 |
coordpanel1 coordpanel2 coordpanel3 coordcanvas |
| 14 |
translate-x translate-y translate-z translate-wrt translate-to |
| 15 |
rotate-x rotate-y rotate-z rotate-wrt rotate-to |
| 16 |
transformation |
| 17 |
coord wrt base |
| 18 |
coord-pos wrt-pos |
| 19 |
selected-coord |
| 20 |
coord-x-message coord-y-message coord-z-message |
| 21 |
coord-roll coord-pitch coord-yaw |
| 22 |
coord-roll-slider coord-pitch-slider coord-yaw-slider |
| 23 |
left-right-angle up-down-angle axis-length |
| 24 |
wrt-x-message wrt-y-message wrt-z-message |
| 25 |
wrt-roll-slider wrt-pitch-slider wrt-yaw-slider |
| 26 |
wrt-roll wrt-pitch wrt-yaw |
| 27 |
transform-wrt transform-to |
| 28 |
canvas-width |
| 29 |
) |
| 30 |
) |
| 31 |
(defmethod coordmenu |
| 32 |
(:>select-coord |
| 33 |
(window movement button pos time) |
| 34 |
(send self :select-coordinates pos) |
| 35 |
(case |
| 36 |
button |
| 37 |
(left (send self :reset-all)) |
| 38 |
(middle (send self :reset-all)) |
| 39 |
(right (send self :reset-all))) |
| 40 |
(send apickport :viewsurface :flush) |
| 41 |
) |
| 42 |
(:select-coordinates |
| 43 |
(pos) |
| 44 |
(setq selected-coord (pick-coordinates (list coord wrt) pos apickport))) |
| 45 |
(:show-coord-position |
| 46 |
(&optional item event) |
| 47 |
(send coord-x-message |
| 48 |
:title (format nil " X:~7F WX:~7F" |
| 49 |
(vector-x (send coord :worldpos)) |
| 50 |
(vector-x (send coord :worldpos)))) |
| 51 |
(send coord-y-message |
| 52 |
:title (format nil " Y:~7F WY:~7F" |
| 53 |
(vector-y (send coord :worldpos)) |
| 54 |
(vector-y (send coord :worldpos)))) |
| 55 |
(send coord-z-message |
| 56 |
:title (format nil " Z:~7F WZ:~7F" |
| 57 |
(vector-z (send coord :worldpos)) |
| 58 |
(vector-z (send coord :worldpos)))) |
| 59 |
) |
| 60 |
(:show-coord-rotation |
| 61 |
(&optional item event) |
| 62 |
(let ((rpy (roll-pitch-yaw (send coord :worldrot)))) |
| 63 |
(send coord-roll-slider :value (rad2deg (elt rpy 0))) |
| 64 |
(send coord-pitch-slider :value (rad2deg (elt rpy 1))) |
| 65 |
(send coord-yaw-slider :value (rad2deg (elt rpy 2))) |
| 66 |
) |
| 67 |
) |
| 68 |
(:show-wrt-rotation |
| 69 |
(&optional item event) |
| 70 |
(let ((rpy (roll-pitch-yaw (send wrt :worldrot)))) |
| 71 |
(send wrt-roll-slider :value (rad2deg (elt rpy 0))) |
| 72 |
(send wrt-pitch-slider :value (rad2deg (elt rpy 1))) |
| 73 |
(send wrt-yaw-slider :value (rad2deg (elt rpy 2))) |
| 74 |
) |
| 75 |
) |
| 76 |
(:show-wrt-position |
| 77 |
(&optional item event) |
| 78 |
(send wrt-x-message |
| 79 |
:title (format nil " X:~7F WX:~7F" |
| 80 |
(vector-x (send wrt :worldpos)) |
| 81 |
(vector-x (send wrt :worldpos)))) |
| 82 |
(send wrt-y-message |
| 83 |
:title (format nil " Y:~7F WY:~7F" |
| 84 |
(vector-y (send wrt :worldpos)) |
| 85 |
(vector-y (send wrt :worldpos)))) |
| 86 |
(send wrt-z-message |
| 87 |
:title (format nil " Z:~7F WZ:~7F" |
| 88 |
(vector-z (send wrt :worldpos)) |
| 89 |
(vector-z (send wrt :worldpos)))) |
| 90 |
) |
| 91 |
(:flush-all |
| 92 |
(&optional item event) |
| 93 |
(send apickport :viewsurface :set-show-mode) |
| 94 |
(send self :show-all) |
| 95 |
(send apickport :flush) |
| 96 |
) |
| 97 |
(:draw-box |
| 98 |
(&optional item event) |
| 99 |
(send apickport :draw-box-cursor (send coord :worldpos)) |
| 100 |
(send apickport :draw-box-cursor (send wrt :worldpos)) |
| 101 |
(send self :show-coord-position) |
| 102 |
(send self :show-wrt-position) |
| 103 |
) |
| 104 |
(:>set-start-point |
| 105 |
(window movement button pos time) |
| 106 |
(let* |
| 107 |
((p3 (2dvector-to-3dvector pos)) |
| 108 |
(p (send apickport :viewport :screen-point-to-ndc p3)) |
| 109 |
(vline (send apickport :viewing :view-line p)) |
| 110 |
) |
| 111 |
(send self :select-coordinates pos) |
| 112 |
(send self :flush-all) |
| 113 |
)) |
| 114 |
(:>move-coord |
| 115 |
(window movement button pos time) |
| 116 |
(let* |
| 117 |
((3dpos (send apickport :pick-vector pos |
| 118 |
(case |
| 119 |
button |
| 120 |
(left (float-vector 1 0 0)) |
| 121 |
(middle (float-vector 0 1 0)) |
| 122 |
(right (float-vector 0 0 1))) |
| 123 |
(send selected-coord :worldpos)))) |
| 124 |
(send self :erase-all) |
| 125 |
(if (equal selected-coord coord) |
| 126 |
(send coord :new-world-coords |
| 127 |
(send coord :worldrot) |
| 128 |
(setq coord-pos 3dpos)) |
| 129 |
(send wrt :new-world-coords |
| 130 |
(send wrt :worldrot) |
| 131 |
(setq wrt-pos 3dpos))) |
| 132 |
(send self :flush-all) |
| 133 |
) |
| 134 |
) |
| 135 |
(:assoc (&optional item event) |
| 136 |
(send wrt :assoc coord) |
| 137 |
(send self :flush-all) |
| 138 |
) |
| 139 |
(:dissoc (&optional item event) |
| 140 |
(send wrt :dissoc coord) |
| 141 |
(send self :flush-all) |
| 142 |
) |
| 143 |
(:obey (&optional item event) |
| 144 |
(send coord :obey wrt) |
| 145 |
(send self :flush-all) |
| 146 |
) |
| 147 |
(:disobey (&optional item event) |
| 148 |
(send coord :disobey wrt) |
| 149 |
(send self :flush-all) |
| 150 |
) |
| 151 |
(:buffer-mode |
| 152 |
(value &optional item event) |
| 153 |
(send apickport :clear) |
| 154 |
(send apickport :viewsurface :buffer-mode value) |
| 155 |
(send self :flush-all) |
| 156 |
) |
| 157 |
(:init-panel1 |
| 158 |
(&optional item event) |
| 159 |
(setq left-right-angle 0) |
| 160 |
(setq up-down-angle 0) |
| 161 |
(setq axis-length 30) |
| 162 |
(setq coordpanel1 |
| 163 |
(send self :create-subwindow |
| 164 |
sunview-panel :vertical nil :col-num 1 :item-size 20)) |
| 165 |
(send self :create-button :flush-all :title "show-all") |
| 166 |
(send self :create-button :clear-port :title "clear-port") |
| 167 |
(send self :create-button :reset-all :title "reset-all") |
| 168 |
(send self :create-button :flush :title "refresh") |
| 169 |
(send self :create-choice :buffer-mode :title "buffer mode:" :value t |
| 170 |
:vertical nil :choices (vector t nil) :display-level 'current) |
| 171 |
(when (equal |
| 172 |
*coordinates* cascaded-coords) |
| 173 |
(send self :create-button :assoc :title "Assoc to wrt") |
| 174 |
(send self :create-button :dissoc :title "Dissoc from wrt") |
| 175 |
(send self :create-button :obey :title "Obey to wrt") |
| 176 |
(send self :create-button :disobey :title "Disobey from wrt") |
| 177 |
) |
| 178 |
|
| 179 |
(send self :create-slider :axis-length :title "Axis length" |
| 180 |
:min 5 :max 100 :value axis-length :notify-level 'all :vertical t) |
| 181 |
(send self :create-slider :left-right :title "lookaround-left-right:" |
| 182 |
:min -180 :max 180 :value 0 :notify-level 'all :vertical t) |
| 183 |
(send self :create-slider :up-down :title "lookaround-up-down:" |
| 184 |
:min -180 :max 180 :value 0 :notify-level 'all :vertical t) |
| 185 |
(send self :create-message :title "Coordinates:") |
| 186 |
(setq coord-x-message |
| 187 |
(send self :create-message |
| 188 |
:title (concatenate |
| 189 |
string " X :" |
| 190 |
(string (vector-x (send coord :worldpos)))))) |
| 191 |
(setq coord-y-message |
| 192 |
(send self :create-message |
| 193 |
:title (concatenate |
| 194 |
string " Y :" |
| 195 |
(string (vector-y (send coord :worldpos)))))) |
| 196 |
(setq coord-z-message |
| 197 |
(send self :create-message |
| 198 |
:title (concatenate |
| 199 |
string " Z :" |
| 200 |
(string (vector-z (send coord :worldpos)))))) |
| 201 |
(send self :create-message :title "Wrt:") |
| 202 |
(setq wrt-x-message |
| 203 |
(send self :create-message |
| 204 |
:title (concatenate |
| 205 |
string " X :" |
| 206 |
(string (vector-x (send wrt :worldpos)))))) |
| 207 |
(setq wrt-y-message |
| 208 |
(send self :create-message |
| 209 |
:title (concatenate |
| 210 |
string " Y :" |
| 211 |
(string (vector-y (send wrt :worldpos)))))) |
| 212 |
(setq wrt-z-message |
| 213 |
(send self :create-message |
| 214 |
:title (concatenate |
| 215 |
string " Z :" |
| 216 |
(string (vector-z (send wrt :worldpos)))))) |
| 217 |
) |
| 218 |
(:init-panel2 |
| 219 |
(&optional item event) |
| 220 |
(setq coordpanel2 |
| 221 |
(send self :create-subwindow sunview-panel |
| 222 |
:vertical nil :item-size 20)) |
| 223 |
(send self :create-message :title " <<Wrt>>") |
| 224 |
(setq wrt-roll-slider |
| 225 |
(send self :create-slider :set-wrt-roll |
| 226 |
:title "r-x:" :min 0 :value wrt-roll |
| 227 |
:max 360 :notify-level 'all :vertical nil)) |
| 228 |
(setq wrt-pitch-slider |
| 229 |
(send self :create-slider :set-wrt-pitch |
| 230 |
:title "r-y:" :min 0 :value wrt-pitch |
| 231 |
:max 360 :notify-level 'all :vertical nil)) |
| 232 |
(setq wrt-yaw-slider |
| 233 |
(send self :create-slider :set-wrt-yaw |
| 234 |
:title "r-z:" :min 0 :value wrt-yaw |
| 235 |
:max 360 :notify-level 'all :vertical nil)) |
| 236 |
;;; |
| 237 |
(send self :create-message :title " <<Coordinate>>") |
| 238 |
(setq coord-roll-slider |
| 239 |
(send self :create-slider :set-coord-roll |
| 240 |
:title "r-x:" :min 0 :value coord-roll |
| 241 |
:max 360 :notify-level 'all :vertical nil)) |
| 242 |
(setq coord-pitch-slider |
| 243 |
(send self :create-slider :set-coord-pitch |
| 244 |
:title "r-y:" :min 0 :value coord-pitch |
| 245 |
:max 360 :notify-level 'all :vertical nil)) |
| 246 |
(setq coord-yaw-slider |
| 247 |
(send self :create-slider :set-coord-yaw |
| 248 |
:title "r-z:" :min 0 :value coord-yaw |
| 249 |
:max 360 :notify-level 'all :vertical nil)) |
| 250 |
) |
| 251 |
(:init-panel3 |
| 252 |
(&optional item event) |
| 253 |
(setq translate-x 0 translate-y 0 translate-z 0 |
| 254 |
translate-wrt 'local translate-to 'local) |
| 255 |
(setq rotate-x 0 rotate-y 0 rotate-z 0 |
| 256 |
rotate-wrt 'local rotate-to 'local) |
| 257 |
(setq coordpanel3 |
| 258 |
(send self :create-subwindow sunview-panel :item-size 20 :y 0)) |
| 259 |
(send self :create-message :title " <<Translation>>") |
| 260 |
(send self :create-button :locate :title "locate") |
| 261 |
(send self :create-button :move-locally :title "move-locally") |
| 262 |
(send self :create-button :translate :title "translate") |
| 263 |
(send self :create-choice :set-translate-wrt |
| 264 |
:title "Translate-wrt:" :display-level 'current |
| 265 |
:horizontal t :choices (list 'local 'world 'wrt)) |
| 266 |
(send self :create-choice :set-translate-to |
| 267 |
:title "Translate-to:" :display-level 'current |
| 268 |
:vertical nil :choices (list 'local 'world 'wrt)) |
| 269 |
(send self :create-slider :set-translate-x |
| 270 |
:title "x:" :min -200 :max 200 :notify-level 'all :vertical nil) |
| 271 |
(send self :create-slider :set-translate-y |
| 272 |
:title "y:" :min -200 :max 200 :notify-level 'all :vertical nil) |
| 273 |
(send self :create-slider :set-translate-z |
| 274 |
:title "z:" :min -200 :max 200 :notify-level 'all :vertical nil) |
| 275 |
;;; |
| 276 |
(send self :create-message :title " <<Rotation>>") |
| 277 |
(send self :create-button :orient :title "rotate-in-world") |
| 278 |
(send self :create-button :rotate :title "rotate-locally") |
| 279 |
(send self :create-button :rotate :title "rotate") |
| 280 |
(send self :create-choice :set-rotate-wrt |
| 281 |
:title "Rotate-wrt:" :display-level 'current |
| 282 |
:vertical nil :choices (list 'local 'world 'wrt)) |
| 283 |
(send self :create-choice :set-rotate-to |
| 284 |
:title "Rotate-to:" :display-level 'current |
| 285 |
:vertical nil :choices (list 'local 'world 'wrt)) |
| 286 |
(send self :create-slider :set-rotate-x |
| 287 |
:title "x:" :min -180 :max 180 :notify-level 'all :vertical nil) |
| 288 |
(send self :create-slider :set-rotate-y |
| 289 |
:title "y:" :min -180 :max 180 :notify-level 'all :vertical nil) |
| 290 |
(send self :create-slider :set-rotate-z |
| 291 |
:title "z:" :min -180 :max 180 :notify-level 'all :vertical nil) |
| 292 |
;;; |
| 293 |
(setq transform-wrt 'local transform-to 'local) |
| 294 |
(send self :create-message :title " <<Transformation>>") |
| 295 |
(send self :create-button :transform :title "transform") |
| 296 |
(send self :create-button :transform-with-coordinates |
| 297 |
:title "transform-coord") |
| 298 |
(send self :create-button :transform-to :title "transform-to") |
| 299 |
(send self :create-choice :set-transform-wrt |
| 300 |
:title "Transform-wrt:" :display-level 'current |
| 301 |
:vertical nil |
| 302 |
:choices (list 'local 'world 'parent 'wrt)) |
| 303 |
(send self :create-choice :set-transform-to |
| 304 |
:title "Transform-to:" :display-level 'current |
| 305 |
:vertical nil |
| 306 |
:choices (list 'local 'world 'parent 'wrt)) |
| 307 |
) |
| 308 |
;;; |
| 309 |
(:init-canvas |
| 310 |
(&optional item event) |
| 311 |
;;; |
| 312 |
(setq canvas-width (send coordpanel2 :width)) |
| 313 |
(setq coordcanvas |
| 314 |
(send self :create-subwindow sunview-canvas |
| 315 |
:x (send coordpanel2 :x) |
| 316 |
:height canvas-width :width canvas-width |
| 317 |
:below coordpanel2 |
| 318 |
:clicked-proc :>select-coord |
| 319 |
:drag-started-proc :>set-start-point |
| 320 |
:dragging-proc :>move-coord)) |
| 321 |
(send self :show t) |
| 322 |
(setq apickport |
| 323 |
(instance viewer :init |
| 324 |
:viewing |
| 325 |
(instance perspective-viewing :init |
| 326 |
:screen-x 10 :screen-y 10 |
| 327 |
:viewdistance 40 |
| 328 |
:pos #f(700 500 250) |
| 329 |
:target #f(0 0 0)) |
| 330 |
:viewsurface |
| 331 |
(instance canvas-viewsurface :init |
| 332 |
:canvas coordcanvas |
| 333 |
:cmap-type :mono |
| 334 |
:buffer-mode t) |
| 335 |
:viewport |
| 336 |
(instance viewport |
| 337 |
:init |
| 338 |
:width (/ canvas-width 2) |
| 339 |
:height (/ canvas-width -2) |
| 340 |
:xcenter (/ canvas-width 2) |
| 341 |
:ycenter (/ canvas-width 2)) |
| 342 |
)) |
| 343 |
(send self :flush-all) |
| 344 |
) |
| 345 |
(:init |
| 346 |
(&optional parent &key coords) |
| 347 |
(setq base (instance *coordinates* :init)) |
| 348 |
(setq coord-pos (float-vector 100 200 100)) |
| 349 |
(setq coord-roll 180 coord-yaw 90 coord-pitch 0) |
| 350 |
(setq coord (instance *coordinates* :init |
| 351 |
:rpy (list |
| 352 |
(deg2rad coord-roll) |
| 353 |
(deg2rad coord-pitch) |
| 354 |
(deg2rad coord-yaw) |
| 355 |
) |
| 356 |
:pos coord-pos)) |
| 357 |
;;; |
| 358 |
(setq wrt-pos (float-vector 150 -50 50)) |
| 359 |
(setq wrt-roll 90 wrt-pitch 0 wrt-yaw 0) |
| 360 |
(setq wrt (instance *coordinates* :init |
| 361 |
:rpy (list |
| 362 |
(deg2rad wrt-roll) |
| 363 |
(deg2rad wrt-pitch) |
| 364 |
(deg2rad wrt-yaw)) |
| 365 |
:pos wrt-pos)) |
| 366 |
(setq selected-coord coord) |
| 367 |
(send-super :init parent :title |
| 368 |
" << Coordinates View >>" :x 310 :y 20) |
| 369 |
(send self :init-panel1) |
| 370 |
(send self :init-panel2) |
| 371 |
(send self :init-panel3) |
| 372 |
(send self :init-canvas) |
| 373 |
(send coordpanel1 :height |
| 374 |
(+ 7 (send coordcanvas :height) (send coordpanel2 :height))) |
| 375 |
(send coordpanel3 :height |
| 376 |
(+ 7 (send coordcanvas :height) |
| 377 |
(send coordpanel2 :height))) |
| 378 |
self) |
| 379 |
(:clear-port (&optional item event) |
| 380 |
(send apickport :clear) |
| 381 |
(send apickport :viewsurface :flush) |
| 382 |
) |
| 383 |
(:draw-base-mark |
| 384 |
(&optional item event) |
| 385 |
(send apickport :draw-axis base (* 0.5 axis-length))) |
| 386 |
(:draw-wrt-mark |
| 387 |
(&optional item event) |
| 388 |
(send apickport :draw-axis wrt (* 0.6 axis-length))) |
| 389 |
(:draw-coord-mark |
| 390 |
(&optional item event) |
| 391 |
(send apickport :draw-axis coord axis-length) |
| 392 |
) |
| 393 |
(:erase-all (&optional event) |
| 394 |
(send apickport :viewsurface :set-erase-mode) |
| 395 |
(send self :draw-base-mark) |
| 396 |
(send self :draw-wrt-mark) |
| 397 |
(send self :draw-coord-mark) |
| 398 |
(send self :draw-box) |
| 399 |
) |
| 400 |
(:show-all (&optional item event) |
| 401 |
(send apickport :viewsurface :set-show-mode) |
| 402 |
(send self :draw-base-mark) |
| 403 |
(send self :draw-wrt-mark) |
| 404 |
(send self :draw-coord-mark) |
| 405 |
(send self :show-coord-position) |
| 406 |
(send self :show-wrt-position) |
| 407 |
(send self :draw-box) |
| 408 |
; (send self :show-coord-rotation) |
| 409 |
; (send self :show-wrt-rotation) |
| 410 |
) |
| 411 |
(:reset-coords |
| 412 |
(&optional item event) |
| 413 |
(send wrt :new-world-coords |
| 414 |
(rpy-matrix |
| 415 |
(deg2rad wrt-roll) (deg2rad wrt-pitch) (deg2rad wrt-yaw)) |
| 416 |
(copy-object wrt-pos)) |
| 417 |
(send coord :new-world-coords |
| 418 |
(rpy-matrix |
| 419 |
(deg2rad coord-roll) (deg2rad coord-pitch) (deg2rad coord-yaw)) |
| 420 |
(copy-object coord-pos))) |
| 421 |
(:reset-all |
| 422 |
(&optional item event) |
| 423 |
(send self :erase-all) |
| 424 |
(send self :reset-coords) |
| 425 |
(send self :flush-all) |
| 426 |
) |
| 427 |
(:set-wrt-roll (value &optional item event) (setq wrt-roll value) |
| 428 |
(send self :reset-all) |
| 429 |
) |
| 430 |
(:set-wrt-pitch (value &optional item event) |
| 431 |
(setq wrt-pitch value) |
| 432 |
(send self :reset-all) |
| 433 |
) |
| 434 |
(:set-wrt-yaw (value &optional item event) (setq wrt-yaw value) |
| 435 |
(send self :reset-all) |
| 436 |
) |
| 437 |
(:set-coord-roll (value &optional item event) |
| 438 |
(setq coord-roll value) |
| 439 |
(send self :reset-all) |
| 440 |
) |
| 441 |
(:set-coord-pitch (value &optional item event) (setq coord-pitch value) |
| 442 |
(send self :reset-all) |
| 443 |
) |
| 444 |
(:set-coord-yaw (value &optional item event) (setq coord-yaw value) |
| 445 |
(send self :reset-all) |
| 446 |
) |
| 447 |
(:locate |
| 448 |
(&optional item event) |
| 449 |
(send self :erase-all) |
| 450 |
(send coord :locate |
| 451 |
(float-vector translate-x translate-y translate-z) |
| 452 |
translate-wrt) |
| 453 |
(send self :flush-all) |
| 454 |
) |
| 455 |
(:move-locally |
| 456 |
(&optional item event) |
| 457 |
(send self :erase-all) |
| 458 |
(send coord :translate |
| 459 |
(float-vector translate-x translate-y translate-z) |
| 460 |
translate-wrt) |
| 461 |
(send self :flush-all) |
| 462 |
) |
| 463 |
(:translate |
| 464 |
(&optional item event) |
| 465 |
(send self :erase-all) |
| 466 |
(send coord :translate |
| 467 |
translate-to |
| 468 |
(send coord :transform-vector |
| 469 |
(float-vector translate-x translate-y translate-z) |
| 470 |
translate-wrt)) |
| 471 |
(send self :flush-all)) |
| 472 |
(:orient |
| 473 |
(&optional item event) |
| 474 |
(send self :erase-erase-all) |
| 475 |
(if (not (zerop rotate-x)) |
| 476 |
(send coord :orient (deg2rad rotate-x) :x rotate-wrt)) |
| 477 |
(if (not (zerop rotate-y)) |
| 478 |
(send coord :orient (deg2rad rotate-y) :y rotate-wrt)) |
| 479 |
(if (not (zerop rotate-z)) |
| 480 |
(send coord :orient (deg2rad rotate-z) :z rotate-wrt)) |
| 481 |
(send self :flush-all) |
| 482 |
) |
| 483 |
(:rotate |
| 484 |
(&optional item event) |
| 485 |
(send self :erase-all) |
| 486 |
(if (not (zerop rotate-x)) |
| 487 |
(send coord :rotate (deg2rad rotate-x) :x rotate-wrt)) |
| 488 |
(if (not (zerop rotate-y)) |
| 489 |
(send coord :rotate (deg2rad rotate-y) :y rotate-wrt)) |
| 490 |
(if (not (zerop rotate-z)) |
| 491 |
(send coord :rotate (deg2rad rotate-z) :z rotate-wrt)) |
| 492 |
(send self :flush-all) |
| 493 |
) |
| 494 |
(:set-translate-wrt |
| 495 |
(value &optional item event) (setq translate-wrt value) |
| 496 |
(if (eq value 'wrt) (setq translate-wrt wrt))) |
| 497 |
(:set-translate-to |
| 498 |
(value &optional item event) (setq translate-to value) |
| 499 |
(if (eq value 'wrt) (setq translate-to wrt))) |
| 500 |
(:set-translate-x (value &optional item event) (setq translate-x value)) |
| 501 |
(:set-translate-y (value &optional item event) (setq translate-y value)) |
| 502 |
(:set-translate-z (value &optional item event) (setq translate-z value)) |
| 503 |
(:rotate (&optional item event) |
| 504 |
(send self :erase-all) |
| 505 |
(send coord :rotate-with-rotation |
| 506 |
(rpy-matrix |
| 507 |
(deg2rad rotate-z) |
| 508 |
(deg2rad rotate-y) |
| 509 |
(deg2rad rotate-x)) |
| 510 |
rotate-wrt rotate-to) |
| 511 |
(send self :flush-all)) |
| 512 |
(:set-rotate-wrt |
| 513 |
(value &optional item event) (setq rotate-wrt value) |
| 514 |
(if (eq value 'wrt) (setq rotate-wrt wrt))) |
| 515 |
(:set-rotate-to |
| 516 |
(value &optional item event) (setq rotate-to value) |
| 517 |
(if (eq value 'wrt) (setq rotate-to wrt))) |
| 518 |
(:set-rotate-x (value &optional item event) (setq rotate-x value)) |
| 519 |
(:set-rotate-y (value &optional item event) (setq rotate-y value)) |
| 520 |
(:set-rotate-z (value &optional item event) (setq rotate-z value)) |
| 521 |
;;; |
| 522 |
(:transform |
| 523 |
(&optional item event) |
| 524 |
(send self :erase-all) |
| 525 |
(send coord :transform |
| 526 |
(instance coordinates :init |
| 527 |
:rpy (list |
| 528 |
(deg2rad rotate-z) |
| 529 |
(deg2rad rotate-y) |
| 530 |
(deg2rad rotate-x)) |
| 531 |
:pos (float-vector |
| 532 |
translate-x translate-y translate-z)) |
| 533 |
transform-wrt) |
| 534 |
(send self :flush-all)) |
| 535 |
(:transform-with-coordinates |
| 536 |
(&optional item event) |
| 537 |
(send self :erase-all) |
| 538 |
(send coord :transform-with-coordinates |
| 539 |
(instance coordinates :init |
| 540 |
:rpy (list |
| 541 |
(deg2rad rotate-z) |
| 542 |
(deg2rad rotate-y) |
| 543 |
(deg2rad rotate-x)) |
| 544 |
:pos (float-vector |
| 545 |
translate-x translate-y translate-z)) |
| 546 |
transform-wrt |
| 547 |
transform-to) |
| 548 |
(send self :flush-all)) |
| 549 |
(:transform-to |
| 550 |
(&optional item event) |
| 551 |
(send self :erase-all) |
| 552 |
(send coord :transform-to |
| 553 |
(instance coordinates :init |
| 554 |
:rpy (list |
| 555 |
(deg2rad rotate-z) |
| 556 |
(deg2rad rotate-y) |
| 557 |
(deg2rad rotate-x)) |
| 558 |
:pos (float-vector |
| 559 |
translate-x translate-y translate-z)) |
| 560 |
transform-to) |
| 561 |
(send self :flush-all)) |
| 562 |
(:set-transform-wrt |
| 563 |
(value &optional item event) (setq transform-wrt value) |
| 564 |
(if (eq value 'wrt) (setq transform-wrt wrt))) |
| 565 |
(:set-transform-to |
| 566 |
(value &optional item event) (setq transform-to value) |
| 567 |
(if (eq value 'wrt) (setq transform-to wrt))) |
| 568 |
;;; |
| 569 |
(:axis-length (value &optional item event) |
| 570 |
(send self :erase-all) |
| 571 |
(setq axis-length value) |
| 572 |
(send self :flush-all) |
| 573 |
) |
| 574 |
(:left-right |
| 575 |
(value &optional item event) |
| 576 |
(send self :erase-all) |
| 577 |
(send apickport :viewing :lookaround |
| 578 |
(deg2rad (- left-right-angle value)) |
| 579 |
0) |
| 580 |
(send self :flush-all) |
| 581 |
(setq left-right-angle value) |
| 582 |
) |
| 583 |
(:up-down |
| 584 |
(value &optional item event) |
| 585 |
(send self :erase-all) |
| 586 |
(send apickport :viewing :lookaround 0 |
| 587 |
(deg2rad (- up-down-angle value))) |
| 588 |
(send self :flush-all) |
| 589 |
(setq up-down-angle value) |
| 590 |
) |
| 591 |
) |
| 592 |
(defun coordmenu (&optional (type cascaded-coords)) |
| 593 |
(if (eq type t) |
| 594 |
(setq *coordinates* coordinates) |
| 595 |
(setq *coordinates* type)) |
| 596 |
(setq *coordmenu* (instance coordmenu :init)) |
| 597 |
) |
| 598 |
(format t "(coordmenu) ;; main of coordview.l~%") |
| 599 |
|