def test_frame_channel(self): with open('tests/example_files/test_mocapbank.bvh') as f: mocap = Bvh(f.read()) self.assertEqual(mocap.frame_joint_channel(22, 'Hips', 'Xrotation'), -20.98) self.assertEqual(mocap.frame_joint_channel(22, 'Chest', 'Xrotation'), 17.65) self.assertEqual(mocap.frame_joint_channel(22, 'Neck', 'Xrotation'), -6.77) self.assertEqual(mocap.frame_joint_channel(22, 'Head', 'Yrotation'), 8.47)
def test_frame_iteration(self): with open('tests/example_files/test_mocapbank.bvh') as f: mocap = Bvh(f.read()) x_accumulator = 0.0 for i in range(0, mocap.nframes): x_accumulator += mocap.frame_joint_channel(i, 'Hips', 'Xposition') self.assertTrue(abs(-19735.902699999995 - x_accumulator) < 0.0001)
def test_frame_channel2(self): with open('tests/example_files/test_freebvh.bvh') as f: mocap = Bvh(f.read()) self.assertEqual( mocap.frame_joint_channel(22, 'mixamorig:Hips', 'Xposition'), 4.3314)