Jump to content

  • Log In with Google      Sign In   
  • Create Account


How to smoothly connect a number of points


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 jenny_wui   Members   -  Reputation: 196

Like
0Likes
Like

Posted 20 February 2014 - 02:26 PM

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.     

Attached Thumbnails

  • points.png


Sponsor:

#2 SunDog   Members   -  Reputation: 232

Like
0Likes
Like

Posted 20 February 2014 - 03:08 PM

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

 

What language are you using ?



#3 jenny_wui   Members   -  Reputation: 196

Like
0Likes
Like

Posted 20 February 2014 - 03:23 PM

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



#4 ferrous   Members   -  Reputation: 1798

Like
2Likes
Like

Posted 20 February 2014 - 04:01 PM

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


Edited by ferrous, 20 February 2014 - 04:04 PM.


#5 SunDog   Members   -  Reputation: 232

Like
0Likes
Like

Posted 20 February 2014 - 06:13 PM

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.



#6 Álvaro   Crossbones+   -  Reputation: 12362

Like
0Likes
Like

Posted 20 February 2014 - 08:45 PM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS