def test_rotation2d_from_vector(): theta = np.pi / 2 h**o = np.array([[0.0, -1.0, 0.0], [1.0, 0.0, 0.0], [0.0, 0.0, 1.0]], dtype=np.float64) tr = Rotation2D.identity().from_vector(theta) assert_allclose(tr.h_matrix, h**o, atol=1**-15)
def test_align_2d_rotation(): rotation_matrix = np.array([[0, 1], [-1, 0]]) rotation = Rotation(rotation_matrix) source = PointCloud(np.array([[0, 1], [1, 1], [-1, -5], [3, -5]])) target = rotation.apply(source) # estimate the transform from source and target estimate = Rotation2D.align(source, target) # check the estimates is correct assert_allclose(rotation.h_matrix, estimate.h_matrix, atol=1e-14)
def test_rotation2d_identity(): assert_allclose(Rotation2D.identity().h_matrix, np.eye(3))