POV-Ray : Newsgroups : povray.general : What is the recursion limit? Server Time
1 Nov 2024 11:16:25 EDT (-0400)
  What is the recursion limit? (Message 1 to 2 of 2)  
From: Ger
Subject: What is the recursion limit?
Date: 16 Mar 2016 22:16:54
Message: <56ea1396$1@news.povray.org>
And I don't mean in Radiosity but as in

#macro VeryRecursive(A_var)
  #local Something = 1;
  Some interesting actions and calculations involving A_var
  #local AnotherVar = A calculus result
  #if (AnotherVar < SomeLimit)
    VeryRecursive(AnotherVar)
  #end
#end

I have tried this and it crashes around 33 levels deep. Is there a way to go 
deeper?

-- 

Ger


Post a reply to this message

From: Bald Eagle
Subject: Re: What is the recursion limit?
Date: 16 Mar 2016 22:40:01
Message: <web.56ea18cadd2525235e7df57c0@news.povray.org>
Maybe something like a _chain_ of recursive macros?
Pardon my crap code - just illustrating the idea.
I'm sure there needs to be something to make sure the scope is right for the
counter, etc.

> #macro VeryRecursive(A_var)
>   #local Something = 1;
>   Some interesting actions and calculations involving A_var
>   #local AnotherVar = A calculus result

    #declare counter = counter +1
    #if (AnotherVar < SomeLimit & counter >= 32)
    #VeryRecursiveClone(AnotherVar)
    #else
    #if (AnotherVar < SomeLimit)
>     VeryRecursive(AnotherVar)
>   #end
> #end

Either that, or store your values on a global scope level, "pop out" of the
recursion, check in and outer SDL macro if you need to call VeryRecursive again,
and just keep cycling _that_ way.

Or just _simply_ have all of the #if testing be done after the calculation macro
is run, and the rerun it, over and over and over again with a while loop.


Post a reply to this message

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