Changeset 3485 for trunk/gui/scripts/flowvisviewer.tcl
- Timestamp:
- Mar 11, 2013, 5:56:08 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/flowvisviewer.tcl
r3478 r3485 125 125 126 126 private variable _arcball "" 127 private variable _useArcball 1128 127 private variable _dlist "" ;# list of data objects 129 128 private variable _allDataObjs … … 224 223 qy 0.353553 225 224 qz 0.146447 226 theta 45227 phi 45228 psi 0229 225 zoom 1.0 230 226 pan-x 0 … … 244 240 $this-qy $_view(qy) 245 241 $this-qz $_view(qz) 246 $this-theta $_view(theta)247 $this-phi $_view(phi)248 $this-psi $_view(psi)249 242 $this-zoom $_view(zoom) 250 243 $this-pan-x $_view(pan-x) … … 956 949 array set _view $location 957 950 } 958 set _settings($this-theta) $_view(theta) 959 set _settings($this-phi) $_view(phi) 960 set _settings($this-psi) $_view(psi) 951 set _settings($this-qw) $_view(qw) 952 set _settings($this-qx) $_view(qx) 953 set _settings($this-qy) $_view(qy) 954 set _settings($this-qz) $_view(qz) 961 955 set _settings($this-pan-x) $_view(pan-x) 962 956 set _settings($this-pan-y) $_view(pan-y) 963 957 set _settings($this-zoom) $_view(zoom) 964 set xyz [Euler2XYZ $_view(theta) $_view(phi) $_view(psi)] 965 SendCmd "camera angle $xyz" 958 set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)] 959 $_arcball quaternion $q 960 SendCmd "camera orient $q" 961 #SendCmd "camera reset" 966 962 PanCamera 967 963 SendCmd "camera zoom $_view(zoom)" … … 1254 1250 set _settings($this-qy) $_view(qy) 1255 1251 set _settings($this-qz) $_view(qz) 1256 set _settings($this-theta) $_view(theta)1257 set _settings($this-phi) $_view(phi)1258 set _settings($this-psi) $_view(psi)1259 1252 set _settings($this-pan-x) $_view(pan-x) 1260 1253 set _settings($this-pan-y) $_view(pan-y) 1261 1254 set _settings($this-zoom) $_view(zoom) 1262 1255 1263 if {$_useArcball} { 1264 set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)] 1265 $_arcball quaternion $q 1266 SendCmd "camera orient $q" 1267 } else { 1268 set xyz [Euler2XYZ $_view(theta) $_view(phi) $_view(psi)] 1269 SendCmd "camera angle $xyz" 1270 } 1256 set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)] 1257 $_arcball quaternion $q 1258 SendCmd "camera orient $q" 1259 #SendCmd "camera reset" 1271 1260 PanCamera 1272 1261 SendCmd "camera zoom $_view(zoom)" … … 1352 1341 set _view(zoom) [expr {$_view(zoom)*1.25}] 1353 1342 set _settings($this-zoom) $_view(zoom) 1343 SendCmd "camera zoom $_view(zoom)" 1354 1344 } 1355 1345 "out" { 1356 1346 set _view(zoom) [expr {$_view(zoom)*0.8}] 1357 1347 set _settings($this-zoom) $_view(zoom) 1348 SendCmd "camera zoom $_view(zoom)" 1358 1349 } 1359 1350 "reset" { … … 1363 1354 qy 0.353553 1364 1355 qz 0.146447 1365 theta 451366 phi 451367 psi 01368 1356 zoom 1.0 1369 1357 pan-x 0 … … 1376 1364 } 1377 1365 } 1378 if {$_useArcball} { 1379 set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)] 1380 $_arcball quaternion $q 1381 SendCmd "camera orient $q" 1382 } else { 1383 set xyz [Euler2XYZ $_view(theta) $_view(phi) $_view(psi)] 1384 SendCmd "camera angle $xyz" 1385 } 1386 PanCamera 1366 set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)] 1367 $_arcball quaternion $q 1368 SendCmd "camera orient $q" 1369 #SendCmd "camera reset" 1370 SendCmd "camera zoom $_view(zoom)" 1387 1371 set _settings($this-qw) $_view(qw) 1388 1372 set _settings($this-qx) $_view(qx) 1389 1373 set _settings($this-qy) $_view(qy) 1390 1374 set _settings($this-qz) $_view(qz) 1391 set _settings($this-theta) $_view(theta)1392 set _settings($this-phi) $_view(phi)1393 set _settings($this-psi) $_view(psi)1394 1375 set _settings($this-pan-x) $_view(pan-x) 1395 1376 set _settings($this-pan-y) $_view(pan-y) … … 1397 1378 } 1398 1379 } 1399 SendCmd "camera zoom $_view(zoom)"1400 1380 } 1401 1381 … … 1422 1402 set _click(x) $x 1423 1403 set _click(y) $y 1424 set _click(theta) $_view(theta)1425 set _click(phi) $_view(phi)1426 1404 } 1427 1405 drag { … … 1443 1421 } 1444 1422 1445 if {$_useArcball} { 1446 set q [$_arcball rotate $x $y $_click(x) $_click(y)] 1447 foreach { _view(qw) _view(qx) _view(qy) _view(qz) } $q break 1448 set _settings($this-qw) $_view(qw) 1449 set _settings($this-qx) $_view(qx) 1450 set _settings($this-qy) $_view(qy) 1451 set _settings($this-qz) $_view(qz) 1452 SendCmd "camera orient $q" 1453 } else { 1454 # 1455 # Rotate the camera in 3D 1456 # 1457 if {$_view(psi) > 90 || $_view(psi) < -90} { 1458 # when psi is flipped around, theta moves backwards 1459 set dy [expr {-$dy}] 1460 } 1461 set theta [expr {$_view(theta) - $dy*180}] 1462 while {$theta < 0} { set theta [expr {$theta+180}] } 1463 while {$theta > 180} { set theta [expr {$theta-180}] } 1464 1465 if {abs($theta) >= 30 && abs($theta) <= 160} { 1466 set phi [expr {$_view(phi) - $dx*360}] 1467 while {$phi < 0} { set phi [expr {$phi+360}] } 1468 while {$phi > 360} { set phi [expr {$phi-360}] } 1469 set psi $_view(psi) 1470 } else { 1471 set phi $_view(phi) 1472 set psi [expr {$_view(psi) - $dx*360}] 1473 while {$psi < -180} { set psi [expr {$psi+360}] } 1474 while {$psi > 180} { set psi [expr {$psi-360}] } 1475 } 1476 1477 set _view(theta) $theta 1478 set _view(phi) $phi 1479 set _view(psi) $psi 1480 set xyz [Euler2XYZ $theta $phi $psi] 1481 set _settings($this-theta) $_view(theta) 1482 set _settings($this-phi) $_view(phi) 1483 set _settings($this-psi) $_view(psi) 1484 SendCmd "camera angle $xyz" 1485 } 1423 set q [$_arcball rotate $x $y $_click(x) $_click(y)] 1424 foreach { _view(qw) _view(qx) _view(qy) _view(qz) } $q break 1425 set _settings($this-qw) $_view(qw) 1426 set _settings($this-qx) $_view(qx) 1427 set _settings($this-qy) $_view(qy) 1428 set _settings($this-qz) $_view(qz) 1429 SendCmd "camera orient $q" 1486 1430 1487 1431 set _click(x) $x … … 2443 2387 $inner configure -borderwidth 4 2444 2388 2445 if {$_useArcball} { 2446 set labels { qw qx qy qz pan-x pan-y zoom } 2447 } else { 2448 set labels { phi theta psi pan-x pan-y zoom } 2449 } 2389 set labels { qw qx qy qz pan-x pan-y zoom } 2450 2390 set row 0 2451 2391 foreach tag $labels { … … 2669 2609 set _view($who) $_settings($this-$who) 2670 2610 PanCamera 2671 }2672 "phi" - "theta" - "psi" {2673 set _view($who) $_settings($this-$who)2674 set xyz [Euler2XYZ $_view(theta) $_view(phi) $_view(psi)]2675 SendCmd "camera angle $xyz"2676 if {$_useArcball} {2677 $_arcball euler [list [expr {-[lindex $xyz 2]}] [expr {-[lindex $xyz 1]}] [expr {-[lindex $xyz 0]}]]2678 set q [$_arcball quaternion]2679 foreach { _view(qw) _view(qx) _view(qy) _view(qz) } $q break2680 set _settings($this-qw) $_view(qw)2681 set _settings($this-qx) $_view(qx)2682 set _settings($this-qy) $_view(qy)2683 set _settings($this-qz) $_view(qz)2684 }2685 2611 } 2686 2612 "qx" - "qy" - "qz" - "qw" {
Note: See TracChangeset
for help on using the changeset viewer.