splinter icon indicating copy to clipboard operation
splinter copied to clipboard

More B-spline end conditions

Open bgrimstad opened this issue 8 years ago • 3 comments

Implement new end conditions for the B-spline, e.g. Hermite and Natural end conditions.

bgrimstad avatar Aug 27 '15 06:08 bgrimstad

Hi. I'm wondering what end conditions are available right now for (3rd degree) B-splines in splinter? I'd need interpolation equivalent to a cubic spline with not-a-knot end conditions. Where in splinter would new end conditions be implemented? P.S. I'm not very familiar with the subject of splines, but would be happy to work on a contribution regarding this.

wolfgangp avatar Jun 20 '17 16:06 wolfgangp

Hi.

Currently, the only supported end condition is the free end condition (also known as not-a-knot). This end condition follows implicitly when knot vectors are set using the AS_SAMPLED keyword, which is the default setting.

The free end condition is normally used with cubic splines to ensure continuous third derivatives close to the boundaries. We have attempted to simplify things for the user so this end condition may also be used (in a modified form) with splines of other degrees, although it no longer holds the same meaning as for the cubic case. I can understand that this may be confusing for the user.

I am planning to rewrite the code that handles knot vectors and possibly extend the fit function to accept other end conditions. This code currently resides in the files bspline_builder.* and knot_utils.* (please refer to the multidim-control-points branch, which is far ahead of the master and develop branch at this moment).

I suggest that we consider supporting the following end conditions:

  1. Hermite / clamped (fixed derivatives, specified by user)
  2. Natural (second-derivatives set to zero)
  3. Free / not-a-knot (continuous third derivatives - supported today)
  4. Periodic (equal first derivatives at boundaries and equal second derivatives at boundaries)

A warning: The fact that we have implemented tensor product B-splines, for any number of variables (x_dim), may complicate the implementation of other end conditions. In particular, we will have to consider 2^(x_dim) boundary/corner points.

If you want to read more about splines, I would suggest the following book, which is used to teach a course at the University in Oslo (see Ch. 5 about cubic spline interpolation, and p. 125 about end conditions). Spline Methods

bgrimstad avatar Jun 21 '17 07:06 bgrimstad

Hi. Thank you for your kind explanation. As splinter does exactly what I need, I will happily continue to use this fine library. Cheers

wolfgangp avatar Jun 21 '17 12:06 wolfgangp