You are not logged in.
Hi,
I have a set of points in 3D space and want to interpolate through them smoothly over a specific timespan. I searched for spline interpolation code and found some info (http://en.wikipedia.org/wiki/Cubic_Hermite_spline) and also on this forum (http://www.mathisfunforum.com/viewtopic.php?id=4092) but can't get the grasps of it.
Anyone knows of a source with code examples?
Thanks
Offline
I think this is 2-D, but
might be a good source of info:
http://online.redwoods.cc.ca.us/instruct/darnold/laproj/Fall98/SkyMeg/Proj.PDF
It's over my head.
Also MATLAB's interp3 is used for 3-D.
Here is something else I found in C++:
http://elonen.iki.fi/code/tpsdemo/
You can download more code on the page.
igloo myrtilles fourmis
Offline
Thanks John, I quickly looked at the examples and it seems like a good start. But after thinking more about it I am not sure if typical spline interpolation is what I need?
Please look at the example below. Connecting 3 points results in something like in figure 1 with spline interpolation. Connecting 4 points results in something like figure 2 below. This is not what I need. In my case I am adding points constantly and I do not want the tangent (this is what it is called if I am right?) of the last added point to change (C in figure 2) . The angle at point C should remain the same like in figure 3. The rotation at point D should probably depend on the angle between BC and BD and the distance between CD. Then while interpolation over a timespan I need to find the points on the curve between each 2 points.
Is this indeed a type of Spline interpolation or is there another way to do this?
Last edited by safra (2009-03-31 00:25:46)
Offline
You can very easily get a spline which will not effect any of the rest of the spline when adding a new point, but it is nigh impossible to get it form a continous smooth curve that would be acceptible.
However, if you allow for two extra control points around the spline, it is very simple using the catmull-rom or a generalisation of it, wherein adding an extra control point will draw one more segment with the rest of it being untouched
The Beginning Of All Things To End.
The End Of All Things To Come.
Offline
Thanks luca-deltodesco! Found some nice code about all of this at http://actionsnippet.com/?p=1042.
Offline