def updateOriginalVert(v): if not v.data[1] or not v.data[2]: # Joint vertex return n = len(v.data[1]) if n == len(v.data[2]): # Inner vertex faceVertAvg = centroid([fv.co for fv in v.data[1]]) edgeVertAvg = centroid([ev.co for ev in v.data[2]]) v.co = vmul3d(vadd3d(vadd3d(faceVertAvg, vmul3d(edgeVertAvg, 2.0)), vmul3d(v.data[0].co, n - 3.0)), 1.0/n) else: # Outer vertex v.co = centroid([ev.co for ev in v.data[2] if len(ev.data) == 3]+[v.data[0].co])
def addVerts(targetVerts, cval, verts): for n, v in verts.items(): dr = fastmath.vmul3d(v, cval) try: targetVerts[n] = fastmath.vadd3d(targetVerts[n], dr) except KeyError: targetVerts[n] = dr return targetVerts
def makeRefTarget(self): self.refTargetVerts = {} madeRefTarget = False for key in self.bases.keys(): target, char, cval = self.bases[key] if cval: # print "ch", target, cval madeRefTarget = True verts = self.getTargetInsist(target) for n, v in verts.items(): dr = fastmath.vmul3d(v, cval) try: self.refTargetVerts[n] = fastmath.vadd3d(self.refTargetVerts[n], dr) except KeyError: self.refTargetVerts[n] = dr return madeRefTarget
def getRefObject(human): global theRefObjects, theRefObjectVerts, theBaseObjectVerts if human.iHaveChanged: print "Reference character changed" human.iHaveChanged = False theRefObjectVerts = [list(v) for v in theBaseObjectVerts] for (char, verts) in theRefObjects.items(): cval = human.getDetail(char) if cval: print " ", os.path.basename(char), cval for n, v in verts.items(): dr = fastmath.vmul3d(v, cval) theRefObjectVerts[n] = fastmath.vadd3d(theRefObjectVerts[n], dr) return True else: return False