POV-Ray : Newsgroups : povray.text.tutorials : Macro Recursion Server Time
21 Nov 2024 12:50:31 EST (-0500)
  Macro Recursion (Message 1 to 4 of 4)  
From: Bill DeWitt
Subject: Macro Recursion
Date: 25 May 1999 21:05:38
Message: <374b3ad2.0@news.povray.org>
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?


Post a reply to this message

From: Spider
Subject: Re: Macro Recursion
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

From: Bill DeWitt
Subject: Re: Macro Recursion
Date: 25 May 1999 22:20:37
Message: <374b4c65.0@news.povray.org>
Spider says:
>
> In general, try to avoid recursion in POV. its far slower and more
> memory consuming than a #while loop. (or a set of them).

    Considering the trouble I am having, I will find it easy to avoid
recursion. I thought it would be an easy way to change parameters while
zooming into a fractal, but I begin to doubt if it is worth it.

>
> That should suffice to count them ..
>

    Blows up at 97, I was thinking about a million or so.


Post a reply to this message

From: Spider
Subject: Re: Macro Recursion
Date: 26 May 1999 20:37:13
Message: <374BC703.6F744BDD@bahnhof.se>
Hmm, mandelbrot ???

Well, warp made a fractal in pov... Don't know where it is though..

Bill DeWitt wrote:
> 
> Spider says:
> >
> > In general, try to avoid recursion in POV. its far slower and more
> > memory consuming than a #while loop. (or a set of them).
> 
>     Considering the trouble I am having, I will find it easy to avoid
> recursion. I thought it would be an easy way to change parameters while
> zooming into a fractal, but I begin to doubt if it is worth it.
> 
> >
> > That should suffice to count them ..
> >
> 
>     Blows up at 97, I was thinking about a million or so.

-- 
//Spider    --  [ spi### [at] bahnhofse ]-[ http://www.bahnhof.se/~spider/ ]
And the meek'll inherit what they damn well please
	Get ahead, go figure, go ahead and pull the trigger
		Everything under the gun
			--"Sisters Of Mercy" -- "Under The Gun"


Post a reply to this message

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