Exemplo n.º 1
0
def test_concat():
    targ = [[SQRT2, 0, SQRT2, 0], [.5, SQRT2, -.5, 0], [-.5, SQRT2, .5, 0],
            [0, 0, 0, 1]]

    I = Transform(np.eye(4))

    rx = Transform(np.eye(4))
    rx.rotx(45)

    ry = Transform(np.eye(4))
    ry.roty(45)

    I.concatenate_matrix(rx.tform)
    I.concatenate_matrix(ry.tform)

    assert approx(I.tform) == targ

    # overload
    I2 = Transform(np.eye(4))
    X = I2 * rx * ry
    assert approx(X.tform) == targ
Exemplo n.º 2
0
def test_roty():
    I = Transform(np.eye(4))
    I.roty(45)
    assert approx(I.tform) == [[SQRT2, 0, SQRT2, 0], [0, 1, 0, 0],
                               [-SQRT2, 0, SQRT2, 0], [0, 0, 0, 1]]