コード例 #1
0
 def test_multiplication(self):
     """
     Multiplying one L{Quaternion} by another returns a new L{Quaternion}
     giving the product of the two.
     """
     a = Quaternion.fromAxisAngle(Vector3(1, 0, 0), pi / 4)
     b = Quaternion.fromAxisAngle(Vector3(1, 0, 0), pi / 6)
     c = a * b
     axis = c.getAxis()
     angle = c.getAngle()
     self.assertEqual(axis.x, 1)
     self.assertEqual(axis.y, 0)
     self.assertEqual(axis.z, 0)
     self.assertAlmostEqual(angle, pi / 4 + pi / 6, 6)
コード例 #2
0
ファイル: test_bullet.py プロジェクト: dgym/pybullet
 def test_multiplication(self):
     """
     Multiplying one L{Quaternion} by another returns a new L{Quaternion}
     giving the product of the two.
     """
     a = Quaternion.fromAxisAngle(Vector3(1, 0, 0), pi / 4)
     b = Quaternion.fromAxisAngle(Vector3(1, 0, 0), pi / 6)
     c = a * b
     axis = c.getAxis()
     angle = c.getAngle()
     self.assertEqual(axis.x, 1)
     self.assertEqual(axis.y, 0)
     self.assertEqual(axis.z, 0)
     self.assertAlmostEqual(angle, pi / 4 + pi / 6, 6)
コード例 #3
0
 def test_fromAxisAngle(self):
     """
     A L{Quaternion} can be constructed from a Vector3 giving an axis and a
     scalar giving an angle from that axis.
     """
     quat = Quaternion.fromAxisAngle(Vector3(0, 1, 0), 45)
     self.assertTrue(isinstance(quat, Quaternion))
コード例 #4
0
ファイル: test_bullet.py プロジェクト: dgym/pybullet
 def test_fromAxisAngle(self):
     """
     A L{Quaternion} can be constructed from a Vector3 giving an axis and a
     scalar giving an angle from that axis.
     """
     quat = Quaternion.fromAxisAngle(Vector3(0, 1, 0), 45)
     self.assertTrue(isinstance(quat, Quaternion))