|
![](/i/fill.gif) |
I was studying, the other day, and was struck by a sudden impulse. Can POV,
I wondered, handle recursion? So I wrote the following simple scene:
/*
Persistence of Vision Ray Tracer Scene Description File
File: Recursion.pov
Vers: 3.6
Desc: A simple recursive macro
Date: 03/14/07
Auth: Anthony D. Baye
*/
#include "kolors.inc"
#include "glass.inc"
#include "stones.inc"
#include "metals.inc"
#declare ft = 12 ;
#default { pigment { White } finish { ambient 0.3 diffuse 0.5 } }
camera {
location <2.0, 3.0, -5.0>
look_at 0.0
}
light_source { <15.0, 35.0, -75.0> color rgb 1 }
#macro String_Of_Beads(n)
#if(n >= 0)
String_Of_Beads(n-1)
#end
#local move = (0.25+(0.375*n));
sphere { <cos(radians(9*n)), sin(radians(9*n)), move>, 0.125
texture { T_Stone28 }
finish { reflection { 0.05, 0.1 fresnel on } ambient 0.3 diffuse 0.5
conserve_energy }
}
cylinder { <cos(radians(9*n)), sin(radians(9*n)), move>
<cos(radians(9*(n+1))), sin(radians(9*(n+1))), (0.25+(0.375*(n+1)))>
0.015625 texture { T_Silver_5A }}
#end
String_Of_Beads(96)
It actually works, but with any values higher than 96, the parse fails,
and gives the message: "Too many nested symbol tables" whatever that
means. (I'm not familiar with the source code.)
I was wondering, however, is this an inherent limitation, or an imposed
limitation? And might it be possible to adapt the parser to allow advanced
recursion?
Just some thoughts.
Regards,
ADB
Post a reply to this message
|
![](/i/fill.gif) |