POV-Ray : Newsgroups : povray.beta-test : Problems with functions in beta 16 : Re: Problems with functions in beta 16 Server Time
29 Jul 2024 22:26:57 EDT (-0400)
  Re: Problems with functions in beta 16  
From:
Date: 22 Apr 2002 11:47:17
Message: <rsb8cukh345qeltb1gj6b786n374v6e076@4ax.com>
On Thu, 18 Apr 2002 22:17:19 +0200, "Thorsten Froehlich" <tho### [at] trfde>
wrote:

>In article <3CB1B39A.3F70A85A@gmx.de> , Christoph Hormann 
><chr### [at] gmxde>  wrote:
>
> > 1) The following code generates an error about recursive function calls
> > (in both versions for '#declare fn_A...'):
>
> Yes, because the detection of recursive calls has to rely on the function
> name.

I'm not sure it can be considered as hole in this checking system but if not
then I have simple workaround for our iso_csg library. It is possible now to
redeclare passed functions as array and array not checks recursive calls.

#declare IC_Arr=array[4]
#declare a=array[4]

#macro IC_Merge4(fn_A, fn_B, fn_C, fn_D)
  #local a=array[4]{fn_A,fn_B,fn_C,fn_D};
  function {  
    min(a[0](x, y, z),
        a[1](x, y, z),
        a[2](x, y, z),
        a[3](x, y, z))      
  }
#end 

#declare IC_Arr[0]=function(x, y, z) { x }  
#declare IC_Arr[1]=function(x, y, z) { y }  
#declare IC_Arr[2]=function(x, y, z) { z }    
#declare IC_Arr[3]=function(x, y, z) { x+y }  

#declare a[0]= IC_Merge4(function { IC_Arr[0](x, y, z) }, function {
IC_Arr[1](x, y, z) }, function { IC_Arr[2](x, y, z) }, function {
IC_Arr[3](x, y, z) }) 

ABX


Post a reply to this message

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