(knotvector, u, span, r)
return kv_updated
Computes the knot vector of the rational/non-rational spline after knot insertion.

    Part of Algorithm A5.1 of The NURBS Book by Piegl & Tiller, 2nd Edition.

    :param knotvector: knot vector
    :type knotvector: list, tuple
    :param u: knot
    :type u: float
    :param span: knot span
    :type span: int
    :param r: number of knot insertions
    :type r: int
    :return: updated knot vector
    :rtype: list
Computes the knot vector of the rational/non-rational spline after knot insertion.
Computes the knot vector of the rational / non - rational spline after knot insertion .
def knot_insertion_kv(knotvector, u, span, r):
    """ Computes the knot vector of the rational/non-rational spline after knot insertion.

    Part of Algorithm A5.1 of The NURBS Book by Piegl & Tiller, 2nd Edition.

    :param knotvector: knot vector
    :type knotvector: list, tuple
    :param u: knot
    :type u: float
    :param span: knot span
    :type span: int
    :param r: number of knot insertions
    :type r: int
    :return: updated knot vector
    :rtype: list
    """
    # Initialize variables
    kv_size = len(knotvector)
    kv_updated = [0.0 for _ in range(kv_size + r)]

    # Compute new knot vector
    for i in range(0, span + 1):
        kv_updated[i] = knotvector[i]
    for i in range(1, r + 1):
        kv_updated[span + i] = u
    for i in range(span + 1, kv_size):
        kv_updated[i + r] = knotvector[i]

    # Return the new knot vector
    return kv_updated
def knot_insertion_kv ( knotvector , u , span , r ) : # Initialize variables kv_size = len ( knotvector ) kv_updated = [ 0.0 for _ in range ( kv_size + r ) ] # Compute new knot vector for i in range ( 0 , span + 1 ) : kv_updated [ i ] = knotvector [ i ] for i in range ( 1 , r + 1 ) : kv_updated [ span + i ] = u for i in range ( span + 1 , kv_size ) : kv_updated [ i + r ] = knotvector [ i ] # Return the new knot vector return kv_updated