diff --git a/README.md b/README.md index 204f015..6ada0d8 100644 --- a/README.md +++ b/README.md @@ -15,4 +15,6 @@ This program aims to compute the approximate location of a mobile terminal for a ## Annex : N-Lateration 3D visualisation visuals.py provides a cool function to graphically represent the N-Lateration distances in a 3D space by creating an animated gif (RMI style) ### Example -[Click here to view output gif example](https://dantz.fr/LO53/out.gif?) (too big to be displayed) +[Click here to view output gif example](https://dantz.fr/LO53/out_rgb.gif?) (too big to be displayed) + +[Or here for the shades of grey version](https://dantz.fr/LO53/out.gif?) (too big to be displayed) diff --git a/structure.py b/structure.py index 75a97b5..b6e7e64 100644 --- a/structure.py +++ b/structure.py @@ -297,5 +297,6 @@ def NLateration(data, step=.1, xSize=0.0, ySize=0.0, zSize=0.0): if d < minDist: minDist = d minLoc = Location(round(k,2),round(l,2),round(m,2)) - imageArray[floor(l*10)].append(d*10+255-min(10+exp(d*2),255)) + d = (max(1-d/10.0, 0))**2 + imageArray[floor(l*10)].append((250-floor(360-d*360), 255, floor(50+d*200))) return (minLoc, minDist, imageArray[0], floor(ySize/step), floor(xSize/step), imageArray) diff --git a/visuals.py b/visuals.py index e8f7b85..70e3d62 100644 --- a/visuals.py +++ b/visuals.py @@ -6,9 +6,10 @@ dataset = [(Location(.5,.5,.5), 3.0), (Location(4.0,.0,.0), 2.0), (Location(4.0, NLat_result = NLateration(dataset) W,H = NLat_result[3], NLat_result[4] frames = [] +dummy = [0 for _ in range(len(NLat_result[5][0]))] def createFrame(x,y,nbr): - img = Image.new("L",(x,y)) + img = Image.new("HSV",(x,y)) img.putdata(NLat_result[5][nbr]) return img @@ -22,4 +23,3 @@ def exportGif(): frames[0].save("out.gif", format="GIF", append_images=frames[1:], save_all=True, duration=100, loop=0) print("gif exported") - -- libgit2 0.21.4