|
|
> On Sat, 16 Mar 2002 16:02:52 +0100, "Jan Walzer" <jan### [at] lzernet> wrote:
>> All we miss then yet is only iteration/recursion inside of these functions, and
they're turing-complete ...
>
> Personally I think that internally functions are ready for recursions :-)
> I've got message "Possible infinite recursive function call." some time.
> I've also got message like "Reached maximum number of
> recursion in functions". In both cases messages were produced as a result of
> bug as I reported in povray.beta-test but the fact they are builded in POV-Ray
> lead me to conclusion that recursion is a part of design :-)
Loops, too. They're just not part of the syntax. The 3.5 beta has some
debugging features built in, though, so you can actually use them. For
example, here's a simple iterative factorial function:
#declare Fact=function(x) {"fact.out","fact.func" };
#debug concat(str(Fact(0),3,3), "\n")
#debug concat(str(Fact(1),3,3), "\n")
#debug concat(str(Fact(2),3,3), "\n")
#debug concat(str(Fact(3),3,3), "\n")
#debug concat(str(Fact(4),3,3), "\n")
and here are the contents of the file "fact.func":
grow 2
load SP(0),r2
loadi 1,r0
cmpi 0,r2
ble 8
mul r2,r0
subi 1, r2
jmp 3
rts
--
#macro R(L P)sphere{L F}cylinder{L P F}#end#macro P(V)merge{R(z+a z)R(-z a-z)R(a
-z-z-z a+z)torus{1F clipped_by{plane{a 0}}}translate V}#end#macro Z(a F T)merge{
P(z+a)P(z-a)R(-z-z-x a)pigment{rgbt 1}hollow interior{media{emission T}}finish{
reflection.1}}#end Z(-x-x.2y)Z(-x-x.4x)camera{location z*-10rotate x*90}
Post a reply to this message
|
|