Let $A=(a,b,c)$, $B=(d,e,f)$ and $C=(g,h,i)$ be points in the $3$-dimensional real vector space.
It is well known that we can consider a new referential where we can see these points as $A'=(0,0,0)$, $B'=(\alpha,0,0)$ and $C'=(\beta,\gamma,\delta)$.
What are the functions which we have to apply to get it?
One of them is a simple translation, but we also need one rotation that I am not sure how to get it.
I'm not sure how explicit you want me to be.
Basically, you could convert the point B (after translation) to spherical coordinates, do one rotation with respect to the xy-plane by its angle $\theta$, and another rotation with respect to the xz-plane by its angle $\phi$. This would position it on the x-axis. So you would multiply to matrices, the first being something like $$\begin{bmatrix}\cos(\theta)&-\sin(\theta)&0\\ \sin(\theta)&\cos(\theta)&0\\ 0&0&1\end{bmatrix}$$ and the second one would be roughly the same but with a new angle and wrt the other plane.
Note that $$\theta=\arctan\left({y\over x}\right),\hspace{3mm}\phi=\arctan\left(\frac{\sqrt{x^2+y^2}}{z}\right)$$ Those formulas can give you a lot of sign trouble, so be sure to use more accurate functions (like the "atan2" used by most programmers nowadays).