Ejemplo 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)
Ejemplo n.º 2
0
 def test_length(self):
     result = quaternion.length([1., 1., 1., 1.])
     np.testing.assert_almost_equal(result, 2., decimal=5)
Ejemplo 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)
Ejemplo 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)
Ejemplo n.º 5
0
 def test_length_identity(self):
     result = quaternion.length([0., 0., 0., 1.])
     np.testing.assert_almost_equal(result, 1., decimal=5)
Ejemplo 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)
Ejemplo n.º 7
0
 def test_length(self):
     result = quaternion.length([1., 1., 1., 1.])
     np.testing.assert_almost_equal(result, 2., decimal=5)
Ejemplo n.º 8
0
 def test_length_identity(self):
     result = quaternion.length([0., 0., 0., 1.])
     np.testing.assert_almost_equal(result, 1., decimal=5)
Ejemplo 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)))
Ejemplo 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)))