Ejemplo n.º 1
0
 def test_transform_matrix_rotation_only_correct(self):
     from e3fp.fingerprint.array_ops import make_transform_matrix, \
                                            as_unit, pad_array, \
                                            unpad_array, Y_AXIS
     for i in range(1, 5):
         center = np.zeros(3, dtype=np.float)
         arr = np.random.uniform(size=(i, 3)) + center
         y = arr[0, :]
         trans_mat = make_transform_matrix(center, y)
         pad_arr = pad_array(arr)
         rot_arr = unpad_array(np.dot(trans_mat, pad_arr.T).T)
         y0 = as_unit(rot_arr[0, :])
         np.testing.assert_array_almost_equal(y0.flatten(),
                                              Y_AXIS.flatten())
Ejemplo n.º 2
0
 def test_transform_matrix_with_translation_correct(self):
     from e3fp.fingerprint.array_ops import make_transform_matrix, \
                                            as_unit, pad_array, \
                                            unpad_array, Y_AXIS
     for i in range(2, 7):
         arr = np.random.uniform(size=(i, 3))
         center = arr[0, :]
         y = arr[1, :] - center
         trans_mat = make_transform_matrix(center, y)
         pad_arr = pad_array(arr)
         rot_arr = unpad_array(np.dot(trans_mat, pad_arr.T).T)
         c0 = rot_arr[0, :]
         y0 = as_unit(rot_arr[1, :])
         np.testing.assert_array_almost_equal(c0.flatten(), np.zeros(3))
         np.testing.assert_array_almost_equal(y0.flatten(),
                                              Y_AXIS.flatten())
Ejemplo n.º 3
0
 def test_two_axis_transform_correct1(self):
     from e3fp.fingerprint.array_ops import make_transform_matrix, \
                                            as_unit, pad_array, \
                                            unpad_array, Y_AXIS
     for i in range(3, 8):
         arr = np.random.uniform(size=(i, 3))
         center = arr[0, :]
         y = arr[1, :] - center
         z = arr[2, :] - center
         trans_mat = make_transform_matrix(center, y, z)
         pad_arr = pad_array(arr)
         rot_arr = unpad_array(np.dot(trans_mat, pad_arr.T).T)
         c0 = rot_arr[0, :]
         y0 = as_unit(rot_arr[1, :])
         z0 = as_unit(rot_arr[2, :])
         np.testing.assert_array_almost_equal(c0.flatten(), np.zeros(3))
         np.testing.assert_array_almost_equal(y0.flatten(),
                                              Y_AXIS.flatten())
         self.assertAlmostEqual(z0[0], 0.)