blob: c82f243ed5d4f0d379a79d26795c79d60539f5d4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
from operationscore.PixelMapper import *
import util.Geo as Geo
class GaussianMapper(PixelMapper):
def mappingFunction(self, eventLocation, screen):
returnPixels = [] #TODO: consider preallocation and trimming
[x,y] = eventLocation
potentialPixels = screen.pixelsInRange(x-self.CutoffDist, \
x+self.CutoffDist)
for (x,pixel) in screen.pixelsInRange(x-self.CutoffDist, \
x+self.CutoffDist):
pixelDist = Geo.dist(pixel.location, eventLocation)
if pixelDist < self.CutoffDist:
w = Geo.gaussian(pixelDist, self.Height, 0, self.Width)
if w > self.MinWeight:
returnPixels.append((pixel, w))
return returnPixels
|