I know the coordinates of 4 points, P1, P2, P3 and P4, in two Cartesian 3D coordinate systems, C1 and C2. For the sake of an example, let's say we have:
Point, C1 coords, C2 coords:
P1, (x1, y1, z1), (u1, v1, w1)
P2, (x2, y2, z2), (u2, v2, w2)
P3, (x3, y3, z3), (u3, v3, w3)
P4, (x4, y4, z4), (u4, v4, w4)
Given these points, how can I devise a way to convert any point from C2 into C1? I am guessing that I only need 3 points (assuming they can define a plane in each coordinate system), and that I will need a translation/rotation/scale matrix? I read several answers to coordinate system conversion questions, but none of them start out with simple points, and I still don't know where to begin.
We’re looking for some affine transformation that connects the two Cartesian coordinate systems. That is, we want each coordinate in one of them to be an affine function of the coordinates in the other. Using homogeneous coordinates, this condition can be represented in matrix form as $$\mathbf M\mathbf x=\begin{bmatrix}m_{11}&m_{12}&m_{13}&m_{14}\\m_{21}&m_{22}&m_{23}&m_{24}\\m_{31}&m_{32}&m_{33}&m_{34}\\0&0&0&1\end{bmatrix}\begin{bmatrix}x\\y\\z\\1\end{bmatrix}=\begin{bmatrix}u\\v\\w\\1\end{bmatrix}.$$ We have four pairs of corresponding coordinates of points, so finding the coefficients $m_{ij}$ of the transformation matrix amounts to solving a system of linear equations. We can do this in bulk by packaging these coordinate vectors up into matrices so that we have $$\mathbf M\begin{bmatrix}x_1&x_2&x_3&x_4\\y_1&y_2&y_3&y_4\\z_1&z_2&z_3&z_4\\1&1&1&1\end{bmatrix}=\begin{bmatrix}u_1&u_2&u_3&u_4\\v_1&v_2&v_3&v_4\\w_1&w_2&w_3&w_4\\1&1&1&1\end{bmatrix}$$ or $\mathbf M\mathbf X=\mathbf U$ for short. If the points aren’t coplanar (i.e., the homogeneous vectors are linearly independent), then $\mathbf X$ is nonsingular and we can solve this forthwith: $\mathbf M=\mathbf U\mathbf X^{-1}$. If not, then you will have one or two axes unaccounted for. You can still find a transformation from one coordinate plane (or line) to the other, and can then choose an arbitrary mapping for the remaining degrees of freedom. Since you want Cartesian coordinate systems, choosing axes that are perpendicular to the planes seems like the way to go.