POV-Ray : Newsgroups : povray.general : bug with spline in function Server Time
6 Nov 2024 14:27:18 EST (-0500)
  bug with spline in function (Message 1 to 9 of 9)  
From: ABX
Subject: bug with spline in function
Date: 12 Aug 2002 04:52:54
Message: <knselu81q1h2qm5s0qgcbnt1h24f2426ou@4ax.com>
I have found strange behaviour when spline was readed via function. It returns
unexpected values (one result for whole spline, this result vary from render
torender). I have checked this with standard 3.5a as well as with patched
version with spline cache turned off. Both failed. I don't know function code
yet enough so have no idea what could be wrong. It is not that it appear only
during parsing time. The same appear when function of spline is used in
isosurface.

<SDL>
  #version 3.5;

  #declare Spline=spline{linear_spline -1 0 0 1 1 0};
  #declare f_Spline=function{spline{Spline}};

  // test for values readed directly from spline
  #declare C=-1;
  #while(C<=1)
    #debug concat("Spline(",str(C,0,1),")=",str(Spline(C).x,0,-1),"\n")
    #declare C=C+.5;
  #end

  // test for values readed from spline via function
  #declare C=-1;
  #while(C<=1)
    #debug concat("f_Spline(",str(C,0,1),").x=",str(f_Spline(C).x,0,-1),"\n")
    #declare C=C+.5;
  #end
</SDL>

sample output:

Spline(-1.0)=0.000000
Spline(-0.5)=0.500000
Spline(0.0)=1.000000
Spline(0.5)=0.500000
Spline(1.0)=0.000000
f_Spline(-1.0).x=0.412644
f_Spline(-0.5).x=0.412644
f_Spline(0.0).x=0.412644
f_Spline(0.5).x=0.412644
f_Spline(1.0).x=0.412644

ABX


Post a reply to this message

From: ABX
Subject: Re: bug with spline in function
Date: 12 Aug 2002 05:00:07
Message: <c4ueluk767m3522ukdq1e7h5gba0juno3e@4ax.com>
On Mon, 12 Aug 2002 10:51:40 +0200, ABX <abx### [at] babilonorg> wrote:
> The same appear when function of spline is used in
> isosurface.

Here is sample script for isosurface case. So, any confirmation of this bug ?

<SDL>
  #version 3.5;

  #include "functions.inc"

  #declare Spline=spline{linear_spline -1 0 0 1 1 0};
  #declare f_Spline=function{spline{Spline}};
  #declare f_Imitation=function(Y){max(1-abs(Y),0)};

  union{
    // how it looks - it differs between renders
    isosurface{
      function{f_r(x,0,z)-f_Spline(y).x}
      contained_by{sphere{0 1}}
      translate x
    }
    // how it should look - it should be "glued cones"
    isosurface{
      function{f_r(x,0,z)-f_Imitation(y)}
      contained_by{sphere{0 1}}
      translate -x
    }
    pigment{rgb 1}
    translate z*3
  }
  light_source{1e3*<-9,-5,-9> 1}
  background{1}
</SDL>

ABX


Post a reply to this message

From: Marc-Hendrik Bremer
Subject: Re: bug with spline in function
Date: 12 Aug 2002 05:24:15
Message: <3d577ebf@news.povray.org>
I can confirm both described behaviours (isosurface and normal function).

Marc-Hendrik

WinXPPro, Athlon 1800+, 256 MB RAM, Winpov 3.5


Post a reply to this message

From: ABX
Subject: Re: bug with spline in function
Date: 12 Aug 2002 05:41:37
Message: <3g0flu0vj1pf06esrtsgoa7uof56h9ot56@4ax.com>
On Mon, 12 Aug 2002 11:24:23 +0200, "Marc-Hendrik Bremer"
<Mar### [at] t-onlinede> wrote:
> I can confirm both described behaviours (isosurface and normal function).

Thanks

> WinXPPro, Athlon 1800+, 256 MB RAM, Winpov 3.5

Oh, I forgot specyfication

NT4 Sp 6, PII 233, 128 MB, WinPOV 3.5a
NT4 Sp 6, PII 233, 128 MB, UnixPOV 3.5 custom compile under cygwin

ABX


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: bug with spline in function
Date: 12 Aug 2002 06:35:00
Message: <3d578f54@news.povray.org>
In article <knselu81q1h2qm5s0qgcbnt1h24f2426ou@4ax.com> , ABX 
<abx### [at] babilonorg>  wrote:

> I don't know function code
> yet enough so have no idea what could be wrong.

Easy:  The code handling vector functions assumes three or more return
values and acts a bit strange when dealing with only two.  The way you
declare the spline you create a two diemensional spline, which is what
causes the odd effects.  Add a 3D vector to the spline and it goes away.

    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: ABX
Subject: Re: bug with spline in function
Date: 12 Aug 2002 06:53:10
Message: <ba4fluourg9v26bu7thin4bt5hc831u6v5@4ax.com>
On Mon, 12 Aug 2002 12:34:56 +0200, "Thorsten Froehlich" <tho### [at] trfde>
wrote:
> Easy:  The code handling vector functions assumes three or more return
> values and acts a bit strange when dealing with only two. The way you
> declare the spline you create a two diemensional spline, which is what
> causes the odd effects.  Add a 3D vector to the spline and it goes away.

You mean probably "Add a <0,0,0> to the points during spline creation and it
goes away" since I have no idea how to add 3d vector to the spline defining
function :-)

Yes. It helped.

So does it mean is this a bug or limitation of the spline parser?

ABX


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: bug with spline in function
Date: 12 Aug 2002 06:53:13
Message: <3d579399@news.povray.org>
In article <3d578f54@news.povray.org> , "Thorsten Froehlich" 
<tho### [at] trfde> wrote:

> Easy:  The code handling vector functions assumes three or more return
> values and acts a bit strange when dealing with only two.  The way you
> declare the spline you create a two diemensional spline, which is what
> causes the odd effects.  Add a 3D vector to the spline and it goes away.

To be more precise, the spline function evaluator for functions - that is,
the internal spline function f_spline in fnintern.cpp - assumes the location
of the parameter is always the fourth stack entry.  This effectively
supports only 3D vectors (support for other vector sizes was added only
recently).  To change it, change the line in spline from

Get_Spline_Val((SPLINE *)(f->private_data), PARAM_N_X(3), Result, &Terms);

to

Terms = ((SPLINE *)(f->private_data))->Terms;
Get_Spline_Val((SPLINE *)(f->private_data),PARAM_N_X(Terms),Result,&Terms);

    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: ABX
Subject: Re: bug with spline in function
Date: 12 Aug 2002 06:56:49
Message: <7u4fluksk2433n9b66tqhm2ckia797jqle@4ax.com>
On Mon, 12 Aug 2002 12:53:10 +0200, "Thorsten Froehlich" <tho### [at] trfde>
wrote:
> To change it, change the line in spline

Welcome to the patch writers community ;-)

I will add your note to http://abx.art.pl/pov/patches/

ABX


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: bug with spline in function
Date: 12 Aug 2002 07:12:11
Message: <3d57980b@news.povray.org>
In article <7u4fluksk2433n9b66tqhm2ckia797jqle@4ax.com> , ABX 
<abx### [at] babilonorg>  wrote:

> Welcome to the patch writers community ;-)

Not really.  It will make its way into the official source code (also not
available to the public) within minutes in my case ;-)

> I will add your note to http://abx.art.pl/pov/patches/

OK.

    Thorsten

PS: I am also looking into the other problem with functions you found
recently.  I just have to decide what will be the most efficient way to fix
it....

____________________________________________________
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

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