To determine the first cubic Bezier segment we could set its two terminal
control points and tangents. Then the second segment is determined by the first point,
two derivatives (continuous at the point) and the second control point.
All the rest segments are determined in a similar way.
It is more convinient to set terminal tangents of the whole spline curve.
Fig.1' shows, that all Bezier control points of the curve are evaluated from
two vectors (. Points d_{0 }, d_{1 },
... , d_{n })( are set by user and
P_{0 },
P_{1 }, ... , P_{n }),
d_{0 }, d_{n} are calculated.
d_{1 }, d_{2 },
... , d_{n-1 } |

move add delete |

In general case we get banded 3-diagonals linear equations

... ...

... ...

We can successively express

where

Then we will find

It is programmed as (b-interpolate.js)

function findCPoints(){ Bi[1] = -.25; Ax[1] = (Px[2] - Px[0] - dx[0])/4; Ay[1] = (Py[2] - Py[0] - dy[0])/4; for (var i = 2; i < N-1; i++){ Bi[i] = -1/(4 + Bi[i-1]); Ax[i] = -(Px[i+1] - Px[i-1] - Ax[i-1])*Bi[i]; Ay[i] = -(Py[i+1] - Py[i-1] - Ay[i-1])*Bi[i]; } for (var i = N-2; i > 0; i--){ dx[i] = Ax[i] + dx[i+1]*Bi[i]; dy[i] = Ay[i] + dy[i+1]*Bi[i]; } }

move add delete |

Contents Previous: Nonuniform B-splines Next: NURBS