# Finding one point with three distances and three angles in 3D

I am having a bit of a complicated maths problem and am hoping someone might help or have a suggestion.

My problem concerns finding the location of a point P in 3D. From this point there are three lines to point A,B and C, respectively lines pa, pb and pc. Given are:

• The locations (x,y,z) of points A,B and C
• The distances between A-B, B-C and C-A: d1, d2 and d3
• The angles between pa-pb, pb-pc and pc-pa: alpha_1, alpha_2, alpha_3

I have made a schematic overview here: https://imgur.com/FfZMpMS

I am hoping any one has a suggestion how to find point P from this information, or perhaps even that sweet analytical solution.

I already have a start, but it seems more complicated then necessary. First find a solution for two points in 3D.

1. In 2D you can find a circle with center C, for point P if you have a distance d1 and angle_1. This image shows the result: https://imgur.com/iyEGR9n

2. If you expand this problem to 3D, you have to rotate it around the line of d1. The circle center C now forms a new circle with center C2 in the middle of the line of d2. The results is shown here: https://imgur.com/Ux5wo6a

3. When the 2D circle with center C is rotated around line d1, a torus is found. On this torus lie all points P for which angle_1 and distance d1 are constant : https://imgur.com/BAZIZMF

4. Now, if you have more points and angles, you have to find an intersection of toruses, which is really not nice.

That's how far I've gotten. Please let me know if you have a suggestion.

A bit of side note, in reality I have 6-10 distances and angles, but I would expect that for 3 points the solution is easier.

Regards, Matlab M.

• You can solve this down to two points, symmetrically placed about the plane through $A, B, C$. But there is no information given that will allow you to distinguish between those two points to figure out which one $P$ is actually at. I don't know how serious an issue this is for your application. If it is, you might consider also determining when seen from $P$, whether $A \to B \to C$ is seen in clockwise order or counter-clockwise. – Paul Sinclair Apr 21 '19 at 0:33
• But since you have more points, I guess that isn't a problem after all, as a 4th point would allow you to choose between the two solutions for $A, B, C$. – Paul Sinclair Apr 21 '19 at 0:52
• Hi @PaulSinclair, I'm not sure what you mean. Do you say that point P should lie on a plane through A,B and C? Because this is not something I would expect. I am expecting that the point P lies out of this plane as in imgur.com/FfZMpMS. Note that the image is in 3D. – Matlab M. Apr 21 '19 at 11:18
• No. I mean that if you have a solution point, then take the reflection of that point through the plane, the reflected point will also be a solution. The angles it makes with $A, B, C$ will be the same as the original point. – Paul Sinclair Apr 21 '19 at 15:43
• @PaulSinclair, Okay thanks I understand and agree. I do still have to find one or both of those points though :) – Matlab M. Apr 21 '19 at 16:15

Here is the outline of another approach, which may be easier than solving the inner product equations.

Establish another coordinate system with $$P$$ as the origin. Call them P-coordinates. Choose the points $$A, B, C$$ such that the angle between $$A$$ and $$B$$ is not zero. Choose the direction of $$A$$ as the positive $$x$$-axis, and choose the $$y$$-axis so that $$B$$ lies in the $$xy$$-plane with positive $$y$$-coordinate. The positive $$z$$-axis is then established by the right-hand rule. If $$a,b,c$$ are the distances from $$P$$ to the points $$A,B,C$$, then $$A = a(1,0,0)_P = a\hat A$$ and $$B = b(\cos \theta_{AB}, \sin \theta_{AB}, 0)_P = b\hat B$$. Letting $$\hat C$$ be the unit vector in the direction of $$C$$, we have \begin{align}\hat A\cdot \hat C &= \cos \theta_{AC}\\\hat B\cdot \hat C &= \cos \theta_{BC}\\\hat C\cdot \hat C &= 1\end{align}

If $$\hat C = (c_1, c_2, c_3)_P$$, then the first equation says $$c_1 = \cos \theta_{AC}$$, and then the second gives us $$c_2 = \frac{\cos \theta_{BC}-\cos \theta_{AB}\cos \theta_{AC}}{\sin \theta_{AB}}$$ Finally, the third gives us $$c_3 = \pm\sqrt{1 - c_1^2 - c_2^2}$$

That indeterminancy in the sign of $$c_3$$ is the same problem mentioned in the comments. There are actually two possible locations for $$P$$ having the correct angles. The positive sign will correspond to $$P$$ being in one of those locations, the negative sign in the other. To distinguish between them, you can take another of the points $$D$$ (not in a line with $$P$$ and any of the existing points), figure out its P-coordinates in the same fashion, then see which of the four possible sign choices ($$D$$ will also have its own indeterminancy in sign) results in the known angle between $$C$$ and $$D$$.

Once $$\hat C$$ is determined, $$C$$ itself is given by $$C = c\hat C$$. Now $$a,b,c$$ are not yet known. The law of cosines says $$d^2_{AB} = a^2 + b^2 - 2ab\cos \theta_{AB}\\d^2_{AC} = a^2 + c^2 - 2ac\cos \theta_{AC}\\d^2_{BC} = b^2 + c^2 - 2bc\cos \theta_{BC}$$

Solve these equations for $$a,b,c$$ (take the positive solutions), and now you know the locations of $$A,B,C$$ in P-coordinates. Of course, what we want is $$P$$ in normal coordinates. So follow these steps:

• Move the origin of P-coordinates from $$P$$ to $$A$$ by subtracting $$(a,0,0)$$ from the P-coordinates for $$B, C, P$$. $$P$$ will now be at $$(-a, 0, 0)_P$$.
• Move the origin of normal coordinates to $$A$$ by subtracting the $$A$$ from $$B$$ and $$C$$.
• Find the vectors $$\hat m = \frac{B-A}{d_{AB}}, \hat n = \frac{C-A}{d_{AC}}$$, and $$\hat l = \hat m \times \hat n$$ in both normal coordinates and P-coordinates (both with origins now at $$A$$).
• Letting $$\vec p = P - A = (-a,0,0)_P$$, express $$\vec p = p_m\hat m + p_n\hat n + p_l\hat l$$ in P-coordinates.
• But then, the same relationship holds in normal coordinates, so use it to calculate $$\vec p$$ in normal coordinates.

Add $$\vec p$$ in normal coordinates to the original coordinates of $$A$$ to get $$P$$ in normal coordinates.