POV-Ray : Newsgroups : povray.beta-test : Problems with functions in beta 16 Server Time
1 Nov 2024 17:21:06 EDT (-0400)
  Problems with functions in beta 16 (Message 1 to 10 of 16)  
Goto Latest 10 Messages Next 6 Messages >>>
From: Christoph Hormann
Subject: Problems with functions in beta 16
Date: 8 Apr 2002 11:13:31
Message: <3CB1B39A.3F70A85A@gmx.de>
While working on a new version of the IsoCSG library, i came across
several problems in beta 16.

(Beta 16 icl, WinNT4, K6)

1) The following code generates an error about recursive function calls
(in both versions for '#declare fn_A...'):

#declare IC_Arr=array[4]

#macro IC_Merge4(fn_A, fn_B, fn_C, fn_D)
  function {  
    min(fn_A(x, y, z),
        fn_B(x, y, z),
        fn_C(x, y, z),
        fn_D(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 fn_A= 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) }) 
#declare fn_A= IC_Merge4(IC_Arr[0], IC_Arr[1], IC_Arr[2], IC_Arr[3]) 






2) The following code crashes Povray during render (requires iso_csg 0.3)
I tried to simplify this, but came across the problem mentioned above and
therefore had difficulties making a simple example.

#version 3.5;

global_settings {
  assumed_gamma 1.0 
}   

background { color <0.750,0.500,0.300> } 
    
camera {
  location <0.2,0.2,-1>  
  look_at  <0,0,0>
  right (4/3)*x                
} 

light_source {     
  <1000, 2500, -5000> 
  color rgb 1.2
}     

#include "iso_csg.inc" 

#declare IC_Arr=array[12]

#macro IC_Merge_Array(Array)  
  #local Size=dimension_size(Array,1);

  function {
    min(
      #local Counter=0;
      #while (Counter<Size)
        #if (Counter>0) , #end
          Array[Counter] (x,y,z)
        #local Counter=Counter+1;
      #end
    )
  }
#end

#declare IC_Arr[0]=IC_Cone(0, 0, x+y, 1)                     
#declare IC_Arr[1]=IC_Rotate(IC_Arr[0], 30*z)                   
#declare IC_Arr[2]=IC_Rotate(IC_Arr[1], 60*z)
#declare IC_Arr[3]=IC_Rotate(IC_Arr[2], 90*z)
#declare IC_Arr[4]=IC_Rotate(IC_Arr[3], 120*z)
#declare IC_Arr[5]=IC_Rotate(IC_Arr[4], 150*z)     
#declare IC_Arr[6]=IC_Rotate(IC_Arr[5], 180*z)
#declare IC_Arr[7]=IC_Rotate(IC_Arr[6], 210*z)
#declare IC_Arr[8]=IC_Rotate(IC_Arr[7], 240*z)      
#declare IC_Arr[9]=IC_Rotate(IC_Arr[8], 270*z)    
#declare IC_Arr[10]=IC_Rotate(IC_Arr[9], 300*z)      
#declare IC_Arr[11]=IC_Rotate(IC_Arr[10], 330*z)   

#declare fn_XX= IC_Merge_Array(IC_Arr) 

isosurface
{                                                                                     
  function { fn_XX(x, y, z) }  
  max_gradient 1.6 
  contained_by { box { -2, 2 } }
  pigment { rgb <0, 0.2, 1.1> } 
  finish { specular 0.3 } 
  scale 0.1
}   

-- 
POV-Ray tutorials, IsoWood include,                 
TransSkin and more: http://www.tu-bs.de/~y0013390/  
Last updated 18 Mar. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

From:
Subject: Re: Problems with functions in beta 16
Date: 8 Apr 2002 12:38:29
Message: <kpf3bu88eab57nom3sc7nl3c5m2bb29oab@4ax.com>
On Mon, 08 Apr 2002 17:13:30 +0200, Christoph Hormann <chr### [at] gmxde>
wrote:
> While working on a new version of the IsoCSG library, i came across
> several problems in beta 16.
> (Beta 16 icl, WinNT4, K6)

POV 3.5 b 16 icl on WinNT4 Sp 6 PII 233 with 128 MB
POV 3.5 b 16 icl on Win2K PIII ~700 with 64 MB
.
IC_Merges works fine in my modified version of your isocsg (changes are probably
the same as in your file)

ABX


Post a reply to this message

From: Christoph Hormann
Subject: Re: Problems with functions in beta 16
Date: 8 Apr 2002 12:55:09
Message: <3CB1CB6D.7E9209F5@gmx.de>

> 
> [...]
> 
> POV 3.5 b 16 icl on WinNT4 Sp 6 PII 233 with 128 MB
> POV 3.5 b 16 icl on Win2K PIII ~700 with 64 MB
> .
> IC_Merges works fine in my modified version of your isocsg (changes are probably
> the same as in your file)

You mean both samples work on your machines?  Note that it isn't a general
problem of IC_Merge, all samples form the IsoCSG package work correctly.

Christoph

-- 
POV-Ray tutorials, IsoWood include,                 
TransSkin and more: http://www.tu-bs.de/~y0013390/  
Last updated 18 Mar. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

From:
Subject: Re: Problems with functions in beta 16
Date: 8 Apr 2002 13:23:49
Message: <06k3bucsrktkt46daos9g29qa0tkt3agr2@4ax.com>
On Mon, 08 Apr 2002 18:55:09 +0200, Christoph Hormann <chr### [at] gmxde>
wrote:
> You mean both samples work on your machines?  Note that it isn't a general
> problem of IC_Merge, all samples form the IsoCSG package work correctly.

I see, I said in general. Now here is result from your example:

1)

File: K:\test\test.pov  Line: 18
//#declare fn_A= IC_Merge4(function { IC_Arr[0](x, y, z) }, function {
IC_Arr[1] <----ERROR
Parse Error: Expected 'object or directive', function identifier found instead

2)

Started at 800x600. Stop button press when rendering slowed down on object
caused good old Dr. Watson.

ABX


Post a reply to this message

From: Christoph Hormann
Subject: Re: Problems with functions in beta 16
Date: 8 Apr 2002 13:49:33
Message: <3CB1D82D.5A3ECBB7@gmx.de>

> 
> [...]
> 
> File: K:\test\test.pov  Line: 18
> //#declare fn_A= IC_Merge4(function { IC_Arr[0](x, y, z) }, function {
> IC_Arr[1] <----ERROR
> Parse Error: Expected 'object or directive', function identifier found instead
> 

You should remove the additional line breaks before rendering.

> 2)
> 
> Started at 800x600. Stop button press when rendering slowed down on object
> caused good old Dr. Watson.

I got a program error message 'Internal Error' 'The Povray core rendering
code caused an access violation exception...' without pressing stop
(rendering at 160x120 no aa)

Christoph 

-- 
POV-Ray tutorials, IsoWood include,                 
TransSkin and more: http://www.tu-bs.de/~y0013390/  
Last updated 18 Mar. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

From:
Subject: Re: Problems with functions in beta 16
Date: 8 Apr 2002 14:02:42
Message: <9om3busmlepid5d40uarm7ahk6ncujifiv@4ax.com>
On Mon, 08 Apr 2002 19:49:33 +0200, Christoph Hormann <chr### [at] gmxde>
wrote:
> You should remove the additional line breaks before rendering.

ok. everything confirmed.

ABX
-- 
disc{z,-z#macro O()asc(substr("-+((1*(,1,/.-,*/(,&.323/'1"e,1))*.1-4#declare
e=e-1;#end#local e=26;5pigment{#local g=function(_){ceil(_)-_}function#local
k=function{pattern{object{sphere_sweep{linear_spline 13#while(e)<O(),O()//35
>.01#end}}}}{k(g(atan2(x,y)),g(ln((y+x)^2+1e-5)),0)}}finish{ambient 1}}//ABX


Post a reply to this message

From: Christoph Hormann
Subject: Re: Problems with functions in beta 16
Date: 10 Apr 2002 06:13:56
Message: <3CB4105D.D03EA180@gmx.de>
Christoph Hormann wrote:
> 
> [...]
> #macro IC_Merge4(fn_A, fn_B, fn_C, fn_D)
>   function {
>     min(fn_A(x, y, z),
>         fn_B(x, y, z),
>         fn_C(x, y, z),
>         fn_D(x, y, z))
>   }
> #end
> 
> [...]
> #declare fn_A= IC_Merge4(IC_Arr[0], IC_Arr[1], IC_Arr[2], IC_Arr[3])
> 

This seems to be a problem related to the duplicated name 'fn_A', when
using different identifiers inside and outside the macro it works.

I have no idea about the reason for the other problem, but it could be
some function size limit, the resulting function is fairly long and the
crash does not occur when only merging 8 functions.

Both problems already occur in beta 15 BTW.

Christoph

-- 
POV-Ray tutorials, IsoWood include,                 
TransSkin and more: http://www.tu-bs.de/~y0013390/  
Last updated 18 Mar. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Christoph Hormann
Subject: Re: Problems with functions in beta 16
Date: 15 Apr 2002 04:58:23
Message: <3CBA962F.4E9318C0@gmx.de>
Christoph Hormann wrote:
> 
> [...]
> 
> Both problems already occur in beta 15 BTW.
> 

And still in RC1.

Christoph

-- 
POV-Ray tutorials, IsoWood include,                 
TransSkin and more: http://www.tu-bs.de/~y0013390/  
Last updated 14 Apr. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Problems with functions in beta 16
Date: 18 Apr 2002 16:17:22
Message: <3cbf29d2@news.povray.org>
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.  Due to the way declares are parsed other information to handle scope
better is not available.  Consequently this will not be fixed in 3.5 as it
requires a redesign of the POV-Ray parser (or some really ugly hacks in 3.5).
The solution for this particular bug is to not insert functions with the same
name in a function that is being declared also those are accepted by the
parser.

> 2) The following code crashes Povray during render (requires iso_csg 0.3)
> I tried to simplify this, but came across the problem mentioned above and
> therefore had difficulties making a simple example.

Where can I get "iso_csg 0.3"?

As far as the problem is concerned (which I could not verify due to the
missing file), as mentioned above the name check is not really perfect and
with some skill one can probably create a recursive function call using macros
and by exploiting various parser loopholes.  Your problem may or may not be
related to this.  I can say more once I can parse the scene...

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Christoph Hormann
Subject: Re: Problems with functions in beta 16
Date: 18 Apr 2002 16:26:46
Message: <3CBF2C05.3C5826FA@gmx.de>
Thorsten Froehlich wrote:
> 
> [...]
> 
> Where can I get "iso_csg 0.3"?
> 
> As far as the problem is concerned (which I could not verify due to the
> missing file), as mentioned above the name check is not really perfect and
> with some skill one can probably create a recursive function call using macros
> and by exploiting various parser loopholes.  Your problem may or may not be
> related to this.  I can say more once I can parse the scene...

http://www-public.tu-bs.de:8080/~y0013390/pov/ic/index.html

(current version already includes the IC_Merge_Array() macro )

To me it seems this problem is related to the length of the function (or
to the depth of nested declarations).

Christoph

-- 
POV-Ray tutorials, IsoWood include,                 
TransSkin and more: http://www.tu-bs.de/~y0013390/  
Last updated 16 Apr. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

Goto Latest 10 Messages Next 6 Messages >>>

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