(ctrlpts2d)
return new_ctrlpts2d
Generates weighted control points from unweighted ones in 2-D.

    This function

    #. Takes in a 2D control points list whose coordinates are organized in (x, y, z, w) format
    #. converts into (x*w, y*w, z*w, w) format
    #. Returns the result

    Therefore, the returned list could be a direct input of the NURBS.Surface class.

    :param ctrlpts2d: 2-D control points (P)
    :type ctrlpts2d: list
    :return: 2-D weighted control points (Pw)
    :rtype: list
Generates weighted control points from unweighted ones in 2-D.
Generates weighted control points from unweighted ones in 2 - D .
def generate_ctrlptsw2d(ctrlpts2d):
    """ Generates weighted control points from unweighted ones in 2-D.

    This function

    #. Takes in a 2D control points list whose coordinates are organized in (x, y, z, w) format
    #. converts into (x*w, y*w, z*w, w) format
    #. Returns the result

    Therefore, the returned list could be a direct input of the NURBS.Surface class.

    :param ctrlpts2d: 2-D control points (P)
    :type ctrlpts2d: list
    :return: 2-D weighted control points (Pw)
    :rtype: list
    """
    # Multiply control points by weight
    new_ctrlpts2d = []
    for row in ctrlpts2d:
        ctrlptsw_v = []
        for col in row:
            temp = [float(c * col[-1]) for c in col]
            temp[-1] = float(col[-1])
            ctrlptsw_v.append(temp)
        new_ctrlpts2d.append(ctrlptsw_v)

    return new_ctrlpts2d
def generate_ctrlptsw2d ( ctrlpts2d ) : # Multiply control points by weight new_ctrlpts2d = [ ] for row in ctrlpts2d : ctrlptsw_v = [ ] for col in row : temp = [ float ( c * col [ - 1 ] ) for c in col ] temp [ - 1 ] = float ( col [ - 1 ] ) ctrlptsw_v . append ( temp ) new_ctrlpts2d . append ( ctrlptsw_v ) return new_ctrlpts2d