Catmull-Rom interpolation
I took the liberty of starting a new thread since it really is a separate topic from the Parametric Cubic Spline tutorial post (though related):
http://www.vbforums.com/showthread.php?t=481546
Quote:
Originally Posted by
frankly747
Hi. Thanks for replying. But, if the P matrices are two columns, then the final answer will be a 1 X 2, that is, one row two columns
( 1x4 * 4X4 * 4X2 ), where 1X4 is the matrix of the interpolant (cubed, squared, raised to one and constant), 4X4 is the 'M' matrix and the 4X2 is the matrix you are proposong).
Thus, if I have a 1 X 2, this doesn not sound right since the answer I seek is a single value (the value of y, given an x).
I don't know that much about Catmull-Rom, but I do know they are parametric splines (like Bezier curves) where x and y are each functions of a parameter t (u is sometimes used) that varies from 0 to 1. In other words:
x = f1(t)
y = f2(t)
If you want to know the value of y for a specific x, you must first find the value of t the produces the x you want, then calculate y. You are right that the result of a specific value of [1 t t2 t3] multiplied by M and then by P results in a 1x2, which are the x & y values associated with the value of t.
For the control points you chose, x=1 corresponds to t=0 (because it is the 2nd control point and Catmull-ROM interpolates between the 2nd and 3rd control points), and the result is exactly what you expect. I tried it.
The key is understanding that the splines are parametric in nature and that the equations produce x and y for a given value of t (between 0 and 1). It works. The following references may help:
http://www.mvps.org/directx/articles/catmull/
http://www.cs.cmu.edu/~462/projects/...catmullRom.pdf