From b799a8c3a5c4df08dc633971fb1c933fe6f73255 Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Mon, 27 Jul 2009 17:48:11 +0200 Subject: [PATCH] change distance calculation --- tuioinput.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tuioinput.py b/tuioinput.py index 33cf8bc..669e04f 100644 --- a/tuioinput.py +++ b/tuioinput.py @@ -33,7 +33,7 @@ CURSOR_ACTIVATE_DELAY = .01 CURSOR_UPGRADE_DELAY = .5 CURSOR_STOP_DELAY = .5 -CURSOR_NEIGHBOR_DISTANCE = .2 +CURSOR_NEIGHBOR_DISTANCE = .1 try: import numptyphysics @@ -91,7 +91,7 @@ class NumptyCursor(object): self.deactivate_at = time.time()+CURSOR_STOP_DELAY def is_near(self, x, y): - return ((x-self.x)**2 + (y-self.y)**2)**.5 < CURSOR_NEIGHBOR_DISTANCE + return ((x-self.x)**2 + (y-self.y)**2) < CURSOR_NEIGHBOR_DISTANCE**2 def move(self, x, y): if self.activated and not self.deactivated: -- 2.11.4.GIT