Given that I have the locations of three points:
p1 = [1.0,1.0,1.0]
p2 = [1.0,2.0,1.0]
p3 = [1.0,1.0,2.0]
...and I know their transformed counterparts:
p1_prime = [2.414213562373094, 5.732050807568877, 0.7320508075688767]
p2_prime = [2.7677669529663684, 6.665063509461097, 0.6650635094610956]
p3_prime = [2.7677669529663675, 5.665063509461096, 1.6650635094610962]
...how can I determine the transformation matrix such that:
[point]∙[transf.matrix]=[point_prime]
I know from a CAD program the answer is:
[0.866025403784,-0.353553390593,-0.353553390593,0.000000000000]
[0.353553390593,0.933012701892,-0.066987298108,0.000000000000]
[0.353553390593,-0.066987298108,0.933012701892,0.000000000000]
[0.841081377402,5.219578794378,0.219578794378,1.000000000000]
...but I'm wondering how I can derive this?
I usually create a system of equations like $$\begin{cases} \begin{bmatrix} 1 & 1 & 1 \end{bmatrix} A = \begin{bmatrix} 1 & 0 & 0 \end{bmatrix}A + \begin{bmatrix} 0 & 1 & 0 \end{bmatrix}A + \begin{bmatrix} 0 & 0 & 1 \end{bmatrix}A \\ \begin{bmatrix} 1 & 2 & 1 \end{bmatrix} A = \begin{bmatrix} 1 & 0 & 0 \end{bmatrix}A + 2\begin{bmatrix} 0 & 1 & 0 \end{bmatrix}A + \begin{bmatrix} 0 & 0 & 1 \end{bmatrix}A \\ \begin{bmatrix} 1 & 1 & 2 \end{bmatrix} A = \begin{bmatrix} 1 & 0 & 0 \end{bmatrix}A + \begin{bmatrix} 0 & 1 & 0 \end{bmatrix}A + 2\begin{bmatrix} 0 & 0 & 1 \end{bmatrix}A\end{cases}$$
And I solve for $\begin{bmatrix} 1 & 0 & 0 \end{bmatrix}A$, $\begin{bmatrix} 0 & 1 & 0 \end{bmatrix}A$, and $\begin{bmatrix} 0 & 0 & 1 \end{bmatrix}A$. Here it's easy to prove that $\begin{bmatrix} 1 & 0 & 0 \end{bmatrix}A$ is just the first row of $A$. Likewise $\begin{bmatrix} 0 & 1 & 0 \end{bmatrix}A$ is the second row, and $\begin{bmatrix} 0 & 0 & 1 \end{bmatrix}A$ is the last row.
I don't know if this is the most efficient way of doing it for programming (you'd have to ask a programmer), but it works fast enough (for me) when I'm calculating small systems by hand.