Find linear transformation matrix and translation vector given 4 points before deformation and after deformation

matricestransformation

I have 4 points in 3D space: $\vec{X_{01}}$, $\vec{X_{02}}$, $\vec{X_{03}}$, $\vec{X_{04}}$. These 4 points undergo a linear transformation by a matrix $[T]$ and a translation by a vector $\vec{V}$ to produce 4 deformed points: $\vec{X_{1}}$, $\vec{X_{2}}$, $\vec{X_{3}}$, $\vec{X_{4}}$. The governing equation for the transformation of each point is given by:

$$\vec{V} + \Big[T \Big] \vec{X_{01}} = \vec{X_{1}}$$
$$\vec{V} + \Big[T \Big] \vec{X_{02}} = \vec{X_{2}}$$
$$\vec{V} + \Big[T \Big] \vec{X_{03}} = \vec{X_{3}}$$
$$\vec{V} + \Big[T \Big] \vec{X_{04}} = \vec{X_{4}}$$

If I know what the points are before and after deformation, how can I find out $[T]$ and $\vec{V}$? There are 12 unknowns and 12 equations, so it should be possible.

Best Answer

I found the answer. One way is to expand out everything and write it in "bulk" form. However, this involves a very sparse matrix. In a compact block form, the solution looks like this:

$$ \begin{bmatrix} \vec{V}^T\\ [T]^T \end{bmatrix} = \begin{bmatrix} 1 && \vec{X_{01}}^T\\ 1 && \vec{X_{02}}^T\\ 1 &&\vec{X_{03}}^T\\ 1 &&\vec{X_{04}}^T \end{bmatrix}^{-1} \begin{bmatrix} \vec{X_{1}}^T\\ \vec{X_{2}}^T\\ \vec{X_{3}}^T\\ \vec{X_{4}}^T \end{bmatrix} $$

Edit: I realized transposing both sides makes for a simpler answer:

$$ \begin{bmatrix} \vec{V} && [T] \end{bmatrix} = \begin{bmatrix} \vec{X_{1}} && \vec{X_{2}} && \vec{X_{3}} && \vec{X_{4}} \end{bmatrix}\begin{bmatrix} 1 && 1 && 1 && 1\\ \vec{X_{01}} && \vec{X_{02}} && \vec{X_{03}} && \vec{X_{04}} \end{bmatrix}^{-1}$$