splinebox.spline_curves.

padding_function#

splinebox.spline_curves.padding_function(knots, pad_length)#

This is the default padding function of splinebox. It applies constant padding to the ends of the knots.

Parameters:
knotsnumpy array

The knots to be padded.

pad_lengthint

The amount of padding at each end.

Returns:
padded_knotsnumpy array

Array of padded knots.

Notes

  • Padding is required if the basis function has support > 1.

  • Not padding a spline, is equivalent to setting the padded control points to zero.

  • Edge padding is only used for the knots.

Examples

>>> import splinebox
>>> import numpy as np
>>> knots = np.array([[1, 1], [2, 2], [3, 3]])
>>> splinebox.padding_function(knots, pad_length=1)
array([[1, 1],
       [1, 1],
       [2, 2],
       [3, 3],
       [3, 3]])
>>> splinebox.padding_function(knots, pad_length=2)
array([[1, 1],
       [1, 1],
       [1, 1],
       [2, 2],
       [3, 3],
       [3, 3],
       [3, 3]])