|
![](/i/fill.gif) |
In article <3e4e5c2f@news.povray.org>,
"Andrew Coppin" <orp### [at] btinternet com> wrote:
> Suppose I declare a colour_map. Is there a way to read a colour out of the
> map? In other words, is there a way I can feed in a nindex value and find
> the corresponding colour?
>
> The docs say I can fetch the colour of a point out of a texture, but what
> I'm asking for is one step simpler than that... Any ideas folks?
Untested, but:
#macro make_cmap_fn(CMap)
#local CFn =
function {
pigment {function {x}
color_map {CMap}
}
}
function (tVal) {CFn(tVal, 0, 0)}
#end
#macro eval_cmap(T, CMap)
#local CFn =
function {
pigment {function {T}
color_map {CMap}
}
}
(CFn(0, 0, 0))
#end
#declare CFn = make_cmap_fn(MyCMap)
#declare CVal = CFn(0.35);
#declare CVal = eval_cmap(0.35, MyCMap);
--
Christopher James Huff <cja### [at] earthlink net>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tag povray org
http://tag.povray.org/
Post a reply to this message
|
![](/i/fill.gif) |