POV-Ray : Newsgroups : povray.binaries.images : recursion problems ?? Server Time
17 Aug 2024 16:16:12 EDT (-0400)
  recursion problems ?? (Message 1 to 3 of 3)  
From: Ryan Mooney
Subject: recursion problems ??
Date: 23 Sep 2001 02:33:54
Message: <3BAD8574.A4E4F6B0@earthlink.net>
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... ??

Q?
How to get the spiral to extend to
the edge... By means of the macro...
??


Post a reply to this message


Attachments:
Download 'reck.jpg' (8 KB)

Preview of image 'reck.jpg'
reck.jpg


 

From: Ryan Mooney
Subject: Re: recursion problems ??
Date: 23 Sep 2001 02:36:46
Message: <3BAD8625.78FDA717@earthlink.net>
Oops =p

the macro:)

#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... ??
>
> Q?
> How to get the spiral to extend to
> the edge... By means of the macro...
> ??
>
>   ------------------------------------
>  [Image]


Post a reply to this message

From: Mike Williams
Subject: Re: recursion problems ??
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.