Commit d1b47d4a951f79c42f55c3128055563f83fd09f7

Authored by Anthex
1 parent 506462f3

fix mapping from values to images, now works with steps/emitters that are out of…

… bounds compared to the initial situation
Showing 2 changed files with 2 additions and 2 deletions   Show diff stats
@@ -299,5 +299,5 @@ def NLateration(data, step=.1, xSize=0.0, ySize=0.0, zSize=0.0): @@ -299,5 +299,5 @@ def NLateration(data, step=.1, xSize=0.0, ySize=0.0, zSize=0.0):
299 minDist = d 299 minDist = d
300 minLoc = Location(round(k,2),round(l,2),round(m,2)) 300 minLoc = Location(round(k,2),round(l,2),round(m,2))
301 d = (max(1-d/10.0, 0))**2 301 d = (max(1-d/10.0, 0))**2
302 - imageArray[floor(m*revStep)].append((265-floor(360-d*360), 255, floor(50+d*200))) 302 + imageArray[floor(m*revStep)].append((265-floor(d*360), 255, floor(50+d*200)))
303 return (minLoc, minDist, imageArray[0], floor(xSize*revStep), floor(ySize*revStep), imageArray) 303 return (minLoc, minDist, imageArray[0], floor(xSize*revStep), floor(ySize*revStep), imageArray)
@@ -2,7 +2,7 @@ from structure import NLateration, Location @@ -2,7 +2,7 @@ from structure import NLateration, Location
2 from math import floor, sqrt 2 from math import floor, sqrt
3 from PIL import Image, ImageDraw 3 from PIL import Image, ImageDraw
4 4
5 -global_step=.05 5 +global_step=.1
6 dataset = [(Location(.5,.5,.5), 3.0), (Location(4.0,.0,.0), 2.0), (Location(4.0,5.0,5.0), 4.2)] 6 dataset = [(Location(.5,.5,.5), 3.0), (Location(4.0,.0,.0), 2.0), (Location(4.0,5.0,5.0), 4.2)]
7 NLat_result = NLateration(dataset, step=global_step) 7 NLat_result = NLateration(dataset, step=global_step)
8 W,H = NLat_result[3], NLat_result[4] 8 W,H = NLat_result[3], NLat_result[4]