|
|
On Fri, 30 Oct 1998 17:00:01 +0000, Michael Andrews
<M.C### [at] remove-thisreadingacuk> wrote:
> One patch I made to my v3.02 code was an "evaluate" function which took a
>declared isosurface function and a position vector, returning the value of the
>function at that position. I am not sure if I still have a copy of this, but I
>remember it being quite a simple to patch to implement, mostly an extra function
>in the expression parsing code.
I'm not sure you'd even need an explicit "evaluate" function. It seems
you could just automatically evaluate an isosurface function if presented
with its name:
#declare myvec=<1,2,0>;
#declare myfunc=function{sin(x)*cos(y)}
#declare myval=myfunc(myvec);
This is just a tiny patch to the code in express.c, and without any
confusing syntactical overhead for the user. (Probably faster than
a macro, too, where either would be acceptable... hmm... )
> I was going to try extending this to return values for any texture pattern,
>but v3.1 betas started ariving and I got very sidetracked ... Thinking about it,
>it may be easier in v3.1 - the relavent code to get a pattern value must be in
>several places, so all that's needed is a wrapper function in the expression
>parser? I'll try to peruse the SuperPatch source and see if I can put a
>patchette together this weekend :-)
The colo[u]r_at( pigment, vector ) function is something I've been
toying with adding as well. It is very easy; the compute_pigment
function in pigment.c does exactly what you need. All you need to
do is call it with the appropriate parameters.
You could also forgo the colo[u]r_at (evaluate, whatever) token by
extending the syntax to allow
#declare center=<5,3,2>;
#declare radius=1;
#declare mypigment=pigment{...}
sphere { center, radius texture {pigment {color mypigment(center)}}}
but I'm not sure whether it would make sense to the average user to
see a pigment evaluated at a point like this. Any comments?
Post a reply to this message
|
|