|
![](/i/fill.gif) |
Fabian BRAU <Fab### [at] umh ac be> wrote:
> Could you give me the form of the function (this mathematical form)?
Here is the way I derived the basic cubic spline function, the constraints
being the two end-points and two end-tangents of the curve segment (known as
a Hermite curve). The various cubic interpolating splines (e.g.
Catmull-Rom, cardinal, Bezier, Kochanek-Bartels/TCB) can be easily converted
to this simple definition, where p(t) returns the posiition (p) at the time
(t, with 0 <= t <= 1).
Let p(t) be cubic polynomial => p(t) = a*t^3 + b*t^2 + c*t + d
Let end-points be P0 and P1 => p(0) = P0, p(1) = P1
Let end-tangents be T0 and T1 => p'(0) = T0, p'(1) = T1
=> P0 = d
P1 = a + b + c + d
T0 = c
T1 = 3*a + 2*b + c
Solve for a, b, c, d:
a = 2*(P0 - P1) + T0 + T1
b = 3*(P1 - P0) - 2*T0 - T1
c = T0
d = P0
Subsitute a, b, c, d into p(t), giving general Hermite curve:
=> p(t) = (2*(P0 - P1) + T0 + T1)*t^3 + (3*(P1 - P0) - 2*T0 - T1)*t^2
+ T0*t + P0
= T0 * (t^3 - 2*t^2 + t) + P0*(2*t^3 - 3*t^2 + 1) +
P1*(3*t^2 - 2*t^3) + T1*(t^3 - t^2)
Post a reply to this message
|
![](/i/fill.gif) |