sea_green = igl.eigen.MatrixXd([[70. / 255., 252. / 255., 167. / 255.]]) anim_t = 0.0 anim_t_dir = 0.015 use_dqs = False recompute = True animation = False # Flag needed as there is some synchronization problem with viewer.core.is_animating poses = [[]] igl.readOBJ(TUTORIAL_SHARED_PATH + "arm.obj", V, F) U = igl.eigen.MatrixXd(V) igl.readTGF(TUTORIAL_SHARED_PATH + "arm.tgf", C, BE) # retrieve parents for forward kinematics igl.directed_edge_parents(BE, P) rest_pose = igl.RotationList() igl.directed_edge_orientations(C, BE, rest_pose) poses = [[igl.eigen.Quaterniond.Identity() for i in range(4)] for j in range(4)] twist = igl.eigen.Quaterniond(pi, igl.eigen.MatrixXd([1, 0, 0])) poses[1][2] = rest_pose[2] * twist * rest_pose[2].conjugate() bend = igl.eigen.Quaterniond(-pi * 0.7, igl.eigen.MatrixXd([0, 0, 1])) poses[3][2] = rest_pose[2] * bend * rest_pose[2].conjugate() igl.readDMAT(TUTORIAL_SHARED_PATH + "arm-weights.dmat", W) igl.lbs_matrix(V, W, M) # Plot the mesh with pseudocolors viewer = igl.viewer.Viewer() viewer.data.set_mesh(U, F)
BE = igl.eigen.MatrixXi() P = igl.eigen.MatrixXi() sea_green = igl.eigen.MatrixXd([[70. / 255., 252. / 255., 167. / 255.]]) selected = 0 pose = igl.RotationList() anim_t = 1.0 anim_t_dir = -0.03 igl.readMESH(TUTORIAL_SHARED_PATH + "hand.mesh", V, T, F) U = igl.eigen.MatrixXd(V) igl.readTGF(TUTORIAL_SHARED_PATH + "hand.tgf", C, BE) # Retrieve parents for forward kinematics igl.directed_edge_parents(BE, P) # Read pose as matrix of quaternions per row igl.readDMAT(TUTORIAL_SHARED_PATH + "hand-pose.dmat", Q) igl.column_to_quats(Q, pose) assert (len(pose) == BE.rows()) # List of boundary indices (aka fixed value indices into VV) b = igl.eigen.MatrixXi() # List of boundary conditions of each weight function bc = igl.eigen.MatrixXd() igl.boundary_conditions(V, T, C, igl.eigen.MatrixXi(), BE, igl.eigen.MatrixXi(), b, bc) # compute BBW weights matrix bbw_data = igl.BBWData()