aboutsummaryrefslogtreecommitdiff
path: root/pixelmappers
diff options
context:
space:
mode:
authorGravatar Russell Cohen <rcoh@mit.edu>2010-11-26 00:07:14 -0500
committerGravatar Russell Cohen <rcoh@mit.edu>2010-11-26 00:07:14 -0500
commit9c9babfa7032b443138c4b457aabaf79fad385b3 (patch)
treef9bf3e8b51423bf6769d2c655ffa15d81a42333f /pixelmappers
parent1754a1f4511ef52f0a093dd0f9915196bd4261e7 (diff)
Add PixelMapper functionality to abstract away from mapping locations->Pixels.
Diffstat (limited to 'pixelmappers')
-rw-r--r--pixelmappers/SimpleMapper.py14
-rw-r--r--pixelmappers/__init__.py0
2 files changed, 14 insertions, 0 deletions
diff --git a/pixelmappers/SimpleMapper.py b/pixelmappers/SimpleMapper.py
new file mode 100644
index 0000000..7d730f1
--- /dev/null
+++ b/pixelmappers/SimpleMapper.py
@@ -0,0 +1,14 @@
+from operationscore.PixelMapper import *
+import Util
+class SimpleMapper(PixelMapper):
+ def mappingFunction(self, eventLocation, screen):
+ bestDist = 10**10 #don't kill me, I'm lazy
+ bestPixel = None
+ for pixel in screen:
+ pixelDist = Util.dist(pixel.location, eventLocation)
+ if pixelDist < bestDist:
+ bestPixel = pixel
+ bestDist = pixelDist
+ return [(bestPixel,1)]
+
+
diff --git a/pixelmappers/__init__.py b/pixelmappers/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/pixelmappers/__init__.py