The Three-point Warp (Shift, Scale separately in X and Y, and Rotate)

The three-point warp uses the following transformation

x_new = A + Bx + Cy

y_new = D + Ex + Fy

(where "x" and "y" are the original points, and "x_new" and "y_new" are the transformed or warped points).

To calculate the coefficients, the "new" X values are considered as Z values, plotted at the original three (X, Y) locations, and a plane is fit through the "Z" values. This provides a transformation to give X_new at any (X, Y). The same process is done for Y.

To expand, the coefficients A, B, and C above are calculated by solving the following set of equations for the three sets of points input when you define the warp:

X_new[1] = A + B*x[1] + C*y[1]

X_new[2] = A + B*x[2] + C*y[2]

X_new[3] = A + B*x[3] + C*y[3]

And D, E, and F are solved using

Y_new[1] = D + E*x[1] + F*y[1]

Y_new[2] = D + E*x[2] + F*y[2]

Y_new[3] = D + E*x[3] + F*y[3]

Because we must solve for planes, it is necessary for the three points not to be co-linear.

The Three-point warp method extended to more than 3 points

The three-point method can be expanded beyond 3 points, in which case a least-squares fit is used to calculate the new "X" and "Y" planes. In that case, the warped "X" and "Y" axis lines might not be orthogonal, and the warp points themselves might not be exactly duplicated.