This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

possible bug in akima interpolation


Hi, I'm new to the GSL and come here mainly to report possibility of bug.

I tried to implement akima interpolation in splines of POV-Ray. First I compared
how it looks with code from other sources. When I linked my application with
modules from GSL library I recived shape with bug in the most left point:

http://news.povray.org/povray.binaries.images/31227/221922/akima_spline.png

but when I used code from http://www.magic-software.com/Interpolation1D.html
I received almost similiar shape except all control points are "smooth"

http://news.povray.org/povray.binaries.images/31227/222064/akima_spline.png

Since both libraries are builded different way (temporary and helpers variables
are different) I not tried to compare details of implementations. But I suppose
the difference is located here:

GSL:

    m[-2] = 3.0 * m[0] - 2.0 * m[1];
    m[-1] = 2.0 * m[0] - m[1];
    m[size - 1] = 2.0 * m[size - 2] - m[size - 3];
    m[size] = 3.0 * m[size - 2] - 2.0 * m[size - 3];
  
Magic Software:

    afSlope[1] = 2.0f*afSlope[2] - afSlope[3];
    afSlope[0] = 2.0f*afSlope[1] - afSlope[2];
    afSlope[iQuantity+1] = 2.0f*afSlope[iQuantity] - afSlope[iQuantity-1];
    afSlope[iQuantity+2] = 2.0f*afSlope[iQuantity+1] - afSlope[iQuantity];

In my example splines were open, thought first and last point are equal. The
images were created with following set of data:

  t,<x(t),y(t)>

  0,<0,0>
  1,<0,2>
  2,<2,1>
  3,<0,0>
  4,<-1,2>
  5,<-2,1>
  6,<-1,-1>
  7,<0,0>

ABX


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]