Computation of a closed curve through given points

Directly to the input form

 
  • A possible application of periodic cubic splines is the computation of a closed two times differentiable curve through an ordered set of given data points. That means that the order in which these points are passed through is given by their order in the input. This curve is however not necessarily smooth, its tangent vector might vanish somewhere.
  • We consider a curve as a vectorvalued function of a real parameter, the curve parameter. the usual denotation for it is s, if the parametrization is chosen such that the tangent vector has length one everywhere. This is not possible here, since at first we only have data points (xi,yi), i=1,...,n and nothing else. We define artificially
    (xn+1,yn+1)=(x1,y1)
    and consider now xi and yi as values of two independent functions of an unknown parameter t corresponding to values ti. t's choice is arbitrary, but the most natural choice might be the length of the piecewise linear arc connecting those points:
    ti=ti-1+wi-1sqrt((xi-xi-1)2+ (yi-yi-1)2), t0=0
    usually with wi-1=1, but here we allow a free choice of strictly positive values, which can greatly influence the shape of the curve.
  • Finally, for the two components x resp. y we compute two cubic periodic splines sx interpolating (ti,xi) and sy interpolating (ti,yi).
    This means we add the boundary conditions sx'(x1)=sx'(xn+1), sx''(x1)=sx''(xn+1)
    and the same for sy. The periodicity for the function value itself is given by the interpolation condition and the choice of xn+1 resp. yn+1.
  • This way we get a two times differentiable curve automatically. The approximation error with respect to the ''true'' interpolating curve of minimal curvature is not O(h4) but only O(h2) (for wi=1 all i) because of the error in the parametrization. Here h is the maximum distance between two successive points. The method can easily be extended to any higher dimension. Remark: approximating one periodic C4 function by a cubic periodic spline has an error O(h4)) .
  • You should be aware of the fact that this construction is not invariant under unitary tranformations!
 

Input

 
  • The number n.
  • The coordinates of the points as pairs of numbers in parentheses (x,y).
  • Optionally a set of weights for the distances.
 

Output

 
  • Three plots: the points with the connecting curve and the pointwise first and second derivative of the curve as curves.
 

Questions

 
  • Which effects do you expect if the weights for the distances come into play? Why?
  • How could one check the quality of approximation stated above?
  • How would the plot of (s'x,s'y) look like if the chosen parametrization would be the natural one?
 

to the input form

 
 
Back to the top!

09.08.2013