Calculate coordinates of 3rd point (vertex) of a scalene triangle if angles and sides are known.

19.5k Views Asked by At

I am writing a program and I need to calculate the 3rd point of a triangle if the other two points, all sides and angles are known.

            A (6,14)
            ^
           / \
    14.14 /   \ 10.14
         /     \
        /       \
B (16,4)--------- C (x,y)
          10.98

A (6,14), B (16,4). Side AB is 14.14, AC is 10.14 and BC is 10.98 Angle A, B, C are 50, 45 and 85 degrees respectively...

I want to calculate the position of C. I don't know which formula to use for this. Actually i am performing triangluation. I am calculating the position of an incoming object (C).

3

There are 3 best solutions below

2
On BEST ANSWER

Thanks everyone for the help! I found the answer. The formula for which is given here (Section: Intersection of two circles. It's not in the plot, but $d$ is the euclidean distance between the centers of the circles or $d=a+b$).

enter image description here

a = (r02 - r12 + d2 ) / (2d)

h = r0 sinP0 (or) r1 sinP1

P2 = P0 + a ( P1 - P0 ) / d i.e., x2 = x0 + a (x1 - x0) / d (and) y2 = y0 + a (y1 - y0) / d

x3 = x2 ± h ( y1 - y0 ) / d

y3 = y2 ± h ( x1 - x0 ) / d

1
On

It is enough to take the middle point of $BC$ and duplicate it. Let me explain:

Consider $M=1/2(AB+AC)$. Then $C=2BM$. Now you have the vector and its norm, so is enough to solve an equation.

5
On

Take the following figure I made in paint:
pic

So basically, you want to find the lengths $AD$ and $DC$. So lets make the coordinates $(X_A,Y_A),(X_B,Y_B),(X_C,Y_C)$. The length $AO = |Y_A - Y_B|$ and $BO = |X_A - X_B|$. That means that $ \tan(\angle ABO) = \frac{AO}{BO} \leftrightarrow \angle ABO = \arctan(\frac{AO}{BO})$.
Because the angles of a triangle sum up to $180$ degrees, $\angle BAO = 180 - \angle ABO - 90 \leftrightarrow \angle BAO = 90 - \angle ABO$.
$\angle DAC = \angle BAC - \angle BAO$.
$\sin(\angle DAC) = \frac{DC}{AC} \longleftrightarrow DC = AC \sin(\angle DAC)$
$\cos(\angle DAC) = \frac{AD}{AC} \longleftrightarrow AD = AC \cos(\angle DAC)$
$X_C = X_A + DC$
$Y_C = Y_A + AD$
Now if you want two formulas with all the information compacted, you get:
$X_C = X_A + AC\sin(\angle BAC - 90 + \arctan(\frac{AO}{BO}))$
$Y_C = Y_A + AC\cos(\angle BAC - 90 + \arctan(\frac{AO}{BO}))$
Just for the record, the angles and lengths are good information to have, but because of the way trigonometric functions work, the coordinates $(x,y)$ might appear on the opposite side of line $AB$ in your example, while still fulfilling your constraints. You may have to add some if statements if you want it going in a certain direction. Let me know if this equation works.