added code that computes the scaling of an affine transform