Exemplo n.º 1
0
def test_pivot_rotate_point():

    point = [1, 2, 3]

    new_orig = np.array([10., 45., 50.])

    t = gtr.Translation(new_orig)
    t_inv = gtr.Translation(new_orig * -1)

    R = gtr._rodrigues_to_dcm(TEST_UVEC, np.pi)

    # change origin, rotate 180
    p1 = gtr.PivotRotation(R, new_orig)(point)

    # do the steps manually
    p2 = t_inv(point)
    p2 = gtr.Rotation(R)(p2)
    p2 = t(p2)

    assert p1.tolist() == p2.tolist()
Exemplo n.º 2
0
def test_pivot_rotate_points():

    points = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]])

    new_orig = np.array([10., 45., 50.])

    t = gtr.Translation(new_orig)
    t_inv = gtr.Translation(new_orig * -1)

    R = gtr._rodrigues_to_dcm(TEST_UVEC, np.pi)

    # change origin, rotate 180
    p1 = gtr.PivotRotation(R, new_orig)(points)

    # do the steps manually
    p2 = t_inv(points)
    p2 = gtr.Rotation(R)(p2)
    p2 = t(p2)

    nt.assert_true(np.all(p1 == p2))