平滑曲线

def smooth_curve(points, factor = 0.9):
    smoothed_points = []
    for point in points:
        if smoothed_points:
            previous = smoothed_points[-1]
            smoothed_points.append(previous * factor + point * (1 - factor))
        else:
            smoothed_points.append(point)
    return smoothed_points

 

posted @ 2019-01-03 23:23  WWBlog  阅读(566)  评论(0编辑  收藏  举报