POV-Ray : Newsgroups : povray.binaries.images : recursion problems ?? : Re: recursion problems ?? Server Time
17 Aug 2024 14:14:50 EDT (-0400)
  Re: recursion problems ??  
From: Mike Williams
Date: 23 Sep 2001 03:30:51
Message: <xqinXBAi9Yr7Ewpw@econym.demon.co.uk>
Wasn't it Ryan Mooney who wrote:
>#macro Rec (current)     //define macro
>
>sphere { <0,0,0>, 0.75 pigment {rgb
>0.5}        //macro component
>translate <0,current*0.125,0>
>//squash by 0.125
>rotate 55*current*z        //wrap the
>compact line into spiral
> }
>
>#if(current < Max-1)        //if current
>< max recursion
>Rec(current+1)        //recursion and
>increment
>#end        //if
>
>#end        //mcro
>
>Ryan Mooney wrote:
>
>> new to macro, having problems... =[
>> simple macro to make a spiral out of
>> spheres...
>> It does not want to go above 98 max.
>> recursive level...
>> Why... ??

That's the limit of recursive macros. You'll have to use a loop instead
of recursion if you want to go further. Something like this:-

#macro Rec (Max)// Parameter is now the number of spheres required
  #local current=0;
  #while (current < Max-1)
    sphere { <0,0,0>, 0.75 pigment {rgb 0.5}
    translate <0,current*0.125,0>
    rotate 55*current*z
    }
    #declare current = current+1;
  #end //while
#end //macro

Rec(300)


-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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