How to find the third vertex of a triangle when lengths are unequal

898 Views Asked by At

I have two vertices of a triangle and the lengths are unequal. How to find the third vertex?Reference

As the lengths are unequal, I dont know, how to proceed this. Whereas when the lengths are equal, I have solved the same when the lengths are equal for isosceles triangle.

I have come across https://github.com/lemmingapex/trilateration i.e., nD trilateration using non linear least square, Whereas I dont know how to proceed this?

2

There are 2 best solutions below

2
On BEST ANSWER

You need to solve the set of equations: $$ (x-x_2)^2+(y-y_2)^2 = d_1^2$$ $$ (x-x_3)^2+(y-y_3)^2 = d_3^2$$ By subtracting one from another you get $$ 2(x_3-x_2)x + 2(y_3-y_2)y + (x_2^2-x_3^2+y_2^2-y_3^2) = d_1^2 - d_3^2 $$ which allows you to find $y(x)$ as a linear function. Substitute it to one of the previous equations and you'll get a quadratic equation on $x$.

0
On

Direct method, without solving equations:

Denote the vertices of the trianlge $V_1, \, V_2, \, V_3$ as show on your picture. You are given the coordinates of vertices $V_1 = (x_2, y_2)$ and $V_2 = (x_3, y_3)$ as well as the lengths of the following side of the triangle $V_1V_2V_3$: $$d_1 = |V_1V_2| \,\, \text{ and } \,\, d_3 = |V_3V_1|$$

Step 1: Calculate the side length between vertices $2$ and $3$ $$d_2 = \sqrt{(x_3 - x_2)^2 + (y_3 - y_2)^2 \,}$$

Step 2: If we denote by $\theta_2 = \angle \, V_1V_2V_3$ the angle of the triangle at vertex $V_2$, then by the Law of Cosines: $$d_3^2 = d_1^2 + d_2^2 - 2\,d_1 d_2\cos(\theta_2) $$ which can be transformed into $$d_1 \cos(\theta_2) = \frac{d_1^2 + d_2^2 - d_3^2}{2\,d_2}$$ Denote by $H$ the orthogonal projection of vertex $V_1$ onto the side $V_2V_3$. Then $V_1H$ is the height of the triangle $V_1V_2V_3$, i.e. $V_1H \perp \, V_2V_3$ where $H \in V_2V_3$. Then triangle $V_1V_2H$ is right angled triangle and then $$k = |V_2H| = d_1 \cos(\theta_2) = \frac{d_1^2 + d_2^2 - d_3^2}{2\,d_2}$$

Step 3: By Pythagoras' theorem for the right angled triangle $V_1V_2H$ $$h = |V_1H| = \sqrt{|V_1V_2|^2 - |V_2H|^2} = \sqrt{d_1^2 - k^2}$$

Step 4: If $O$ is the origin of the coordinate system, then you are looking for the position vector $\vec{OV_1}$ of point $V_1$, which is $$\vec{OV_1} = \vec{OV_2} + \vec{V_2H} + \vec{HV_1}$$ By observing that vector $\vec{V_2V_3} \,\, || \,\, \vec{V_2H}$ and $\vec{V_2V_3} \, \perp \, \vec{HV_1}$ we can normalize it, rotated and rescale it to find: \begin{align*} &\vec{V_2H} = |V_2H|\left(\frac{1}{|V_2V_3|}\right) \vec{V_2V_3} = \left(\frac{k}{d_2}\right) \vec{V_2V_3} = \left(\frac{k}{d_2}\right) \begin{bmatrix} x_3 - x_2 \\ y_3 - y_2 \end{bmatrix}\\ &\vec{HV_1} = |HV_2|\left(\frac{1}{|V_2V_3|}\right) \big(\vec{V_2V_3}\big)^{\perp} = \left(\frac{h}{d_2}\right) \big(\vec{V_2V_3}\big)^{\perp} = \pm \left(\frac{h}{d_2}\right) \begin{bmatrix} y_2 - y_3 \\ x_3 - x_2 \end{bmatrix} \end{align*}

And so we can calculate the coordinates of vertex $V_1 = (x_1, y_1)$: $$ \begin{bmatrix} x_1 \\ y_1 \end{bmatrix}\, = \,\begin{bmatrix} x_2 \\ y_2 \end{bmatrix} \, + \, \left(\frac{k}{d_2}\right) \begin{bmatrix} x_3 - x_2 \\ y_3 - y_2 \end{bmatrix} \,\pm\, \left(\frac{h}{d_2}\right) \begin{bmatrix} y_2 - y_3 \\ x_3 - x_2 \end{bmatrix} $$ where \begin{align*} &d_2 = \sqrt{(x_3 - x_2)^2 + (y_3 - y_2)^2 \,}\\ &k = \frac{d_1^2 + d_2^2 - d_3^2}{2\,d_2} \\ &h = \sqrt{d_1^2 - k^2} \end{align*}