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
def run(this, frames): if this.lastFrame is None: this.lastFrame = frames.getNext() thisFrame = frames.getNext() out = Group() for i in range(min(len(thisFrame.values), len(this.lastFrame.values))) + [0]: out.addVector(this.lastFrame.values[i]) out.addNormal(this.lastFrame.values[i]) out.addVector(thisFrame.values[i]) out.addNormal(thisFrame.values[i]) this.lastFrame = thisFrame return out
def run(this): out = Group() out.addVector((0.5, 0.5, 0.5)) out.addVector((-0.5, 0.5, 0.5)) out.addVector((-0.5, -0.5, 0.5)) out.addVector((0.5, -0.5, 0.5)) out.addNormal((0.0, 0.0, 1.0)) out.addVector((0.5, 0.5, -0.5)) out.addVector((0.5, -0.5, -0.5)) out.addVector((-0.5, -0.5, -0.5)) out.addVector((-0.5, 0.5, -0.5)) out.addNormal((0.0, 0.0, -1.0)) out.addVector((-0.5, 0.5, -0.5)) out.addVector((-0.5, -0.5, -0.5)) out.addVector((-0.5, -0.5, 0.5)) out.addVector((-0.5, 0.5, 0.5)) out.addNormal((-1.0, 0.0, 0.0)) out.addVector((0.5, 0.5, -0.5)) out.addVector((0.5, 0.5, 0.5)) out.addVector((0.5, -0.5, 0.5)) out.addVector((0.5, -0.5, -0.5)) out.addNormal((1.0, 0.0, 0.0)) out.addVector((0.5, -0.5, -0.5)) out.addVector((0.5, -0.5, 0.5)) out.addVector((-0.5, -0.5, 0.5)) out.addVector((-0.5, -0.5, -0.5)) out.addNormal((0.0, -1.0, 0.0)) out.addVector((0.5, 0.5, -0.5)) out.addVector((-0.5, 0.5, -0.5)) out.addVector((-0.5, 0.5, 0.5)) out.addVector((0.5, 0.5, 0.5)) out.addNormal((0.0, 1.0, 0.0)) return out