# HG changeset patch # User Paul Boddie # Date 1443713678 -7200 # Node ID 5d600ea41889b3f49afd601fc5588e43e683883f # Parent c768f24e5233faecb78a5fa97f1759bed9c2baac Experiment with calculating the dithering factor using the sum of the lengths of the vectors connecting the start colour to the end colour via the given colour. diff -r c768f24e5233 -r 5d600ea41889 optimiser.py --- a/optimiser.py Thu Oct 01 12:50:55 2015 +0200 +++ b/optimiser.py Thu Oct 01 17:34:38 2015 +0200 @@ -21,13 +21,7 @@ return distance(rgb, (0, 0, 0)) def factor(start, end, rgb): - r1, g1, b1 = start - r2, g2, b2 = end - gr, gg, gb = r2 - r1, g2 - g1, b2 - b1 - r, g, b = rgb - pr, pg, pb = r - r1, g - g1, b - b1 - dp = pr * gr + pg * gg + pb * gb - return dp / pow(distance(start, end), 2) + return distance(start, rgb) / (distance(start, rgb) + distance(rgb, end)) def darklight(rgb1, rgb2): if brightness(rgb1) <= brightness(rgb2):