Math formula(s) to get non-regular triangles vertex Cx and Cy coordinates if I know everything all

183 Views Asked by At

I know Ax and Ay, Bx and By coordinates of triangle. I know the sizes of all three sides AB, BC, CA. With these inputs I can get all angles of A B C vertex. But I would like to get the Cx and Cy coordinates of the third point C. Which math formula return the most accurate result with non 90 degree, non equilateral triangles? I trying to implement formulas to programming langiage, but sometimes I got inaccurate bad results.

Image with result what I need

The image is a real example. I have all data, but I would like to get as result Cx = 70; Cy = 30; with the most accurate math formula.

Thanks for help!

2

There are 2 best solutions below

10
On

$$\begin{cases}{AC}^2=(C_x-A_x)^2+(C_y-A_y)^2\\\\{BC}^2=(C_x-B_x)^2+(C_y-B_y)^2\end{cases}$$

$\implies$

$${AC}^2 - {BC}^2=2(-A_x+B_x)C_x+2(-A_y+B_y)C_y+A_x^2+A_y^2-B_x^2-B_y^2$$

$\implies$

$$(A_x-B_x)C_x+(A_y-B_y)C_y=\frac{(A_x^2+A_y^2-B_x^2-B_y^2) - ({AC}^2-{BC}^2)}{2}$$

Now,

$$\begin{cases}(A_y-B_y)^2{AC}^2=(A_y-B_y)^2(C_x-A_x)^2+((A_y-B_y)C_y-(A_y-B_y)A_y)^2\\\\(A_x-B_x)^2{AC}^2=((A_x-B_x)C_x-(A_x-B_x)A_x)^2+(A_x-B_x)^2(C_y-A_y)^2\end{cases}$$

$\implies$

$$\begin{cases}(A_y-B_y)^2{AC}^2=(A_y-B_y)^2(C_x-A_x)^2+(\frac{1}{2}((A_x^2+A_y^2-B_x^2-B_y^2)-({AC}^2-{BC}^2))-(A_x-B_x)C_x-(A_y-B_y)A_y)^2\\\\(A_x-B_x)^2{AC}^2=(\frac{1}{2}((A_x^2+A_y^2-B_x^2-B_y^2)-({AC}^2-{BC}^2))-(A_y-B_y)C_y-(A_x-B_x)A_x)^2+(A_x-B_x)^2(C_y-A_y)^2\end{cases}$$

Now you have quadratics in $C_x$ and $C_y$ you can solve.

For convenience, let $p=\frac{1}{2}((A_x^2+A_y^2-B_x^2-B_y^2)-({AC}^2-{BC}^2))-(A_y-B_y)A_y$ and $q=\frac{1}{2}((A_x^2+A_y^2-B_x^2-B_y^2)-({AC}^2-{BC}^2))-(A_x-B_x)A_x$.

Then we have

$$\begin{cases}(A_y-B_y)^2{AC}^2=(A_y-B_y)^2(C_x-A_x)^2+(p-(A_x-B_x)C_x)^2\\\\(A_x-B_x)^2{AC}^2=(q-(A_y-B_y)C_y)^2+(A_x-B_x)^2(C_y-A_y)^2\end{cases}$$

$\implies$

$$\begin{cases}(A_y-B_y)^2{AC}^2=(A_y-B_y)^2(C_x^2-2A_xC_x+A_x^2)+(p^2-2p(A_x-B_x)C_x+(A_x-B_x)^2C_x^2)\\\\(A_x-B_x)^2{AC}^2=(q^2-2q(A_y-B_y)C_y+(A_y-B_y)^2C_y^2)+(A_x-B_x)^2(C_y^2-2A_yC_y+A_y^2)\end{cases}$$

$\implies$

$$\begin{cases}((A_x-B_x)^2+(A_y-B_y)^2)C_x^2+(-2A_x(A_y−B_y)^2-2p(A_x−B_x))C_x+(p^2+(A_y−B_y)^2A_x^2-(A_y−B_y)^2{AC}^2)=0\\\\((A_x-B_x)^2+(A_y-B_y)^2)C_y^2+(−2A_y(A_x−B_x)^2−2q(A_y−B_y))C_y+(q^2+(A_x−B_x)^2A_y^2−(A_x−B_x)^2{AC}^2)=0\end{cases}$$

$\implies$

$$\begin{cases}((A_x-B_x)^2+(A_y-B_y)^2)C_x^2-2(A_x(A_y−B_y)^2+p(A_x−B_x))C_x+(p^2+(A_y−B_y)^2(A_x^2-{AC}^2))=0\\\\((A_x-B_x)^2+(A_y-B_y)^2)C_y^2-2(A_y(A_x−B_x)^2+q(A_y−B_y))C_y+(q^2+(A_x−B_x)^2(A_y^2−{AC}^2))=0\end{cases}$$

3
On

Assuming that the coordinates of $A,B$ is known as well as distances $a,b,c$ and vertices $A,B,C$ are ordered clockwise as in the picture, enter image description here

we can calculate the area $S$ of $\triangle ABC$ and the angle $\alpha=\angle BAC$. Hence we can get the altitude $h_c=\frac{2S}c$ and $|AH_c|=b\,\cos\alpha$. Given that, the coordinates of $H_c$

\begin{align} H_c&=A\,(1-\tfrac{b}c\,\cos\alpha)+B\,\tfrac{b}c\,\cos\alpha . \end{align}

To get the coordinates of $C$, we need to add a vector $\overrightarrow{H_cC}\perp \overrightarrow{BA}:|H_cC|=h_c$:

\begin{align} \overrightarrow{H_cC} &= \tfrac{h_c}c\,(B_y-A_y,A_x-B_x) . \end{align}

In numbers:

\begin{align} S&=825 ;\\ \cos\alpha&=0.53687549219316 ;\\ c&=31.6227766016838 ;\\ h_c&=52.1775813927783 ;\\ H_c&=(20.5,46.5) ;\\ \overrightarrow{H_cC} &=(49.5,-16.5) ;\\ C&=H_c+\overrightarrow{H_cC}=(70.30) . \end{align}