Restoring third coordinate for triangle by its orthogonal projection and similar triangle Suppose we have triangle $\Delta OAB$ lying on plane $z=0$ with coordinates $O(0,0,0), A(x_a,y_a,0), B(x_b,y_b,0)$
Also there is triangle $\Delta EFG$, but we know only coordinates of its orthogonal projection on plane $z=0$. $E(x_e,y_e,0), F(x_f,y_f,z_f), G(x_g,y_g,z_g)$. So coordinates $z_f, z_g$ are unknown.
We know, that triangles are similar, so: $$\angle OAB = \angle EFG\\\angle ABO = \angle FGE\\ \angle BOA = \angle GEF$$
My hypothesis is that only finite number of pairs $z_f, z_g$ exists, that satisfies the above conditions (that may be wrong). If so - I need to find such pairs (prefer analytical answer).
I've tried the following approach and faced unsolvable system of equations. Some different approaches or hints for solving will help a lot.

*

*Rotate, scale and move triangle $\Delta EFG$, so it becomes $\Delta OCD$ with coordinates $O(0,0,0), C(x_c,y_c,z_c), D(x_b,y_b,z_d)$

*Use the law of sines to find relative sides:

Let $$CD = o $$
then $$OD = \frac{sin(\angle OCD)} {sin(\angle DOC)}\\OC = \frac{sin(\angle CDO)} {sin(\angle DOC)}$$
for simplicity $$OD = m*o\\OC = n*o$$
3)  Use distance formula to get system of 3 equations (with unknown $o, z_c, z_b$) I was unable to solve:
$\left\{ 
\begin{array}{c}
o = \sqrt{(x_c-x_b)^2 + (y_c-y_b)^2 + (z_c-z_d)^2}\\  
m*o = \sqrt{x_b^2 + z_d^2}\\
n*o = \sqrt{x_c^2 + y_c^2 + z_c^2}
\end{array}
\right.$

Thanks in advance!
Final result (based on @Robin's Premium Coffee answer):
$$K_1 := (x_f-x_g)^2+(y_f-y_g)^2\\
K_2 := (x_e-x_g)^2+(y_e-y_g )^2\\
K_3 := (x_e-x_f)^2+(y_e-y_f)^2\\
K_4 := \frac{b^2}{a^2}\\
K_5 := \frac{b^2 K_2}{a^2} -K_3\\
K_6 := K_4^2 a^4-2K_4 a^4+a^4-2K_4 a^2 o^2-2a^2 o^2+o^4\\
K_7 := 2K_1 a^4+2K_1 K_4 a^4-2K_5 a^4+2K_4 K_5 a^4-2K_1 a^2 o^2-2K_2 a^2 o^2-2K_2 K_4 a^2 o^2-2K_5 a^2 o^2+2K_2 o^4\\
K_8 := K_1^2 a^4+K_5^2 a^4+2K_1 K_5 a^4-2K_1 K_2 a^2 o^2-2K_2 K_5 a^2 o^2+K_2^2 o^4\\
z_g = \pm \sqrt{\frac{-K_7\pm\sqrt{K_7^2-4K_6K_8}}{2K_6}}\\
z_f = \pm \sqrt{K_4g^2+K_5}
$$
2 of 8 solutions are valid. It was enough for me to write a program to do all the calculations and check the results. Due to precision limitations equal triangles may cause discriminant to be negative (not a big problem).
 A: For $\triangle OAB$ we have
$ o^2 = \overline{AB}^2 , a^2 =\overline{OB}^2 , b^2 = \overline{OA}^2 $
And for $\triangle EFG$ we have
$ e^2 = \overline{FG}^2 = (x_f - xg)^2 + (y_f - y_g)^2 + (z_f - z_g)^2  = K_1 + (z_f - z_g)^2 $
$ f^2 = \overline{EG}^2 = (x_e - x_g)^2 + (y_e - y_g)^2 + (0 - z_g)^2 = K_2 + z_g^2 $
$ g^2 = \overline{EF}^2 = (x_e - x_f)^2 + (y_e - y_f)^2 + (0 - z_f)^2 = K_3 + z_f^2 $
Since $\triangle OAB$ is similar to $\triangle EFG$ then
$ o^2 = \alpha e^2 = \alpha ( K_1 + (z_f - z_g)^2 )$
$ a^2 = \alpha f^2 = \alpha (K_2 + z_g^2 )$
$ b^2 = \alpha g^2 = \alpha (K_3 + z_f^2 )$
Eliminating $\alpha$ from the above three equations we end up with two equations, involving $z_f$ and $z_g$
$ o^2 (K_2 + z_g^2 ) = a^2 (K_1 + (z_f - z_g)^2 )$
$ a^2 (K_3 + z_f^2 ) = b^2 (K_2 + z_g^2 ) $
Which are two quadratic equations in the two unknowns $ z_f$ and $z_g$ and have at most $4$ solutions.
And these solutions (if they exist) come in pairs that are mirror images about the plane $z=0$, because if $(z_f, z_g)$ is a solution, then so is $(-z_f, -z_g)$.
