summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@member.fsf.org>2016-01-12 23:43:40 +0100
committerMattias Andrée <maandree@member.fsf.org>2016-01-12 23:43:40 +0100
commit6ac8df052ab2519f755240f71c2a6712453a54ba (patch)
tree6c87b34ed61f8d54ef494d70162e2cd1fe3b12e3 /src
parentm (diff)
downloadblueshift-6ac8df052ab2519f755240f71c2a6712453a54ba.tar.gz
blueshift-6ac8df052ab2519f755240f71c2a6712453a54ba.tar.bz2
blueshift-6ac8df052ab2519f755240f71c2a6712453a54ba.tar.xz
simple_whitepoint: truncate values
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
Diffstat (limited to 'src')
-rw-r--r--src/blackbody.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/blackbody.py b/src/blackbody.py
index 5f5bfc4..4974b7e 100644
--- a/src/blackbody.py
+++ b/src/blackbody.py
@@ -526,6 +526,9 @@ def simple_whitepoint(temperature):
g = 0.390081579 * math.log(temp) - 0.631841444
if temp < 66:
b = 0 if temp <= 19 else 0.543206789 * math.log(temp - 10) - 1.196254089
+ r = min(max(0, r), 1)
+ g = min(max(0, g), 1)
+ b = min(max(0, b), 1)
return (r, g, b)