def test_transforms():
 xfm = np.random.randn(4, 4).astype(np.float32)
 new_xfm = xfm.dot(rotate(180, (1, 0, 0)).dot(rotate((-90), (0, 1, 0))))
 new_xfm = new_xfm.dot(rotate(90, (0, 0, 1)).dot(rotate(90, (0, 1, 0))))
 new_xfm = new_xfm.dot(rotate(90, (1, 0, 0)))
 assert_allclose(xfm, new_xfm)
 new_xfm = translate((1, (-1), 1)).dot(translate(((-1), 1, (-1)))).dot(xfm)
 assert_allclose(xfm, new_xfm)
 new_xfm = scale((1, 2, 3)).dot(scale((1, (1.0 / 2.0), (1.0 / 3.0)))).dot(xfm)
 assert_allclose(xfm, new_xfm)
 xfm = ortho((-1), 1, (-1), 1, (-1), 1)
 assert_equal(xfm.shape, (4, 4))
 xfm = frustum((-1), 1, (-1), 1, (-1), 1)
 assert_equal(xfm.shape, (4, 4))
 xfm = perspective(1, 1, (-1), 1)
 assert_equal(xfm.shape, (4, 4))

def test_transforms ( ) : xfm = np . random . randn ( 4 , 4 ) . astype ( np . float32 ) new_xfm = xfm . dot ( rotate ( 180 , ( 1 , 0 , 0 ) ) . dot ( rotate ( ( - 90 ) , ( 0 , 1 , 0 ) ) ) ) new_xfm = new_xfm . dot ( rotate ( 90 , ( 0 , 0 , 1 ) ) . dot ( rotate ( 90 , ( 0 , 1 , 0 ) ) ) ) new_xfm = new_xfm . dot ( rotate ( 90 , ( 1 , 0 , 0 ) ) ) assert_allclose ( xfm , new_xfm ) new_xfm = translate ( ( 1 , ( - 1 ) , 1 ) ) . dot ( translate ( ( ( - 1 ) , 1 , ( - 1 ) ) ) ) . dot ( xfm ) assert_allclose ( xfm , new_xfm ) new_xfm = scale ( ( 1 , 2 , 3 ) ) . dot ( scale ( ( 1 , ( 1.0 / 2.0 ) , ( 1.0 / 3.0 ) ) ) ) . dot ( xfm ) assert_allclose ( xfm , new_xfm ) xfm = ortho ( ( - 1 ) , 1 , ( - 1 ) , 1 , ( - 1 ) , 1 ) assert_equal ( xfm . shape , ( 4 , 4 ) ) xfm = frustum ( ( - 1 ) , 1 , ( - 1 ) , 1 , ( - 1 ) , 1 ) assert_equal ( xfm . shape , ( 4 , 4 ) ) xfm = perspective ( 1 , 1 , ( - 1 ) , 1 ) assert_equal ( xfm . shape , ( 4 , 4 ) )
test transformations .