def para14_Callback(obj, event):
    sliderRepres = obj.GetRepresentation()
    pose[13] = sliderRepres.GetValue()
    sum_v = np.zeros_like(v[0])
    for i in range(0, len(v)):
        sum_v += v[i]
    tmp = sum_v / len(v)
    vv = np.zeros_like(v[0])
    for i in range(0, len(pose)):
        vv += pose[i] * (v[i] - tmp)
    vv = vv + tmp
    mapper = GetFaceMapper(vv, f)
    actor[0].SetMapper(mapper)

    sum_v = np.zeros_like(v2[0])
    for i in range(0, len(v2)):
        sum_v += v2[i]
    tmp = sum_v / len(v2)
    vv = np.zeros_like(v2[0])
    for i in range(0, len(pose)):
        vv += pose[i] * (v2[i] - tmp)
    vv = vv + tmp
    mapper = GetFaceMapper(vv, f2)
    actor[1].SetMapper(mapper)

    print("pose: {}".format(pose))
    renWin.Render()
예제 #2
0
def LoadModel(filename):

    v, f = loadObj(filename)
    mapper = GetFaceMapper(v, f)
    actor = vtk.vtkLODActor()
    actor.SetMapper(mapper)
    return actor  # represents an entity in a rendered scene
예제 #3
0
    def OnKeyPressEvent(self, obj, event):
        key = self.GetInteractor().GetKeySym()
        if (key == "Left"):
            mapper1 = GetFaceMapper(v[self.i], f)
            actor[0].SetMapper(mapper1)
            self.i += 1
            if self.i >= len(v):
                self.i = 0
            renWin.Render()

        if (key == "Right"):
            pass

        if (key == "Up"):
            pass

        if (key == "Down"):
            pass

        # Ask each renderer owned by this RenderWindow to render its image and synchronize this process
        renWin.Render()
        return