# forum.alglib.net

ALGLIB forum
 It is currently Fri May 24, 2024 4:12 am

 All times are UTC

### Forum rules

1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.

 Page 1 of 1 [ 4 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: Spline1d Calc questionPosted: Fri May 07, 2010 8:12 pm

Joined: Fri May 07, 2010 7:36 pm
Posts: 2
Hi community!,
I'm new on spline algorithm. I don't have enough experience.
I'm developing an application in VB6 that should interpolate some specific points entered by the user (click with mouse) on a picture control.
The point entered should respect the same order that they have been marked.
i.e. on the images attached the user enter 4 points (P1,P2,P3,P4) marked in order, means first mark P1, second mark P2 and so on..
I tried to use Akima interpolation , so I'm using the VBA function Spline1DBuildAkima(X, Y, N, C).
I plot the curve starting from P1 and ending to P4.

I attached two examples depending on the position of P4. In the example1 everything goes OK, no errors.
But in the example2 I got an error. From P1 to P3 the plot is OK, when I tried to plot the segment P3 to P4 I got an error divided by zero.

I have dubs respect the spline. Should I use 2 differts splines from P1 to P3 , and from P3 to P4 use anothe spline.
is it posible to interpolate a close circle with Akima interpolation

thanks for all.
Sebasti?n.

 Attachments: File comment: example2 got error division by zero whe trying to calc P4 spline1d_example2.jpg [ 4.25 KiB | Viewed 6372 times ] File comment: example1 everything goes ok. no erros spline1d_example1.jpg [ 4.16 KiB | Viewed 6372 times ]
Top

 Post subject: Re: Spline1d Calc errorPosted: Sat May 08, 2010 8:07 am

Joined: Fri May 07, 2010 7:06 am
Posts: 915
esebsal wrote:
I have dubs respect the spline. Should I use 2 differts splines from P1 to P3 , and from P3 to P4 use anothe spline.
is it posible to interpolate a close circle with Akima interpolation

Cubic splines implemented in ALGLIB aren't suited for problems with overlapping segments, i.e. for problems where interpolant is circle-like (example2). Example1, from the other side, is perfect illustration for the kind of problems which may be solved with cubic splines.

What you need is parametric cubic spline, i.e. spline where two separate interpolants are constructed: one for points on the X-axis, another for the Y-axis. You may find more info on parametric spline in the good online book by Tom Lyche and Knut Morken: http://folk.uio.no/in329/nchap1.pdf and http://folk.uio.no/in329/nchap6.pdf

P.S. I think that I'll include parametric splines in the next release of ALGLIB.

Top

 Post subject: Re: Spline1d Calc errorPosted: Sat May 08, 2010 2:28 pm

Joined: Fri May 07, 2010 7:36 pm
Posts: 2
thank you very much Sergey.
Rgds. Sebasti?n.

Top

 Post subject: Re: Spline1d Calc questionPosted: Thu May 27, 2010 11:33 pm

Joined: Sun May 16, 2010 11:42 pm
Posts: 63
Sergey - thanks for the book link. Very interesting. For anyone wanting the whole book, it is available here:
http://folk.uio.no/in329/komp.html

Esebsal - you might be interested in some VBA code on my blog, which should do what you want:

http://newtonexcelbach.wordpress.com/20 ... l-splines/

The cardinal spline will work for curves where the x values are not all increasing.

_________________
Doug Jenkins
http://newtonexcelbach.wordpress.com/

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 4 posts ]

 All times are UTC

#### Who is online

Users browsing this forum: No registered users and 2 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for: