POV-Ray : Newsgroups : povray.advanced-users : "user-defined" isosurface : Re: "user-defined" isosurface Server Time
28 Jul 2024 10:28:49 EDT (-0400)
  Re: "user-defined" isosurface  
From: Mike Williams
Date: 24 Jan 2006 06:40:15
Message: <EGyC+FAiEh1DFwPq@econym.demon.co.uk>
Wasn't it Leo80s who wrote:
>> #declare Factorial =
>>   function(A) { select(A, 1, 1, A*Factorial(A-1)) };
>>
>> #declare Value = Factorial(8);
>> #debug concat("Factorial of 8 is ", str(Value, 0, 0), "n")
>
>Hi Warp,
>I tried your piece of code and it works but I need to use recursion with
>element of an array...so I've modified your code in this way:
>
>#declare w= array [10];
>
>....[assigning integer value to w elements]
>
>#declare Factorial =
>   function(A) { select(A, 1, 1, w[A]*Factorial(A-1)) };
>
>compiling, I've obtained this error (related on w[A]):
>
>Parse Error: Expected 'numeric expression', undeclared identified 'A' found
>instead ...
>
>But why??? A is sure not initialited (but it's a parameter...) but why
>undeclared?!?!

There's some info on using arrays in isosurface functions here:

http://www.econym.demon.co.uk/isotut/arrays.htm

The problem is that arrays are evaluated at parse time, and function
parameters are evaluated at render time. During the parse phase, A is
indeed undefined. 

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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