def average_curves(*curves):
cvs, spans, degree, form = get_curve_info(curves[0])
points = [cmds.getAttr(curve + '.cv[*]') for curve in curves]
if not all(len(points[0]) == len(curve_points) for curve_points in points):
raise Exception('Input curves need to have the same number of cvs')
averaged = [[0, 0, 0] for i in xrange(len(points[0]))]
for curve_points in points:
for point in curve_points:
averaged[0] += point[0]
averaged[1] += point[1]
averaged[2] += point[2]
averaged = [pnt / len(points) for pnt in averaged]
return averaged
评论列表
文章目录