(dim, degree, kv, cpts, rs, deriv_order=0)
return PK
Compute control points of curve derivatives.

    Implementation of Algorithm A3.3 from The NURBS Book by Piegl & Tiller.

    :param dim: spatial dimension of the curve
    :type dim: int
    :param degree: degree of the curve
    :type degree: int
    :param kv: knot vector
    :type kv: list, tuple
    :param cpts: control points
    :type cpts: list, tuple
    :param rs: minimum (r1) and maximum (r2) knot spans that the curve derivative will be computed
    :param deriv_order: derivative order, i.e. the i-th derivative
    :type deriv_order: int
    :return: control points of the derivative curve over the input knot span range
    :rtype: list
Compute control points of curve derivatives.
Compute control points of curve derivatives .
def curve_deriv_cpts(dim, degree, kv, cpts, rs, deriv_order=0):
    """ Compute control points of curve derivatives.

    Implementation of Algorithm A3.3 from The NURBS Book by Piegl & Tiller.

    :param dim: spatial dimension of the curve
    :type dim: int
    :param degree: degree of the curve
    :type degree: int
    :param kv: knot vector
    :type kv: list, tuple
    :param cpts: control points
    :type cpts: list, tuple
    :param rs: minimum (r1) and maximum (r2) knot spans that the curve derivative will be computed
    :param deriv_order: derivative order, i.e. the i-th derivative
    :type deriv_order: int
    :return: control points of the derivative curve over the input knot span range
    :rtype: list
    """
    r = rs[1] - rs[0]

    # Initialize return value (control points)
    PK = [[[None for _ in range(dim)] for _ in range(r + 1)] for _ in range(deriv_order + 1)]

    # Algorithm A3.3
    for i in range(0, r + 1):
        PK[0][i][:] = [elem for elem in cpts[rs[0] + i]]

    for k in range(1, deriv_order + 1):
        tmp = degree - k + 1
        for i in range(0, r - k + 1):
            PK[k][i][:] = [tmp * (elem1 - elem2) /
                           (kv[rs[0] + i + degree + 1] - kv[rs[0] + i + k]) for elem1, elem2
                           in zip(PK[k - 1][i + 1], PK[k - 1][i])]

    # Return control points (as a 2-dimensional list of points)
    return PK
def curve_deriv_cpts ( dim , degree , kv , cpts , rs , deriv_order = 0 ) : r = rs [ 1 ] - rs [ 0 ] # Initialize return value (control points) PK = [ [ [ None for _ in range ( dim ) ] for _ in range ( r + 1 ) ] for _ in range ( deriv_order + 1 ) ] # Algorithm A3.3 for i in range ( 0 , r + 1 ) : PK [ 0 ] [ i ] [ : ] = [ elem for elem in cpts [ rs [ 0 ] + i ] ] for k in range ( 1 , deriv_order + 1 ) : tmp = degree - k + 1 for i in range ( 0 , r - k + 1 ) : PK [ k ] [ i ] [ : ] = [ tmp * ( elem1 - elem2 ) / ( kv [ rs [ 0 ] + i + degree + 1 ] - kv [ rs [ 0 ] + i + k ] ) for elem1 , elem2 in zip ( PK [ k - 1 ] [ i + 1 ] , PK [ k - 1 ] [ i ] ) ] # Return control points (as a 2-dimensional list of points) return PK