PaletteOptimiser

Change of optimiser.py

25:5d600ea41889
optimiser.py
     1.1 --- a/optimiser.py	Thu Oct 01 12:50:55 2015 +0200
     1.2 +++ b/optimiser.py	Thu Oct 01 17:34:38 2015 +0200
     1.3 @@ -21,13 +21,7 @@
     1.4      return distance(rgb, (0, 0, 0))
     1.5  
     1.6  def factor(start, end, rgb):
     1.7 -    r1, g1, b1 = start
     1.8 -    r2, g2, b2 = end
     1.9 -    gr, gg, gb = r2 - r1, g2 - g1, b2 - b1
    1.10 -    r, g, b = rgb
    1.11 -    pr, pg, pb = r - r1, g - g1, b - b1
    1.12 -    dp = pr * gr + pg * gg + pb * gb
    1.13 -    return dp / pow(distance(start, end), 2)
    1.14 +    return distance(start, rgb) / (distance(start, rgb) + distance(rgb, end))
    1.15  
    1.16  def darklight(rgb1, rgb2):
    1.17      if brightness(rgb1) <= brightness(rgb2):