function for affine transformation and test script