(points, centripetal=False)
return uk
Computes :math:`\\overline{u}_{k}` for curves.

    Please refer to the Equations 9.4 and 9.5 for chord length parametrization, and Equation 9.6 for centripetal method
    on The NURBS Book (2nd Edition), pp.364-365.

    :param points: data points
    :type points: list, tuple
    :param centripetal: activates centripetal parametrization method
    :type centripetal: bool
    :return: parameter array, :math:`\\overline{u}_{k}`
    :rtype: list
Computes :math:`\\overline{u}_{k}` for curves.
Computes : math : \\ overline { u } _ { k } for curves .
def compute_params_curve(points, centripetal=False):
    """ Computes :math:`\\overline{u}_{k}` for curves.

    Please refer to the Equations 9.4 and 9.5 for chord length parametrization, and Equation 9.6 for centripetal method
    on The NURBS Book (2nd Edition), pp.364-365.

    :param points: data points
    :type points: list, tuple
    :param centripetal: activates centripetal parametrization method
    :type centripetal: bool
    :return: parameter array, :math:`\\overline{u}_{k}`
    :rtype: list
    """
    if not isinstance(points, (list, tuple)):
        raise TypeError("Data points must be a list or a tuple")

    # Length of the points array
    num_points = len(points)

    # Calculate chord lengths
    cds = [0.0 for _ in range(num_points + 1)]
    cds[-1] = 1.0
    for i in range(1, num_points):
        distance = linalg.point_distance(points[i], points[i - 1])
        cds[i] = math.sqrt(distance) if centripetal else distance

    # Find the total chord length
    d = sum(cds[1:-1])

    # Divide individual chord lengths by the total chord length
    uk = [0.0 for _ in range(num_points)]
    for i in range(num_points):
        uk[i] = sum(cds[0:i + 1]) / d

    return uk
def compute_params_curve ( points , centripetal = False ) : if not isinstance ( points , ( list , tuple ) ) : raise TypeError ( "Data points must be a list or a tuple" ) # Length of the points array num_points = len ( points ) # Calculate chord lengths cds = [ 0.0 for _ in range ( num_points + 1 ) ] cds [ - 1 ] = 1.0 for i in range ( 1 , num_points ) : distance = linalg . point_distance ( points [ i ] , points [ i - 1 ] ) cds [ i ] = math . sqrt ( distance ) if centripetal else distance # Find the total chord length d = sum ( cds [ 1 : - 1 ] ) # Divide individual chord lengths by the total chord length uk = [ 0.0 for _ in range ( num_points ) ] for i in range ( num_points ) : uk [ i ] = sum ( cds [ 0 : i + 1 ] ) / d return uk