From 4b5d9c633bd01ce8b2819d92eaf3e01d881fb996 Mon Sep 17 00:00:00 2001 From: Anthony LaTorre Date: Mon, 12 Sep 2011 12:17:55 -0400 Subject: fix space navigator controls. --- camera.py | 21 ++++++++------------- 1 file 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) -- cgit