lm2affine function

Computes model for the affine transformation