|
|
Am 20.12.2010 07:49, schrieb TheBigH:
> Why does this not work? It complains that I need to initialize X and Y before I
> call them in the macro Fracp, but since I am passing them as parameters to the
> function Gridd this would obviously be inappropriate. I have also tried changing
> the macro into another function, but that doesn't work either.
>
>
> #declare thick=0.05;
> #macro Fracp(A)
> A-floor(A)
> #end
> #declare Gridd = function( X, Y ) {
> #if ( Fracp(X)<thick | Fracp(X)>(1-thick) | Fracp(Y)<thick | Fracp(Y)>(1-thick)
> )
> 1
> #else
> 0
> #end
> }
Note that "#" statements are always evaluated at parsing time, even when
used in a function. Therefore, "#if" statements cannot be used to
perform tests inside functions at run-time.
You will need to use the "select" function to have the condition
evaluated each time the function is called.
Post a reply to this message
|
|