POV-Ray : Newsgroups : povray.text.tutorials : Macro Recursion : Re: Macro Recursion Server Time
3 May 2024 22:42:35 EDT (-0400)
  Re: Macro Recursion  
From: Spider
Date: 25 May 1999 21:57:33
Message: <374B4700.20C5718A@bahnhof.se>
Bill DeWitt wrote:
> 
> I am having trouble converting some of my #while loops into recursive macros
> (where you call the macro from inside the macro). I seem to remember reading
> something about it in the docs, but can't find it now. I can post some
> specific problems if needed, but the recurring problem is "too many nested
> macros",  and if I don't get that, I get unexpected results that seem to
> stem from lost values in variables.
> 
> Is there a tutorial around? Or does someone remember where it is in the
> docs?


In general, try to avoid recursion in POV. its far slower and more
memory consuming than a #while loop. (or a set of them).

i don't remember the limit, but it's easy to test it...

#version 3.1;
#macro test(N)
  #debug concat(str(N,0,0),"\n")
  test(N+1)
#end

test(0)
camera{ <0,0,0>,<1,1,1> }
sphere { <1,1,1>,0.02 pigment{colour rgb 1}}


That should suffice to count them ..

//Spider


Post a reply to this message

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