Пример #1
0
 def test_eq(self):
     v = tuple(float(i) for i in range(0, 9))
     self.a = bullet.btMatrix3x3(*v)
     self.b = bullet.btMatrix3x3(*tuple(reversed(v)))
     self.assertFalse(self.a == self.b)
     self.c = bullet.btMatrix3x3(self.a)
     self.assertEqual(self.a, self.c)
Пример #2
0
 def test_eq(self):
     v = tuple(float(i) for i in range(0, 9))
     self.a = bullet.btMatrix3x3(*v)
     self.b = bullet.btMatrix3x3(*tuple(reversed(v)))
     self.assertFalse(self.a == self.b)
     self.c = bullet.btMatrix3x3(self.a)
     self.assertEqual(self.a, self.c)
Пример #3
0
 def test_sub(self):
     self.a = bullet.btMatrix3x3(*self.v1)
     self.b = bullet.btMatrix3x3(*self.v2)
     self.c = self.b - self.a
     self.b -= self.a
     self.assertEqual(self.a, self.b)
     self.assertEqual(self.b, self.c)
Пример #4
0
 def test_sub(self):
     self.a = bullet.btMatrix3x3(*self.v1)
     self.b = bullet.btMatrix3x3(*self.v2)
     self.c = self.b - self.a
     self.b -= self.a
     self.assertEqual(self.a, self.b)
     self.assertEqual(self.b, self.c)
Пример #5
0
 def test_identity(self):
     self.a = bullet.btMatrix3x3.identity
     self.b = bullet.btMatrix3x3(1, 0, 0, 0, 1, 0, 0, 0, 1)
     self.assertEquals(self.a, self.b)
     self.a = bullet.btMatrix3x3(0, 0, 1, 1, 0, 1, 1, 1, 1)
     self.a.set_identity()
     self.assertEquals(self.a, self.b)
Пример #6
0
 def test_add(self):
     self.a = bullet.btMatrix3x3(*self.v1)
     self.b = bullet.btMatrix3x3(self.a)
     self.c = self.a + self.b
     self.a += self.b
     self.d = bullet.btMatrix3x3(*self.v2)
     self.assertEqual(self.a, self.c)
     self.assertEqual(self.a, self.d)
Пример #7
0
 def test_ctors(self):
     self.a = bullet.btTransform(bullet.btMatrix3x3(*self.v1))
     self.b = bullet.btTransform(bullet.btMatrix3x3(*self.v1),
                                 bullet.btVector3(0, 0, 0))
     self.c = bullet.btTransform(bullet.btQuaternion.identity)
     self.d = bullet.btTransform(bullet.btQuaternion.identity,
                                 bullet.btVector3(0, 0, 0))
     self.assertEqual(self.a, self.b)
Пример #8
0
 def test_add(self):
     self.a = bullet.btMatrix3x3(*self.v1)
     self.b = bullet.btMatrix3x3(self.a)
     self.c = self.a + self.b
     self.a += self.b
     self.d = bullet.btMatrix3x3(*self.v2)
     self.assertEqual(self.a, self.c)
     self.assertEqual(self.a, self.d)
Пример #9
0
 def test_str(self):
     self.a = bullet.btMatrix3x3(0, 0, 0, 0, 0, 0, 0, 0, 0)
     self.b = bullet.btMatrix3x3(self.a)
     s = str(self.a)
     t = repr(self.b)
     e = "((0, 0, 0), (0, 0, 0), (0, 0, 0))"
     self.assertEqual(s, t)
     self.assertEqual(s, e)
Пример #10
0
 def test_str(self):
     self.a = bullet.btMatrix3x3(0, 0, 0,
                                 0, 0, 0,
                                 0, 0, 0)
     self.b = bullet.btMatrix3x3(self.a)
     s = str(self.a)
     t = repr(self.b)
     e = "((0, 0, 0), (0, 0, 0), (0, 0, 0))"
     self.assertEqual(s, t)
     self.assertEqual(s, e)
Пример #11
0
 def test_identity(self):
     self.a = bullet.btMatrix3x3.identity
     self.b = bullet.btMatrix3x3(1, 0, 0,
                                 0, 1, 0,
                                 0, 0, 1)
     self.assertEquals(self.a, self.b)
     self.a = bullet.btMatrix3x3(0, 0, 1,
                                 1, 0, 1,
                                 1, 1, 1)
     self.a.set_identity()
     self.assertEquals(self.a, self.b)
Пример #12
0
 def test_index(self):
     v = [float(i) for i in range(0, 9)]
     self.a = bullet.btMatrix3x3(*tuple(v))
     self.assertEqual(self.a[0], bullet.btVector3(*tuple(v[:3])))
     self.assertEqual(self.a[1], bullet.btVector3(*tuple(v[3:-3])))
     w = [4, 5, 6]
     self.a[0] = bullet.btVector3(*tuple(w))
     self.assertEqual(self.a[0], bullet.btVector3(*tuple(w)))
Пример #13
0
 def test_index(self):
     v = [float(i) for i in range(0, 9)]
     self.a = bullet.btMatrix3x3(*tuple(v))
     self.assertEqual(self.a[0], bullet.btVector3(*tuple(v[:3])))
     self.assertEqual(self.a[1], bullet.btVector3(*tuple(v[3:-3])))
     w = [4, 5, 6]
     self.a[0] = bullet.btVector3(*tuple(w))
     self.assertEqual(self.a[0], bullet.btVector3(*tuple(w)))
Пример #14
0
    def updateCamera(self):
        rele = self.m_ele * 0.01745329251994329547
        # rads per deg
        razi = self.m_azi * 0.01745329251994329547
        # rads per deg

        rot = bullet.btQuaternion(self.m_cameraUp, razi)

        eyePos = [0, 0, 0]
        eyePos[self.m_forwardAxis] = -self.m_cameraDistance
        eyePos = tuple(eyePos)

        forward = (eyePos[0], eyePos[1], eyePos[2])
        if (vector3.length2(forward) < bullet.SIMD_EPSILON):
            forward = (1.0, 0.0, 0.0)

        right = vector3.cross(self.m_cameraUp, forward)
        roll = bullet.btQuaternion(right, -rele)

        m = bullet.btMatrix3x3(rot) * bullet.btMatrix3x3(roll)
        eyePos = m.apply(eyePos)

        self.m_cameraPosition = vector3.add(eyePos,
                                            self.m_cameraTargetPosition)

        if (self.m_glutScreenWidth == 0 and self.m_glutScreenHeight == 0):
            return

        aspect = float(self.m_glutScreenWidth) / float(self.m_glutScreenHeight)
        assert (aspect != 0.0)

        extents = (aspect * 1.0, 1.0, 0.0)

        if (self.m_ortho):
            # reset matrix

            extents *= self.m_cameraDistance
            lower = self.m_cameraTargetPosition - extents
            upper = self.m_cameraTargetPosition + extents

        else:
            pass
Пример #15
0
    def setUp(self):
        self.v1 = tuple(float(i) for i in range(0, 9))
        self.vec = bullet.btVector3(0, 0, 0)
        self.q = bullet.btQuaternion.identity
        self.m = bullet.btMatrix3x3(*self.v1)

        self.a = bullet.btTransform()
        self.b = bullet.btTransform()
        self.c = bullet.btTransform()
        self.d = bullet.btTransform()
        self.e = bullet.btTransform()
Пример #16
0
    def updateCamera(self):
        rele = self.m_ele * 0.01745329251994329547;# rads per deg
        razi = self.m_azi * 0.01745329251994329547;# rads per deg

        rot=bullet.btQuaternion(self.m_cameraUp, razi);

        eyePos=[0, 0, 0];
        eyePos[self.m_forwardAxis] = -self.m_cameraDistance;
        eyePos=tuple(eyePos)

        forward=(eyePos[0], eyePos[1], eyePos[2]);
        if (vector3.length2(forward) < bullet.SIMD_EPSILON):
            forward=(1.0, 0.0, 0.0);

        right = vector3.cross(self.m_cameraUp, forward);
        roll=bullet.btQuaternion(right,-rele);

        m=bullet.btMatrix3x3(rot) * bullet.btMatrix3x3(roll)
        eyePos =m.apply(eyePos);

        self.m_cameraPosition=vector3.add(eyePos, self.m_cameraTargetPosition);

        if (self.m_glutScreenWidth == 0 and self.m_glutScreenHeight == 0):
            return;

        aspect = float(self.m_glutScreenWidth) / float(self.m_glutScreenHeight);
        assert(aspect!=0.0)

        extents=(aspect * 1.0, 1.0, 0.0);


        if (self.m_ortho):
            # reset matrix

            extents *= self.m_cameraDistance;
            lower = self.m_cameraTargetPosition - extents;
            upper = self.m_cameraTargetPosition + extents;

        else:
            pass
Пример #17
0
 def test_constructors(self):
     self.a = bullet.btMatrix3x3(bullet.btQuaternion.identity)
     self.b = bullet.btMatrix3x3(self.a)
     self.c = bullet.btMatrix3x3(0, 0, 0,
                                 0, 0, 0,
                                 1, 1, 1)
Пример #18
0
 def test_mul(self):
     self.a = bullet.btMatrix3x3(*self.v1)
     self.d = self.a * self.a
     self.a *= self.a
     self.assertEqual(self.a, self.d)
Пример #19
0
 def test_constructors(self):
     self.a = bullet.btMatrix3x3(bullet.btQuaternion.identity)
     self.b = bullet.btMatrix3x3(self.a)
     self.c = bullet.btMatrix3x3(0, 0, 0, 0, 0, 0, 1, 1, 1)
Пример #20
0
 def test_mul(self):
     self.a = bullet.btMatrix3x3(*self.v1)
     self.d = self.a * self.a
     self.a *= self.a
     self.assertEqual(self.a, self.d)