示例#1
0
    def testRelative(self):
        t1 = transform.Transform()
        t1.translate(1.0, 1.0, 1.0)
        t2 = transform.Transform()
        t2.translate(2.0, 2.0, 2.0)

        t3 = t1 * t2

        self.assertEqual(self.body5.getTransform().m, t3.m)
示例#2
0
    def testMultiply(self):
        t1 = transform.Transform()
        t2 = transform.Transform()
        for r in range(4):
            for c in range(4):
                t1.m[r][c] = 1
                t2.m[r][c] = 2

        result = t1 * t2
        for r in range(4):
            for c in range(4):
                self.assertEqual(result.m[r][c], 8)
示例#3
0
    def testTransformRotation(self):
        ref = transform.Transform()
        ref.rotate(0.78, 0.0, 0.0)
        rot = self.geom6.getGeom().getRotation()

        for n1, n2 in zip(rot, ref.getRotation()):
            self.assert_(feq(n1, n2))
示例#4
0
    def testRotation(self):
        ref = transform.Transform()
        ref.rotate(0.0, 0.0, 0.78)

        rot = self.body6.getRotation()
        for n1, n2 in zip(ref.getRotation(), rot):
            self.assert_(feq(n1, n2))
示例#5
0
 def testInitialIdentity(self):
     t = transform.Transform()
     for r in range(4):
         for c in range(4):
             if (r == c):
                 self.assertEqual(t.m[r][c], 1)
             else:
                 self.assertEqual(t.m[r][c], 0)
示例#6
0
    def setUp(self):
        self.node1 = node.TreeNode('node1', None)
        self.node2 = node.TreeNode('node2', self.node1)
        self.node3 = node.TreeNode('node3', self.node2)
        self.node4 = node.TreeNode('node4', self.node3)

        self.t2 = transform.Transform()
        self.t2.scale(2.0, 3.0, 4.0)
        self.node2.setNodeTransform(self.t2)

        self.t3 = transform.Transform()
        self.t3.rotate(1.0, 2.0, 3.0)
        self.node3.setNodeTransform(self.t3)

        self.t4 = transform.Transform()
        self.t4.translate(2.0, 3.0, 1.0)
        self.node4.setNodeTransform(self.t4)

        self.node1.setODEObject(Class2())
        self.node2.setODEObject(Class2())
        self.node3.setODEObject(Class1())
示例#7
0
 def testVector(self):
     ref = transform.Transform()
     ref.rotate(45.0, 45.0, 45.0)
     ref.translate(10.0, 11.0, 12.0)
     ref.scale(2.0, 2.0, 2.0)
     self.assertEqual(self.body1.getNodeTransform().m, ref.m)
示例#8
0
    def testIndependantRotation(self):
        ref = transform.Transform()
        ref.rotate(0.0, 0.0, 0.78)

        for n1, n2 in zip(self.geom5.getRotation(), ref.getRotation()):
            self.assert_(feq(n1, n2))
示例#9
0
 def testInitialTransform(self):
     t = transform.Transform()
     t.setIdentity()
     self.assertEqual(self.node1.getNodeTransform().m, t.m)