POV-Ray : Newsgroups : povray.general : how to call multiple instances of a macro? : how to call multiple instances of a macro? Server Time
30 Jul 2024 12:20:05 EDT (-0400)
  how to call multiple instances of a macro?  
From: [GDS|Entropy]
Date: 15 Feb 2009 08:51:52
Message: <49981df8$1@news.povray.org>
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?

I think the #declare is to blame, but it is also what makes it work...catch 
22?

It is terribly annoying.

#declare Sp = 60;

#macro randVector(ctr,Min,Max,Method)
 #local i=0;
 #while (i<ctr)
  #switch (Method)
   #case (0)
    #declare randVectArray[i] = <RRand(RsA, Min, Max),RRand(RsA, Min, 
Max),RRand(RsA, Min, Max)>;
   #break
   #case (1)
    #declare randVectArray[i] = <sin(RRand(RsA, Min, Max)),RRand(RsA, Min, 
Max),tan(RRand(RsA, Min, Max))>;
   #break
   #case (2)
    #declare randVectArray[i] = <sin(RRand(RsA, Min, Max)),atanh(RRand(RsA, 
Min, Max)),tan(RRand(RsA, Min, Max))>;
   #break
   #case (3)
    #declare randVectArray[i] = <asin(RRand(RsA, Min, Max)),atanh(RRand(RsA, 
Min, Max)),tan(RRand(RsA, Min, Max))>;
   #break
   #case (4)
    #declare randVectArray[i] = <acosh(RRand(RsA, Min, 
Max)),asinh(RRand(RsA, Min, Max)),tan(RRand(RsA, Min, Max))>;
   #break
   #case (5)
    #declare randVectArray[i] = <cos(i),i,sin(i)>;
   #break
  #end
 #set i=i+1;
 #end
#end

#declare randVectArray = array [Sp];

thanks!
ian


Post a reply to this message

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