splinepy.bspline.BSplineBase.knot_insertion_matrix#

BSplineBase.knot_insertion_matrix(parametric_dimension=None, knots=None, beziers=False)[source]#

Returns knot insertion matrix for a given set of knots in a specific parametric domain, if bezier flag is set, returns matrix, that creates C^(-1) spline spaces.

Matrix can be used to multiply old control points in multi-query scenarios. It describes the relation between the old and new control points

\[c_{new}^i = A c_{old}^i\]

Usage:

matrix = spline.knot_insertion_matrix(0, [0.1, 0.2])
spline_copy = spline.copy()
spline_copy.insert_knots(0, [0.1, 0.2])
np.allclose(
    spline_copy.control_points, matrix @ spline.control_points
)
Parameters:
  • parametric_dimension (int) – parametric dimension along which knots are to be inserted

  • knots (array-like) – list of new knots

  • beziers (bool (optional)) – if set, all other arguments are ignored. Return matrix will represent bezier extraction operation

Returns:

matrix – Matrix type (scipy sparse if available, else returns full matrix in numpy format). Matrix that represents knot insertion. See knot insertion for more details

Return type:

array-like