1

My question is similar to this one, but the solution provided makes use of some 'properties' that will not be true for all triangles. For example, if point A is not in the origin, or point B is not in any axis.

Objectively, the formula I am searching is one whose entries are:

  • Point A ($a_x$, $a_y$)
  • Point B ($b_x$, $b_y$)
  • $l_1$ (length of side AB)
  • $l_2$ (length of side AC)
  • $l_3$ (length of side BC)

And gives me the point C ($c_x$, $c_y$)

gsmafra
  • 365
  • You can always translate and rotate the triangle so the other answer will work then translate and rotate back. Euclidean space is distance preserving over these maps so it will not change your answer much. – shai horowitz May 19 '16 at 01:32

1 Answers1

2

PRECAUTIONS

First of all, you should check the triangle ineqalities: $$ l_1+l_2>l_3;~l_2+l_3>l_1;~l_1+l_3>l_2; $$ if at least one of them fails, your problem has no solution.

Also we assume, that $\sqrt{(b_x-a_x)^2+(b_y-a_y)^2}=l_1$, otherwise, your problem is contradictory.

HELPFUL FACT

If we have some ray, that makes angle $\varphi$ with $x$ direction, the unit vector along this ray has $(\cos\varphi;\sin\varphi)$ coordinates. This is valid for any direction of the ray.

SOLUTION

Let us designate the angle between ray $AB$ and $x$ direction by $\alpha$. Then: $$ \cos\alpha=\frac{b_x-a_x}{l_1};~\sin\alpha=\frac{b_y-a_y}{l_1}. $$ Let us designate $\angle CAB$ angle of the triangle by $\beta$. We'll use the law of cosines to calculate $\cos\beta$: $$ \cos\beta=\frac{l_1^2+l_2^2-l_3^2}{2l_1l_2} $$ $-1<\cos\beta<1$ ($\cos\beta$ may be positive, negative, or zero). $0<\beta<\pi$ (it is an angle in a triangle), so $\sin\beta>0$ ($\sin\beta$ may be only positive). Thus $\sin\beta$ is determined uniquely: $$ \sin\beta=\sqrt{1-\cos^2\beta}. $$ Let us calculate the angle between the ray $AC$ and $x$ direction (we'll call it $\gamma$). There are two possible positions of $C$ point (symmetric with respect to $AB$ line). So there are two possible $\gamma$ values: $$ \gamma=\alpha+\beta~\text{or}~\gamma=\alpha-\beta. $$ We can calculate $\cos\gamma$ and $\sin\gamma$ for each of this cases: $$ \gamma=\alpha+\beta:\\ \cos\gamma=\cos(\alpha+\beta)=\cos\alpha\cos\beta-\sin\alpha\sin\beta\\ \sin\gamma=\sin(\alpha+\beta)=\sin\alpha\cos\beta+\cos\alpha\sin\beta\\ ~\\ \gamma=\alpha-\beta:\\ \cos\gamma=\cos(\alpha-\beta)=\cos\alpha\cos\beta+\sin\alpha\sin\beta\\ \sin\gamma=\sin(\alpha-\beta)=\sin\alpha\cos\beta-\cos\alpha\sin\beta\\ $$ $(\cos\gamma;\sin\gamma)$ is the unit vector along the $AC$ ray direction. Now we get the coordinates of $C$ easily: $$ c_x=a_x+l_2\cdot\cos\gamma;~c_y=a_y+l_2\cdot\sin\gamma. $$ In my opinion, this solution is valid for any possible input data.

rtmd
  • 336
  • 1
  • 8