Content deleted Content added
No edit summary |
No edit summary |
||
(49 intermediate revisions by the same user not shown) | |||
Line 93:
end
return wavelength_vis
end
local minAntiMagenta = 550
local maxAntiMagenta = 570
local function process_magenta(wavelength_abs)
local redvalue_RED
local bluevalue_RED
local greenvalue_RED
local redvalue_BLUE
local bluevalue_BLUE
local greenvalue_BLUE
local widthAntiMagenta = maxAntiMagenta - minAntiMagenta
local bias_BLUE = (wavelength_abs - minAntiMagenta)/widthAntiMagenta
local bias_RED = (maxAntiMagenta - wavelength_abs)/widthAntiMagenta
nm2RGB(700, false)
redvalue_RED = redvalue*bias_RED
bluevalue_RED = bluevalue*bias_RED
greenvalue_RED = greenvalue*bias_RED
nm2RGB(400, false)
redvalue_BLUE = redvalue*bias_BLUE
bluevalue_BLUE = bluevalue*bias_BLUE
greenvalue_BLUE = greenvalue*bias_BLUE
redvalue = 0.6+ 0.4*(redvalue_RED + redvalue_BLUE)
bluevalue = 0.7 + 0.3*(bluevalue_RED + bluevalue_BLUE)
greenvalue = greenvalue_RED + greenvalue_BLUE
end
Line 98 ⟶ 124:
-- this function returns the string "#RRGGBB" with approximate RGB value for a complementary color (reflection) to a color, defined as a wavelength passed as a first argument
local wavelength = tonumber(frame.args[1])
-- adding magentas to smoothen red->blue transition. Trying 540..570 nm
nm2RGB(absorption_to_visible(wavelength), false)▼
if (wavelength>=minAntiMagenta) and (wavelength<=maxAntiMagenta) then
process_magenta(wavelength)
▲ else nm2RGB(absorption_to_visible(wavelength), false)
end
local result='#' .. string.format("%.2X%.2X%.2X", 255*redvalue, 255*greenvalue, 255*bluevalue)
return result
|