|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Woody wrote:
> I'm trying to create two macros for use with Iso-surfaces
> they are
RTFM: <http://www.povray.org/documentation/view/3.6.1/231/>
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Mike Williams nous apporta ses lumieres en ce 2007/11/13 15:01:
> 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.
It's only a problem if your treshold is zero. If you increase the treshold, it
gets whider and whider.
>
>
--
Alain
-------------------------------------------------
I find that the harder I work, the more luck I seem to have.
Thomas Jefferson
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Thorsten Froehlich <tho### [at] trfde> wrote:
> RTFM: <http://www.povray.org/documentation/view/3.6.1/231/>
By the way: Is there a good reason, why function variables may
not be passed to macros? I use to think that Woody's mac_2
example and such are quite sensible.
Mark Weyer
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |