How to find 3D point of a triangle in a 3D space

314 Views Asked by At

I have a triangle in $3D$ space, with $2$ points defined (lets call them $A(x_1, y_1, z_1)$ and $B(x_2, y_2, z_2)$) and distances to the $3^{rd}$ point known (lets call it $C(x_3, y_3, z_3$)) as well as the $z_3$ known.

I need to make a universal formula to find $C$, given coordinates of $A$ and $B$ and the distances $AC$ and $BC$. I can calculate the coordinates for specific points, but I cant wrap my head around creating a universal formula for it.

1

There are 1 best solutions below

0
On BEST ANSWER

Move all points by $-(x_1,y_1,z_1)$ and solve the system

$$\begin{cases}x^2+y^2=d_{13}^2-z_3^2 \\(x-x_2)^2+(y-y_2)^2=d_{23}^2-(z_3-z_2)^2.\end{cases}$$

By subtraction, the second equation becomes linear in $x,y$:

$$-2x_2x-2y_2y+x_2^2+y_2^2=d_{23}^2-(z_3-z_2)^2-d_{13}^2+z_3^2.$$

Now express $y$ in terms of $x$, plug in the first equation and solve the quadratic equation in $x$.


You can get a more elegant solution as follows:

  • consider the intersection of the spheres centered at $A$ and $B$ by the plane $z=z_3$ and you get a planar problem: intersect two circles of known centers and radii;

  • translate the first center to the origin, then rotate so that the second center comes on $x$; now the equations are

$$\begin{cases}x^2+y^2=r_1^2,\\(x-d)^2+y^2=r_2^2.\end{cases}$$

By subtraction, you get a linear equation in $x$. From $x$ you get two $y$. Apply the inverse rotation and translation.

$$x=\frac{d^2-r_2^2+r_1^2}{2d},y=\pm\sqrt{r_1^2-x^2}.$$