Пример #1
0
def blend(pose1, pose2, alpha=0.5):
    assert 0.0 <= alpha <= 1.0
    pose_new = copy.deepcopy(pose1)
    for j in range(pose1.skel.num_joints()):
        R0, p0 = conversions.T2Rp(pose1.get_transform(j, local=True))
        R1, p1 = conversions.T2Rp(pose2.get_transform(j, local=True))
        R, p = math.slerp(R0, R1, alpha), math.lerp(p0, p1, alpha)
        pose_new.set_transform(j, conversions.Rp2T(R, p), local=True)
    return pose_new
Пример #2
0
 def interpolate(cls, pose1, pose2, alpha):
     skel = pose1.skel
     data = []
     for j in skel.joints:
         R1, p1 = conversions.T2Rp(pose1.get_transform(j, local=True))
         R2, p2 = conversions.T2Rp(pose2.get_transform(j, local=True))
         R, p = (
             math.slerp(R1, R2, alpha),
             math.lerp(p1, p2, alpha),
         )
         data.append(conversions.Rp2T(R, p))
     return Pose(pose1.skel, data)