Hi there!
Not sure if this belongs to the advanced section.
I wrote a macro that takes a set of points randomly located in the xz-plane
and triangulates them. Works fine up to about 37 to 39 points (depends on
their arrangement) but when I use more I get the error "too many nested
conditions or macros" at parsing. Searching this newsgroup I found a post
where using while-loops instead of recursive macros had been recommended.
Unfortunately the recursion was linear in that case (the macro calls itself
once) while my macro calls itself twice what results in a treelike
structure. I have no idea how to solve that problem apart from making the
not half the fun isn't it? ;)
Any advices?
Regards
Roman
From: Florian Brucker
Subject: Re: too many nested macros error
Date: 16 Jan 2006 14:26:02
Message: <43cbf34a$1@news.povray.org>
I wrote a polygon triangulation code once. Out of interest I just
checked if it could handle 1000 points. 3.5 minutes later I know it does
:) It uses the remove ear technique and does not use recursion. You can
find the macro in the package PolyFunctions at
http://www.wikipov.org/ow.asp?PolyFunctions
If you want to stick to your own code, anything done in a recursion can
also be done using a while-loop and a stack (You can simulate a stack in
POV-Ray using an array and keeping track of the last entry).
HTH,
Florian
Works great!
My marco needed 8m40s to triangulate the 1000 points ;-)
Thanks a lot!
Roman
Florian Brucker <tor### [at] torfboldcom> wrote:
> I wrote a polygon triangulation code once. Out of interest I just> checked if it could handle 1000 points. 3.5 minutes later I know it does> :) It uses the remove ear technique and does not use recursion. You can> find the macro in the package PolyFunctions at>> http://www.wikipov.org/ow.asp?PolyFunctions>> If you want to stick to your own code, anything done in a recursion can> also be done using a while-loop and a stack (You can simulate a stack in> POV-Ray using an array and keeping track of the last entry).>>> HTH,> Florian