def run(this, points): points = points.getNext().values size = len(points) scales = binomials(size) out = Group() for i in range(this.numPoints): t = i / (this.numPoints - 1.0) tt = 1 - t pos = [0, 0, 0] tan = [0, 0, 0] for j in range(size): top = size - j - 1 scale = scales[j] * math.pow(t, j) * math.pow(tt, top) tanScale = 0 if j > 0: tanScale += j * math.pow(t, j - 1) * math.pow(tt, top) if j < size - 1: tanScale += (size - j - 1) * math.pow(t, j) * math.pow(tt, top - 1) tanScale *= scales[j] pos = [pos[0] + scale * points[j][0], pos[1] + scale * points[j][1], pos[2] + scale * points[j][2]] tan = [tan[0] + tanScale * points[j][0], tan[1] + tanScale * points[j][1], tan[2] + tanScale * points[j][2]] out.addVector(pos) out.addTangent(tan) return out