(degree, num_points, params)
return kv
Computes a knot vector from the parameter list using averaging method.

    Please refer to the Equation 9.8 on The NURBS Book (2nd Edition), pp.365 for details.

    :param degree: degree
    :type degree: int
    :param num_points: number of data points
    :type num_points: int
    :param params: list of parameters, :math:`\\overline{u}_{k}`
    :type params: list, tuple
    :return: knot vector
    :rtype: list
Computes a knot vector from the parameter list using averaging method.
Computes a knot vector from the parameter list using averaging method .
def compute_knot_vector(degree, num_points, params):
    """ Computes a knot vector from the parameter list using averaging method.

    Please refer to the Equation 9.8 on The NURBS Book (2nd Edition), pp.365 for details.

    :param degree: degree
    :type degree: int
    :param num_points: number of data points
    :type num_points: int
    :param params: list of parameters, :math:`\\overline{u}_{k}`
    :type params: list, tuple
    :return: knot vector
    :rtype: list
    """
    # Start knot vector
    kv = [0.0 for _ in range(degree + 1)]

    # Use averaging method (Eqn 9.8) to compute internal knots in the knot vector
    for i in range(num_points - degree - 1):
        temp_kv = (1.0 / degree) * sum([params[j] for j in range(i + 1, i + degree + 1)])
        kv.append(temp_kv)

    # End knot vector
    kv += [1.0 for _ in range(degree + 1)]

    return kv
def compute_knot_vector ( degree , num_points , params ) : # Start knot vector kv = [ 0.0 for _ in range ( degree + 1 ) ] # Use averaging method (Eqn 9.8) to compute internal knots in the knot vector for i in range ( num_points - degree - 1 ) : temp_kv = ( 1.0 / degree ) * sum ( [ params [ j ] for j in range ( i + 1 , i + degree + 1 ) ] ) kv . append ( temp_kv ) # End knot vector kv += [ 1.0 for _ in range ( degree + 1 ) ] return kv