POV-Ray : Newsgroups : povray.general : eval_pigment? : Re: eval_pigment? Server Time
29 Mar 2024 04:20:17 EDT (-0400)
  Re: eval_pigment?  
From: Tor Olav Kristensen
Date: 20 Nov 2022 18:45:00
Message: <web.637abb91287863e9d3631ec089db30a9@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> "Leroy" <whe### [at] gmailcom> wrote:
> > Related to the post above.. Why was eval_pigment dropped? Why not expand it?
> > If not kept as a built in function, why not put it in one of the include files?
> >
> > Have Fun?
>
> eval_pigment is a macro in the functions.inc file.
>
> It is, as has been pointed out in the past, simply a wrapper for a pigment
> function.
>
>
> #macro eval_pigment(pigm, vec)
>     #local fn = function { pigment { pigm } }
>     #local result = (fn(vec.x, vec.y, vec.z));
>     result
> #end
>
> You plug in your <x, y, z> vector, and out pops the <r, g, b> color vector at
> that point in the pattern, image_map, etc.

Hi

Naming functions is often problematic.
So suggest that that macro is rewritten, e.g. like this:


#include "vectors.inc"  // https://github.com/t-o-k/Useful-POV-Ray-macros


#macro EvalPigment(Pigment, v0)

    FunctionValue(
        function {
            pigment { Pigment }
        },
        v0
    )

#end // macro EvalPigment


--
Tor Olav
http://subcube.com
https://github.com/t-o-k


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.