POV-Ray : Newsgroups : povray.general : how to call multiple instances of a macro? : Re: how to call multiple instances of a macro? Server Time
30 Jul 2024 12:23:23 EDT (-0400)
  Re: how to call multiple instances of a macro?  
From: [GDS|Entropy]
Date: 15 Feb 2009 12:06:25
Message: <49984b91$1@news.povray.org>
Ahhh...

That makes sense, now that I see it.

Would one be able to pass signs (+ - / *), isosurface function names and 
things like atan and sin in some manner as that as well?

I've been trying to do something like this: (pardon the crapcode)
#macro isoFunction(operator, funcName, xVal, yVal, zVal, P0, P1, P2, P3, P4, 
P5, P6)
 #local isoFunc = function {operator((funcName(xVal*x, xVal*y, zVal*z))};
 isoFunc(x,y,z)
#end

#declare foo = isoFunction(x+,f_noise3d,5,5,0.1,0,0,0,0,0,0);

No joy obviously.

You wouldn't happen to know if it is possible to concat strings as variable 
names, would you? #local myObj = concat(obj + i); would be great... :-D

Thanks!
ian

"Christian Froeschlin" <chr### [at] chrfrde> wrote in message 
news:49984095@news.povray.org...
> [GDS|Entropy] wrote:
>> I have the following macro, but I can't call multiple instances of it 
>> without overriding the previous values...how can I rewrite this macro to 
>> fix this?
>
> Try something like this:
>
> #macro Fill(A,N)
>   #local i = 0;
>   #while (i < N)
>     #declare A[i] = i;
>     #local i = i + 1;
>   #end
> #end
>
> #declare Sp = 60;
> #declare randVectArray = array[Sp];
> Fill(randVectArray, Sp)
>
> #declare Sp2 = 50;
> #declare randVectArray2 = array[Sp2];
> Fill(randVectArray2, Sp2)
>


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.