forum.alglib.net

ALGLIB forum
It is currently Sat Dec 21, 2024 5:04 pm

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.



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Spline1d Calc question
PostPosted: Fri May 07, 2010 8:12 pm 
Offline

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
spline1d_example2.jpg [ 4.25 KiB | Viewed 8796 times ]
File comment: example1 everything goes ok. no erros
spline1d_example1.jpg
spline1d_example1.jpg [ 4.16 KiB | Viewed 8796 times ]
Top
 Profile  
 
 Post subject: Re: Spline1d Calc error
PostPosted: Sat May 08, 2010 8:07 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
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
 Profile  
 
 Post subject: Re: Spline1d Calc error
PostPosted: Sat May 08, 2010 2:28 pm 
Offline

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


Top
 Profile  
 
 Post subject: Re: Spline1d Calc question
PostPosted: Thu May 27, 2010 11:33 pm 
Offline

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
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 16 guests


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

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group