POV-Ray : Newsgroups : povray.beta-test.binaries : Too many nested variables Server Time
29 Apr 2024 11:06:58 EDT (-0400)
  Too many nested variables (Message 1 to 8 of 8)  
From: Greg M  Johnson
Subject: Too many nested variables
Date: 17 May 2002 08:36:47
Message: <3ce4f95f$1@news.povray.org>
The attached file gives a "too many nested variables error."
I posted an incomplete snippet of the code to p.b-t..
Have I hit a fundamental, theoretical limit to macros, or have I simply
buggy code?

The purpose of the code was to make a fractal blob.  I now see how my code
doesn't do this properly, BUT I'm bothered that I either cannot have nested
macros or redefine them!


Post a reply to this message


Attachments:
Download 'fraccy03b.pov.txt' (2 KB)

From:
Subject: Re: Too many nested variables
Date: 17 May 2002 08:50:16
Message: <etu9eu49gbl8a324bvpf574u2t61rfbtrp@4ax.com>
On Fri, 17 May 2002 08:35:37 -0400, "Greg M. Johnson" <gregj:-)565### [at] aolcom>
wrote:
> The purpose of the code was to make a fractal blob.  I now see how my code
> doesn't do this properly, BUT I'm bothered that I either cannot have nested
> macros or redefine them!

You can have nested macros. Just do it properlny. Note that parser stoped not
during declaration of nested macros but during execution. It hit limit of
nested. Note that creation of macros in loop has no sense becouse in every
loop definiton of macros is not executed.

ABX


Post a reply to this message

From: Lutz-Peter Hooge
Subject: Re: Too many nested variables
Date: 17 May 2002 09:17:52
Message: <MPG.174f219615fac04989704@news.povray.org>
In article <3ce4f95f$1@news.povray.org>, "Greg M. Johnson" <gregj:-
)565### [at] aolcom> says...

> The purpose of the code was to make a fractal blob.  I now see how my code
> doesn't do this properly, BUT I'm bothered that I either cannot have nested
> macros or redefine them!

I think the problem is that macros doesn't work the way as you think they 
do. In fact your first declaration of set1() never gets called.

What you assume is: set1() is immediately replaced by the content of the 
last definiton of that macro.
But: In fact this is only done later, when the macro containing the call 
to set1() is called... but at this time you already redefined set1()

This means: your scene is equivalent to

#macro set2()	set1() #end
#macro set1() set2() #end
set1()

-> infinite recursion.

Lutz-Peter


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Too many nested variables
Date: 17 May 2002 10:00:01
Message: <3ce50ce1$1@news.povray.org>
Thanks for the attempts at explanations, but they either
i) go way over my head
or
ii) disappoint me in this extreme limitation of povray.


Post a reply to this message

From:
Subject: Re: Too many nested variables
Date: 17 May 2002 12:04:39
Message: <aaaaeugdt980scno5nu0sv1l288qv4653a@4ax.com>
On Fri, 17 May 2002 09:58:51 -0400, "Greg M. Johnson" <gregj:-)565### [at] aolcom>
wrote:
> ii) disappoint me in this extreme limitation of povray.

That's not specific limitation of POV-Ray. Most of languages limits nesting.
Usually recursion/nesting can be replaced with iterations so you can still
try...

ABX


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Too many nested variables
Date: 17 May 2002 13:15:27
Message: <3ce53aaf$1@news.povray.org>
Can you give me a brief example of

"iterations" without "nesting", especially where I could control the # of
levels with a variable?


Post a reply to this message

From: Lutz-Peter Hooge
Subject: Re: Too many nested variables - test3.pov [1/1]
Date: 17 May 2002 14:05:30
Message: <MPG.174f64fe21ed6e40989705@news.povray.org>
In article <aaaaeugdt980scno5nu0sv1l288qv4653a@4ax.com>, abx### [at] babilonorg 
says...

> Usually recursion/nesting can be replaced with iterations so you can still
> try...

And also a recursion depth of 97 should be enough for everybody ;-)

Really, what he wanted to do should be perfectly possible with a 
recursive macro.

I attached a modifikation of Greg's source that roughly does what I think 
he wanted it to do. But it does use only simple spheres instead of blobs 
components, because blobs can't be nested inside other blobs (but unions 
of spheres can). 

Lutz-Peter


Post a reply to this message


Attachments:
Download 'test3.pov.txt' (2 KB)

From: Warp
Subject: Re: Too many nested variables
Date: 17 May 2002 18:22:40
Message: <3ce582b0@news.povray.org>
Greg M. Johnson <gregj:-)565### [at] aolcom> wrote:
> Can you give me a brief example of

> "iterations" without "nesting", especially where I could control the # of
> levels with a variable?

  Ever heard of #while-loops?

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

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