POV-Ray : Newsgroups : povray.general : eval_pigment? : Re: eval_pigment? Server Time
26 Nov 2022 03:50:41 EST (-0500)
  Re: eval_pigment?  
From: Leroy
Date: 23 Nov 2022 23:05:00
Message: <web.637eec67287863e9714dcffbf712fc00@news.povray.org>
"Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:
> "Leroy" <whe### [at] gmailcom> wrote:
>
> >...
>
> >  Now that's taken care of, While I was waiting for replies, I wrote my own
> > 'Eval_pigment' & 'Eval_Cmap' &'Eval_ObjPig' macros.
>
> >...
>
> > #macro Eval_Obj_Pig(Obj,Pig,N)
> >   #local Mx=max_extent(Obj);
> >   #local Mn=min_extent(Obj);
> >   #local Mc=(Mx+Mn)/2;
> >  #local Norm = <0, 0, 0>;
> >  #local Start =vlength(Mx-Mn)*N+Mc;
> >  #local V = trace (Obj,Start,-N,Norm );
> >  #if (Norm.x != 0 | Norm.y != 0 | Norm.z != 0)
> >   #local Fna=function{pigment{Pig}}
> >   #local R=Fna(V.x,V.y,V.z);
> >  #else
> >   #local R=<0,0,0>;// default color
> >  #end
> >
> >  R
> >
> > #end
>
> Hi Leroy
>
> If you want a faster macro then you'll probably find that this statement:
>
>     #if (vlength(Norm) > 0)
>
> executes faster (and is easier to read) than this:
>
>     #if (Norm.x != 0 | Norm.y != 0 | Norm.z != 0)
>
>
> --
> Tor Olav
> http://subcube.com
> https://github.com/t-o-k

Yes I know got lazy & use trace from
the insert that came with POV3.7 win


Post a reply to this message

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