Пример #1
0
 def test_x_rotation(self):
     half_sqrt2 = 0.5 * np.sqrt(2)
     angle_axis = torch.Tensor([tgm.pi / 2, 0, 0])
     expected = torch.Tensor([half_sqrt2, half_sqrt2, 0, 0])
     quaternion = tgm.angle_axis_to_quaternion(angle_axis)
     assert utils.check_equal_torch(quaternion, expected)
Пример #2
0
 def test_small_angle(self):
     theta = 1e-2
     angle_axis = torch.Tensor([theta, 0, 0])
     expected = torch.Tensor([np.cos(theta / 2), np.sin(theta / 2), 0, 0])
     quaternion = tgm.angle_axis_to_quaternion(angle_axis)
     assert utils.check_equal_torch(quaternion, expected)
Пример #3
0
 def test_smoke_batch(self, batch_size):
     angle_axis = torch.zeros(batch_size, 3)
     quaternion = tgm.angle_axis_to_quaternion(angle_axis)
     assert quaternion.shape == (batch_size, 4)
Пример #4
0
 def test_zero_angle(self):
     angle_axis = torch.Tensor([0, 0, 0])
     expected = torch.Tensor([1, 0, 0, 0])
     quaternion = tgm.angle_axis_to_quaternion(angle_axis)
     assert utils.check_equal_torch(quaternion, expected)
Пример #5
0
 def test_smoke(self):
     angle_axis = torch.zeros(3)
     quaternion = tgm.angle_axis_to_quaternion(angle_axis)
     assert quaternion.shape == (4, )