summaryrefslogtreecommitdiff
path: root/camera.py
diff options
context:
space:
mode:
authorStan Seibert <stan@mtrr.org>2011-09-13 16:10:04 -0400
committerStan Seibert <stan@mtrr.org>2011-09-13 16:10:04 -0400
commit4ab542a6f7e8dfbe6aeec2eb1b71176e2e851e75 (patch)
tree90a910177777115b6ef7ad2780b09ca69ff87109 /camera.py
parent1ed35a8420b73afa76c12c82f4aebc31132650d9 (diff)
parent6f0703602270d03f4025221f13fee21aa842a863 (diff)
downloadchroma-4ab542a6f7e8dfbe6aeec2eb1b71176e2e851e75.tar.gz
chroma-4ab542a6f7e8dfbe6aeec2eb1b71176e2e851e75.tar.bz2
chroma-4ab542a6f7e8dfbe6aeec2eb1b71176e2e851e75.zip
merge
Diffstat (limited to 'camera.py')
-rwxr-xr-xcamera.py21
1 files changed, 8 insertions, 13 deletions
diff --git a/camera.py b/camera.py
index 84c6231..af48735 100755
--- a/camera.py
+++ b/camera.py
@@ -593,30 +593,25 @@ class Camera(multiprocessing.Process):
accelerate_factor = 2.0
else:
accelerate_factor = 1.0
- #print 'raw:', spnav_event
- v1 = self.axis2
- v2 = self.axis1
- v3 = -np.cross(self.axis1,self.axis2)
+
+ v1 = self.axis1
+ v2 = self.axis2
+ v3 = np.cross(self.axis1,self.axis2)
- v = -v1*spnav_event.motion.x + v2*spnav_event.motion.y \
- + v3*spnav_event.motion.z
+ v = v2*spnav_event.motion.x + v1*spnav_event.motion.y + \
+ v3*spnav_event.motion.z
v *= self.scale / 5000.0 * accelerate_factor
- #print 'translate:', v
self.translate(v, redraw=False)
- axis = v1*spnav_event.motion.rx + -v2*spnav_event.motion.ry \
- + -v3*spnav_event.motion.rz
+ axis = -v2*spnav_event.motion.rx - v1*spnav_event.motion.ry - \
+ v3*spnav_event.motion.rz
- # Zero all but non-max values
- #axis[~(np.abs(axis) == np.abs(axis).max())] = 0
- #axis[np.abs(axis) < 15] = 0
if (axis != 0).any():
axis = axis.astype(float)
length = np.linalg.norm(axis)
angle = length * 0.0001 * accelerate_factor
axis /= length
- #print 'rotate:', angle, axis
self.rotate_around_point(angle, axis, self.point,
redraw=False)