|
![](/i/fill.gif) |
Wasn't it Woody who wrote:
>I'm trying to create two macros for use with Iso-surfaces
>they are
>
>#macro mac_1()
> #if(abs(x)+abs(y)<=0.05)
> 0
> #else
> 1
> #end
>#end
>
>#macro mac_2(a,b,c)
> abs(a)+abs(b)
>#end
>
>
>they are called from the isosurface as
>
>isosurface{
>function{ mac_1() }
>
>}
>
>isosurface{
>function { mac_2(x,y,z) }
>}
>
>both produce 'float expected vector identifier found instead' errors.
>
>anybody got any ideas
Macros are evaluated once, at parse time. Isosurface functions need to
be evaluated for many possible x,y,z values at run time. So you have to
rewrite your expressions as functions, not macros.
The second one is easy to write:
function { abs(x)+abs(y) }
The problem is that the expression is >=0 everywhere. It's only zero
along an infinitely thin line along the z axis, and you see nothing.
You could write mac_1 as
function { select ((abs(x)+abs(y)-0.05),1,0) }
but that doesn't produce any results either because the isosurface root
finder doesn't work well with functions that have an infinite gradient.
A different function that creates the same surface as that, but
evaluates differently at points that are not on the surface is
function { abs(x)+abs(y)-0.05 }
which renders quite nicely.
--
Mike Williams
Gentleman of Leisure
Post a reply to this message
|
![](/i/fill.gif) |