Ejemplo n.º 1
0
def test_relative_rotation(pairs_and_their_E):
    for f1, _, _, _ in pairs_and_their_E:

        vec_x = np.random.rand(3)
        vec_x /= np.linalg.norm(vec_x)
        vec_y = np.array([-vec_x[1], vec_x[0], 0.0])
        vec_y /= np.linalg.norm(vec_y)
        vec_z = np.cross(vec_x, vec_y)

        rotation = np.array([vec_x, vec_y, vec_z])

        f1 /= np.linalg.norm(f1, axis=1)[:, None]
        f2 = [rotation.dot(x) for x in f1]

        result = pygeometry.relative_rotation_n_points(f1, f2)

        assert np.allclose(rotation, result, rtol=1e-10)
Ejemplo n.º 2
0
def test_relative_rotation(pairs_and_their_E) -> None:
    for f1, _, _, _ in pairs_and_their_E:

        vec_x = np.random.rand(3)
        vec_x /= np.linalg.norm(vec_x)
        vec_y = np.array([-vec_x[1], vec_x[0], 0.0])
        vec_y /= np.linalg.norm(vec_y)
        vec_z = np.cross(vec_x, vec_y)

        rotation = np.array([vec_x, vec_y, vec_z])

        f1 /= np.linalg.norm(f1, axis=1)[:, None]
        f2 = [rotation.dot(x) for x in f1]

        # pyre-fixme[6]: For 2nd param expected `ndarray` but got `List[typing.Any]`.
        result = pygeometry.relative_rotation_n_points(f1, f2)

        assert np.allclose(rotation, result, rtol=1e-10)