コード例 #1
0
 def test_inverse_non_unit(self):
     q = [1, 2, 3, 4]
     result = quaternion.inverse(q)
     expected = quaternion.conjugate(q) / quaternion.length(q)
     np.testing.assert_almost_equal(result, expected, decimal=5)
コード例 #2
0
 def test_length(self):
     result = quaternion.length([1., 1., 1., 1.])
     np.testing.assert_almost_equal(result, 2., decimal=5)
コード例 #3
0
 def test_length_batch(self):
     result = quaternion.length([
         [0., 0., 0., 1.],
         [1., 1., 1., 1.],
     ])
     np.testing.assert_almost_equal(result, [1., 2.], decimal=5)
コード例 #4
0
 def test_inverse_non_unit(self):
     q = [1, 2, 3, 4]
     result = quaternion.inverse(q)
     expected = quaternion.conjugate(q) / quaternion.length(q)
     np.testing.assert_almost_equal(result, expected, decimal=5)
コード例 #5
0
 def test_length_identity(self):
     result = quaternion.length([0., 0., 0., 1.])
     np.testing.assert_almost_equal(result, 1., decimal=5)
コード例 #6
0
 def test_length_batch(self):
     result = quaternion.length([
         [0., 0., 0., 1.],
         [1., 1., 1., 1.],
     ])
     np.testing.assert_almost_equal(result, [1., 2.], decimal=5)
コード例 #7
0
 def test_length(self):
     result = quaternion.length([1., 1., 1., 1.])
     np.testing.assert_almost_equal(result, 2., decimal=5)
コード例 #8
0
 def test_length_identity(self):
     result = quaternion.length([0., 0., 0., 1.])
     np.testing.assert_almost_equal(result, 1., decimal=5)
コード例 #9
0
ファイル: test_quaternion.py プロジェクト: kthulhu/Pyrr
 def test_length(self):
     q = Quaternion.from_x_rotation(np.pi / 2.0)
     self.assertTrue(np.allclose(q.length, quaternion.length(q)))
コード例 #10
0
ファイル: test_quaternion.py プロジェクト: abarch/Pyrr
 def test_length(self):
     q = Quaternion.from_x_rotation(np.pi / 2.0)
     self.assertTrue(np.allclose(q.length, quaternion.length(q)))