From 353ab16db64c86122c0fcb9e1852b85c14b354b8 Mon Sep 17 00:00:00 2001 From: Russell Cohen Date: Fri, 3 Dec 2010 04:20:17 -0500 Subject: Speed optimizations abound! Caching on parameter validation, Binary searching for light locations in pixel mappers, actual thread safety for inputs means we don't drop them randomly, anymore. Caching on PixelStates to reduce multi-renderer costs + a short circuit to speed up processing on pixels that are turned off. --- pixelmappers/GaussianMapper.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'pixelmappers') diff --git a/pixelmappers/GaussianMapper.py b/pixelmappers/GaussianMapper.py index 552f5c9..1cf9e88 100644 --- a/pixelmappers/GaussianMapper.py +++ b/pixelmappers/GaussianMapper.py @@ -3,11 +3,14 @@ import Util class GaussianMapper(PixelMapper): def mappingFunction(self, eventLocation, screen): returnPixels = [] - for pixel in screen: + [x,y] = eventLocation + for (x,pixel) in screen.pixelsInRange(x-self['CutoffDist'], \ + x+self['CutoffDist']): pixelDist = Util.dist(pixel.location, eventLocation) if pixelDist < self['CutoffDist']: w = Util.gaussian(pixelDist, self['Height'], 0, self['Width']) if w>1: - pdb.set_trace() + #pdb.set_trace() + pass returnPixels.append((pixel, w)) return returnPixels -- cgit v1.2.3