ee9jan@gdt.bath.ac.uk (J A Nicholls) (05/02/91)
Does anybody know of any equations that will approximate to a colour spectrum ? I am trying to generate a simulated spectrum based on temperature, ie 0 degrees = Blue, 100 degrees = red with the intermediate temperatures being shown by the appropriate colour of the spectrum. The format is in 24 bit raw bitmap so I need an equation for each of the RGB components. At the moment I am using the following equations :- R = (char)(temp>=50.0 ? 255.0*(temp/50-1) : 0) G = (char)(temp<=50.0 ? 255.0*(temp/50) : 255.0*(2-temp/50)) B = (char)(temp<=50.0 ? 255.0*(1-temp/50) : 0) to calculate a value for each colour from 0 to 255. This does produce a 'spectrum' but it looks very false also it doesn't seem to develop the secondary colours at all well. Any help appreciated. Jez. -- Jez Nicholls <ee9jan@gdt.bath.ac.uk> "Marmalade, I like marmalade.", "Ooh me flakes." #include "disclaimer.h" These quotes courtesy of Alan. (APB AHM PF 1971)