Let us connect the points in the same sequence as before, but close the loop. In this case, we need a 5th point in the sequence that is identical to the 1st:
For s, arc length approximation could be used as before, but an easier approach will be used so the simplified equations can be employed. We will choose equal spacing: s = [0, 0.25, 0.5, 0.75, 1].
Boundary conditions require special consideration. In the case of a closed loop, the 1st and last points are joined, which makes them interior points subject to the same 1st and 2nd derivative compatibility constraints as the other interior points. Thus, with closed loops, there are no choices to be made for boundary conditions! To derive the 1st derivative compatibility equation, simply equate 1st derivatives of p1 and p5:
The 2nd derivative boundary conditions are easy: p1" - p5" = 0. (Note: using p just means there are 2 sets of equations, one for x and another for y). Also, h1 = h2 = h3 = h4 = h = s2 = 0.25, which allows the use of the simplified equations. The resulting matrix equation to be solved is (Note: . means zero):
The solution is x" = [-120, 120, -72, 72, -120]T and y" = [-72, 72, -120, 120, -72]T, from which we can calculate the coefficients of the spline segments and generate the plot.
.
Last edited by VBAhack; Aug 10th, 2007 at 07:02 PM.