def smoothMLS1D(actor, f=0.2, showNLines=0):
    """
    Smooth actor or points with a `Moving Least Squares` variant.
    The list ``actor.info['variances']`` contain the residue calculated for each point.
    Input actor's polydata is modified.

    :param float f: smoothing factor - typical range is [0,2].
    :param int showNLines: build an actor showing the fitting line for N random points.

    .. hint:: |moving_least_squares1D| |moving_least_squares1D.py|_

        |skeletonize| |skeletonize.py|_
    """
    coords = actor.coordinates()
    ncoords = len(coords)
    Ncp = int(ncoords * f / 10)
    nshow = int(ncoords)
    if showNLines:
        ndiv = int(nshow / showNLines)

    if Ncp < 3:
        vc.printc("~target Please choose a fraction higher than " + str(f), c=1)
        Ncp = 3

    poly = actor.GetMapper().GetInput()
    vpts = poly.GetPoints()
    locator = vtk.vtkPointLocator()
    locator.SetDataSet(poly)
    locator.BuildLocator()
    vtklist = vtk.vtkIdList()
    variances, newline, acts = [], [], []
    for i, p in enumerate(coords):

        locator.FindClosestNPoints(Ncp, p, vtklist)
        points = []
        for j in range(vtklist.GetNumberOfIds()):
            trgp = [0, 0, 0]
            vpts.GetPoint(vtklist.GetId(j), trgp)
            points.append(trgp)
        if len(points) < 2:
            continue

        points = np.array(points)
        pointsmean = points.mean(axis=0)  # plane center
        uu, dd, vv = np.linalg.svd(points - pointsmean)
        newp = np.dot(p - pointsmean, vv[0]) * vv[0] + pointsmean
        variances.append(dd[1] + dd[2])
        newline.append(newp)

        if showNLines and not i % ndiv:
            fline = fitLine(points, lw=4)  # fitting plane
            iapts = vs.Points(points)  # blue points
            acts += [fline, iapts]

    for i in range(ncoords):
        vpts.SetPoint(i, newline[i])

    if showNLines:
        apts = vs.Points(newline, c="r 0.6", r=2)
        ass = Assembly([apts] + acts)
        return ass  # NB: a demo actor is returned

    actor.info["variances"] = np.array(variances)
    return actor
Smooth actor or points with a `Moving Least Squares` variant.
    The list ``actor.info['variances']`` contain the residue calculated for each point.
    Input actor's polydata is modified.

    :param float f: smoothing factor - typical range is [0,2].
    :param int showNLines: build an actor showing the fitting line for N random points.

    .. hint:: |moving_least_squares1D| |moving_least_squares1D.py|_

        |skeletonize| |skeletonize.py|_