Beispiel #1
0
    def test_root_position(self):
        n1 = Node()
        n1.offset = (10, 10, 10)
        n1.channels = ["Xposition", "Yposition", "Zposition"]
        bone = BVHToolkit.Bone(n1)
        anim = BVHToolkit.Animation(bone)
        anim.add_frame([0, 0, 0])
        anim.add_frame([10, 20, 30])

        pose = anim.get_pose(1)
        self.assertTupleEqual(tuple(pose.get_position(0)), (20, 30, 40))
Beispiel #2
0
    def test_root_position(self):
        n1 = Node()
        n1.offset = (10, 10, 10)
        n1.channels = ["Xposition", "Yposition", "Zposition"]
        bone = BVHToolkit.Bone(n1)
        anim = BVHToolkit.Animation(bone)
        anim.add_frame([0, 0, 0])
        anim.add_frame([10, 20, 30])

        pose = anim.get_pose(1)
        self.assertTupleEqual(tuple(pose.get_position(0)), (20, 30, 40))
Beispiel #3
0
    def test_calc_matrix(self):
        n1 = Node()
        n1.channels = ["Xposition", "Yposition", "Zposition"]
        n2 = Node()
        n2.channels = []
        n3 = Node()
        n3.channels = ["Xrotation", "Yrotation", "Zrotation"]

        n1.children.append(n2)
        n2.children.append(n3)
        bone = BVHToolkit.Bone(n1)

        pose = BVHToolkit.Pose(bone, [10, 20, 30, 90, 90, 90])
        m1 = mat4.translation((10, 20, 30))
        m2 = mat4.rotation(math.pi / 2, (1, 0, 0)) * \
            mat4.rotation(math.pi / 2, (0, 1, 0)) * \
            mat4.rotation(math.pi / 2, (0, 0, 1))

        self.assertMat4Equal(pose._calc_mat(n1), m1)
        self.assertMat4Equal(pose._calc_mat(n2), mat4.identity())
        self.assertMat4Equal(pose._calc_mat(n3), m2)
Beispiel #4
0
    def test_calc_matrix(self):
        n1 = Node()
        n1.channels = ["Xposition", "Yposition", "Zposition"]
        n2 = Node()
        n2.channels = []
        n3 = Node()
        n3.channels = ["Xrotation", "Yrotation", "Zrotation"]

        n1.children.append(n2)
        n2.children.append(n3)
        bone = BVHToolkit.Bone(n1)

        pose = BVHToolkit.Pose(bone, [10, 20, 30, 90, 90, 90])
        m1 = mat4.translation((10, 20, 30))
        m2 = (
            mat4.rotation(math.pi / 2, (1, 0, 0))
            * mat4.rotation(math.pi / 2, (0, 1, 0))
            * mat4.rotation(math.pi / 2, (0, 0, 1))
        )

        self.assertMat4Equal(pose._calc_mat(n1), m1)
        self.assertMat4Equal(pose._calc_mat(n2), mat4.identity())
        self.assertMat4Equal(pose._calc_mat(n3), m2)