Message: 10 Date: Mon, 11 Aug 2003 17:20:41 -0600 Subject: Re: Convert frequency to RGB From: Dar Scott <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED]
On Monday, August 11, 2003, at 04:43 PM, Jim Hurley wrote:
I think I have found what I need. I had hoped I could find an> algebraic formula for the translation from wavelength to rgb values. IThat should translate OK. As with yours, it changes only red, green ordid a Google search and found the following program; I will see if I can translate it into Transcript.
blue at a time, and thus will vary in intensity in ways not intended. The blue-purple looks like it goes too purple to me. The function does
attempt to put an envelope over the whole thing that is probably
related to sun intensity and eye response.
See how it looks.
Dar Scott
Dar,
Not very well. Still a bit jerky--in the literal sense. I may have to work on this for a while. I've seen some very nice graphics, I think it was in a web page construction application which had a rainbow-line as a demarker between sections.
I wonder if an image like this could be imported into RR and deciphered the RGB values from the image by running the wand (from the 1.1.1 color palette) over it and somehow extract this data.
I think I got the Pascal program translated correctly. It looks like this:
on mouseUP
repeat with wavelength = 779 down to 381
set the backgroundcolor of grc 1 to convertWavelength(wavelength)
wait 1 tick
end repeat
end mouseUPfunction convertWavelength w
switch
case w>380 and w <= 419
put .3 + .7*(w-380)/(420-380) into tFactor
put -tFactor*(w-440)/(440-380),0,tFactor into results
break
CASE w >419 and w <=440
put -(w-440)/(440-380),0,1 into results
break
case w > 440 and w <=490
put 0,(w-440)/(490-440),1 into results
break
case w> 490 and w <=510
put 0,1,-(w-510)/(510-490)into results
break
case w> 510 and w<=580
put (w-510)/(580-510),1,0 into results
break
case w>580 and w<= 645
put 1,-(w-645)/(645-580),0 into results
breakcase w >645 and w<=701
put 1,0,0 into results
break
case w>701 and w< 780
put 0.3 + 0.7*(780 - w)/(780 - 700) into tFactor
put tFactor,0,0 into results
break
end switch
repeat with i = 1 to 3
put round(255*(item i of results)) into item i of tResults
end repeatreturn tResults
end convertWavelength _______________________________________________ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
