added affine transformation