def setStepLength(self): indexFootFront = getVertexIndex(self.trained, "foot-front") indexFootBack = getVertexIndex(self.trained, "foot-back") vertices0 = VertexUtils.computeVertices(self.trained, self.StepArgument, 0) vertices1 = VertexUtils.computeVertices(self.trained, self.StepArgument, 1) # reference vertex is the closest to the front foot; we estimate that the next place to put such # vertex is near the back foot after a full step was completed (which is when the back foot becomes # front foot again) self.stepLength = vertices1[indexFootBack]["x"] - vertices0[indexFootFront]["x"]
def setStepLength(self): indexFootFront = getVertexIndex(self.trained, "foot-front") indexFootBack = getVertexIndex(self.trained, "foot-back") vertices0 = VertexUtils.computeVertices(self.trained, self.StepArgument, 0) vertices1 = VertexUtils.computeVertices(self.trained, self.StepArgument, 1) # reference vertex is the closest to the front foot; we estimate that the next place to put such # vertex is near the back foot after a full step was completed (which is when the back foot becomes # front foot again) self.stepLength = vertices1[indexFootBack]["x"] - vertices0[ indexFootFront]["x"]
def getVerticesAtFrame(self, frame, refVertexX, invertFrontAndBack): vertices = VertexUtils.computeVertices(self.trained, self.StepArgument, frame % 1) vertices = VertexUtils.translateVertices(vertices, refVertexX, 0) if invertFrontAndBack: self.invertFrontAndBack(vertices) return vertices
def updateImage(): global canvas, Lines global Trained, canvasSize, StepSize, AnimationPercent noSelection = -1 currentImage = None vertices = VertexUtils.computeVertices(Trained, StepSize, AnimationPercent) vertices = VertexUtils.translateVertices( VertexUtils.scaleVertices(vertices, canvasSize / 4), canvasSize * 2.0 / 3, canvasSize * 2.0 / 3 ) Utils.UpdateImage(canvas, 0, 0, vertices, Lines, currentImage, noSelection, noSelection)
def updateImage(): global canvas, Lines global Trained, canvasSize, StepSize, AnimationPercent noSelection = -1 currentImage = None vertices = VertexUtils.computeVertices(Trained, StepSize, AnimationPercent) vertices = VertexUtils.translateVertices( VertexUtils.scaleVertices(vertices, canvasSize / 4), canvasSize * 2. / 3, canvasSize * 2. / 3) Utils.UpdateImage(canvas, 0, 0, vertices, Lines, currentImage, noSelection, noSelection)
def getVerticesAtFrame(self, frame, refVertexX, invertFrontAndBack): vertices = VertexUtils.computeVertices(self.trained, self.StepArgument, frame % 1) vertices = VertexUtils.translateVertices(vertices, refVertexX, 0) if invertFrontAndBack: self.invertFrontAndBack(vertices) return vertices