Construct an affine transformation of a plane given the images of three points

4.1k Views Asked by At

Consider a plane $\mathbb{R}^2$ and an affine transformation $T: \mathbb{R}^2\to \mathbb{R}^2$ that maps points $A,B,C$ to points $A',B',C'$ correspondingly. We know that $A,B,C$ are not on the same straight line and so $T$ is determined uniquely. Given an arbitrary point $M$ how to find $T(M)$?

Basically, I'm trying to write a program that takes as input 14 numbers—the coordinates of the points $A,B,C, A',B',C',M$ and outputs two numbers—the coordinates of $M'=T(M)$, provided $A,B,C$ are not on the same straight line. How should I proceed?

3

There are 3 best solutions below

4
On BEST ANSWER

A general affine map in the plane will be of the form $$T(x,y) = (ax+by+c,dx+ey+f)$$ From the three point-image pairs you can construct the system of equations $$A_1' = aA_1+bA_2 + c \\ A_2' = dA_1 + eA_2 + f \\ B_1' = aB_1+bB_2 + c \\ B_2' = dB_1 + eB_2 + f \\ C_1' = aC_1+bC_2 + c \\ C_2' = dC_1 + eC_2 + f$$ This can be written as a matrix equation: $$\begin{bmatrix} A_1 & A_2 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & A_1 & A_2 & 1 \\ B_1 & B_2 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & B_1 & B_2 & 1 \\ C_1 & C_2 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & C_1 & C_2 & 1\end{bmatrix}\begin{bmatrix} a \\ b \\ c \\ d \\ e \\ f\end{bmatrix} = \begin{bmatrix} A_1' \\ A_2' \\ B_1'\\ B_2' \\ C_1' \\ C_2'\end{bmatrix}$$

Solve it to get the constants that describe your affine map.

1
On

You need only 2 points for that, but have to know that they are linearly independent ( if you are programming it, it should be easy, put every 2 vectors as rows of a matrix, use row reduction and get whether they are linearly independent). Take these 2 vectors after the linear transformation, say A' and B', put these 2 vectors as columns in a matrix, and do matrix multiplication with the vector M, and there you get it, the vector M'. pay attention that if A,B and C, are linearly dependent, you need more vectors to map the transformation.

Hope this will be useful. Good luck.

0
On

If you use homogeneous coordinates, the map is quite easy to construct. Recall that the columns of a transformation matrix are images of basis vectors, so the homogeneous matrix $$V=\begin{bmatrix}A&B&C\\1&1&1\end{bmatrix}$$ maps the standard basis to the vectors with coordinates given by $A$, $B$, $C$, respectively, in the standard basis. The inverse of this matrix maps these vectors to the standard basis vectors, so $$T=\begin{bmatrix}A'&B'&C'\\1&1&1\end{bmatrix}\begin{bmatrix}A&B&C\\1&1&1\end{bmatrix}^{-1}$$ is the matrix that performs the desired mapping.