Esempio n. 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)
Esempio n. 2
0
 def test_length(self):
     result = quaternion.length([1., 1., 1., 1.])
     np.testing.assert_almost_equal(result, 2., decimal=5)
Esempio n. 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)
Esempio n. 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)
Esempio n. 5
0
 def test_length_identity(self):
     result = quaternion.length([0., 0., 0., 1.])
     np.testing.assert_almost_equal(result, 1., decimal=5)
Esempio n. 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)
Esempio n. 7
0
 def test_length(self):
     result = quaternion.length([1., 1., 1., 1.])
     np.testing.assert_almost_equal(result, 2., decimal=5)
Esempio n. 8
0
 def test_length_identity(self):
     result = quaternion.length([0., 0., 0., 1.])
     np.testing.assert_almost_equal(result, 1., decimal=5)
Esempio n. 9
0
 def test_length(self):
     q = Quaternion.from_x_rotation(np.pi / 2.0)
     self.assertTrue(np.allclose(q.length, quaternion.length(q)))
Esempio n. 10
0
 def test_length(self):
     q = Quaternion.from_x_rotation(np.pi / 2.0)
     self.assertTrue(np.allclose(q.length, quaternion.length(q)))