|
|
Wasn't it Max Ulbrich who wrote:
>Hi,
>
>I try to get a sum over an expression that contains data of an array. I
>try to use a macro for this purpose and later call this in the function
>part of the isosurface. In the part where I try to extract the x, y and
>z coordinates from the macro arguments something goes wrong. Although I
>do not get an error message, the x coordinate seems always to be 1.
>It seems as if x gets evaluated before the call of the macro. Actually I
>would prefer to get this done just when the call happens. My guess is
>that macro isn't the right solution. Who can help me?
I notice that this time you're not actually trying to index the arrays
at run time. You use atmx[0], which can be evaluated at parse time. So
in this case you can just write a loop inside your function definition
and it will all work.
It didn't produce anything very interesting when I ran it, but perhaps
that's because I didn't have very interesting values of vg, v50 or
atmx[0].
#declare F = function {
#local i=0;
#while (i<=arrcnt)
+(1-1/(1+exp(-(sqrt(pow((x-atmx[0])/vg,2)
+pow((y-atmy[0])/vg,2)
+pow((z-atmz[0])/vg,2))-v50/vg))))
#declare i=i+1;
#end
}
isosurface {
function{ 1 - F(x,y,z) }
contained_by {
box { <26,-27,22>,<37,-34,27> }
}
threshold 0.5
max_gradient 5
pigment {rgb x}
translate <-35,32,-24>
scale 0.4
}
Or, alternatively, instead of having a loop you can just multiply the
contained expression by arrcnt, since the expression evaluetes to the
same value for all values of "i".
--
Mike Williams
Gentleman of Leisure
Post a reply to this message
|
|