POV-Ray : Newsgroups : povray.general : ph function in function problem (bug?) Server Time
5 Aug 2024 18:24:07 EDT (-0400)
  ph function in function problem (bug?) (Message 1 to 3 of 3)  
From:
Subject: ph function in function problem (bug?)
Date: 29 Jul 2002 07:19:25
Message: <ro8aku85qkqjh5ri08rr9ft0f3snko3qj8@4ax.com>
Here is simple script:

<SDL>
  #include "functions.inc"
  #declare f_y=function(ph,rad){rad*cos(ph)}
  #macro Calc(X,Y,Z)
    #debug concat(
      "  Y=",str(Y,6,3),
      "  function=",str(f_y(f_ph(X,Y,Z),f_r(X,Y,Z)),6,3),
      "  parser=",str(f_r(X,Y,Z)*cos(f_ph(X,Y,Z)),6,3),
      "\n"
    )
  #end
  Calc(0, 2,0)
  Calc(2, 2,3)
  Calc(2, 1,3)
  Calc(2, 0,3)
  Calc(2,-1,3)
  Calc(2,-2,3)
  Calc(0,-2,0)
</SDL>

I expect it to display three identical columns of values as follow:
  Y= 2.000  function= 2.000  parser= 2.000
  Y= 2.000  function= 2.000  parser= 2.000
  Y= 1.000  function= 1.000  parser= 1.000
  Y= 0.000  function= 0.000  parser= 0.000
  Y=-1.000  function=-1.000  parser=-1.000
  Y=-2.000  function=-2.000  parser=-2.000
  Y=-2.000  function=-2.000  parser=-2.000
unfortunatelly it outputs various values when ph function is accesed via
another function:
  Y= 2.000  function= 2.000  parser= 2.000
  Y= 2.000  function=-1.716  parser= 2.000
  Y= 1.000  function=-1.557  parser= 1.000
  Y= 0.000  function=-1.500  parser= 0.000
  Y=-1.000  function=-1.557  parser=-1.000
  Y=-2.000  function=-1.716  parser=-2.000
  Y=-2.000  function= 2.000  parser=-2.000
Any idea why ? Any confirmation that it can be a bug ?

ABX


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: ph function in function problem (bug?)
Date: 30 Jul 2002 07:59:25
Message: <3d467f9d@news.povray.org>
(Posted to povray.bugreports as well!)

I can confirm that the scene below shows a bug.  Essentially under certain
conditions like the one found in the given scene, the parser will overwrite
some previously calculated values if a function result is passed to another
function at *parse* time and that function is also evaluated at *parse*
time.  The workaround is to not use functions as parameters to functions in
the parser if those results are used at *parse* time but to declare their
results and then pass those to the function.

NOTE: The problem only involves the use of functions in the *parser*!!!
When *rendering* functions (i.e. in isosurfaces) there is *no* problem!


    Thorsten Froehlich



Skiba <abx### [at] babilonorg>  wrote:
> Here is simple script:
>
> <SDL>
>   #include "functions.inc"
>   #declare f_y=function(ph,rad){rad*cos(ph)}
>   #macro Calc(X,Y,Z)
>     #debug concat(
>       "  Y=",str(Y,6,3),
>       "  function=",str(f_y(f_ph(X,Y,Z),f_r(X,Y,Z)),6,3),
>       "  parser=",str(f_r(X,Y,Z)*cos(f_ph(X,Y,Z)),6,3),
>       "\n"
>     )
>   #end
>   Calc(0, 2,0)
>   Calc(2, 2,3)
>   Calc(2, 1,3)
>   Calc(2, 0,3)
>   Calc(2,-1,3)
>   Calc(2,-2,3)
>   Calc(0,-2,0)
> </SDL>
>
> I expect it to display three identical columns of values as follow:
>   Y= 2.000  function= 2.000  parser= 2.000
>   Y= 2.000  function= 2.000  parser= 2.000
>   Y= 1.000  function= 1.000  parser= 1.000
>   Y= 0.000  function= 0.000  parser= 0.000
>   Y=-1.000  function=-1.000  parser=-1.000
>   Y=-2.000  function=-2.000  parser=-2.000
>   Y=-2.000  function=-2.000  parser=-2.000
> unfortunatelly it outputs various values when ph function is accesed via
> another function:
>   Y= 2.000  function= 2.000  parser= 2.000
>   Y= 2.000  function=-1.716  parser= 2.000
>   Y= 1.000  function=-1.557  parser= 1.000
>   Y= 0.000  function=-1.500  parser= 0.000
>   Y=-1.000  function=-1.557  parser=-1.000
>   Y=-2.000  function=-1.716  parser=-2.000
>   Y=-2.000  function= 2.000  parser=-2.000
> Any idea why ? Any confirmation that it can be a bug ?


____________________________________________________
Thorsten Froehlich
e-mail: mac### [at] povrayorg

I am a member of the POV-Ray Team.
Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: ABX
Subject: Re: ph function in function problem (bug?)
Date: 2 Aug 2002 07:40:40
Message: <fqrkkukmvrh11c241tsbdo937jidpfnlme@4ax.com>
On Tue, 30 Jul 2002 13:59:25 +0200, "Thorsten Froehlich" <tho### [at] trfde>
wrote:
> (Posted to povray.bugreports as well!)

what about http://www.povray.org/download/3.5-bugs.php ?

ABX


Post a reply to this message

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