How to smoothly connect a number of points

Started by
4 comments, last by alvaro 10 years, 2 months ago

Hello every body,

I have attached a picture of a number of points. I need to connect the points smoothly, there should not be any sharp corners. Could any one tell me how that can be done?

Thanks in advance.

Advertisement

Cubic spline interpolation. You'll probably want a "clamped" version over the "natural" spline

What language are you using ?

I would like to program in C++. Could you explain a bit "clamped version"?

Catmull-Rom is my go to spline. It goes through all the points, and it won't have any sharp corners.

http://www.mvps.org/directx/articles/catmull/

Basically, each position is determined by the four nearest control points. (Control points, in this case being your points you've specified.)

This has an applet which I think will let you move/add points, to see if its the kind of curve you want.

http://www.cse.unsw.edu.au/~lambert/splines/CatmullRom.html

I would like to program in C++. Could you explain a bit "clamped version"?

A "clamped" spline is where the value of the first deriviative of the first spline is known in your case, you might want to set it to be the the rate of change between the first two points (y2-y1)/(x2-x1). In a "natural" spline, you set it to zero.

I think this might be what you need:

http://www.alglib.net/interpolation/spline3.php#header4

It has several different algorithms including Cubic spline, Hermite, Catmull-Rrom, etc.

I would like to program in C++. Could you explain a bit "clamped version"?


A "clamped" spline is where the value of the first deriviative of the first spline is known in your case, you might want to set it to be the the rate of change between the first two points (y2-y1)/(x2-x1). In a "natural" spline, you set it to zero.


Not exactly. In a natural spline you generally make the second derivative be zero at the extremes. I would try natural cubic splines first.

This topic is closed to new replies.

Advertisement