# Formula to calculate a side of triangle with given angle

I have triangle like in the picture.

The known angles:

• α (total angle of the I-J-K2 triangle)
• b (total angle of the I-P2-K2 and I-P1-K2 triangles)

The known 3D points with X,Y,Z-coordinates:

• I
• J
• K1 (tangent intersection point)
• K2 (center of the circle)

All distances between these 4 points are known (for example lenght of I-J, J-K2 or r). Also the lenght of arc from I to J is known.

P1 and P2 points are unknown. The P1 is located somewhere on the line from I to J. The P2 is somewhere on the arc of the circle.

a with 360' degrees would form a complete circle, where K2 is the center point.

What is the formula to calculate the length of X (distance between I-P1)? Or how I could calculate P1's or P2's 3D coordinates?

• Is the arc part of a circle of radius $R$ centered at $K_2$, so that the distance between $K _2$ and $P_2$ is also $R$? – MPW May 6 '14 at 11:02
• The distance between K2-P2 is the same lenght as R. When a is 360' degrees, it forms a full circle, where K2 is the center point. But here the max a angle is always something below 180 degrees. – W0lfw00ds May 6 '14 at 11:11

You may assume $r=1$. If you dilate or contract the image by a factor of $r$, that will simultaneously bring the radius to $r$ and scale $x$ by $r$. So we can simplify things a little by solving for $x$ with $r=1$ and then multiplying the result by $r$ for the general case.

Using the Law of Cosines, with three triangles in the figure:

\begin{aligned} \left(x+\overline{P_1J}\right)^2=x^2+\left(\overline{P_1J}\right)^2+2x\left(\overline{P_1J}\right) &=2(1-\cos(\alpha))\\ x^2 &=1+\left(\overline{P_1K_2}\right)^2-2\overline{P_1K_2}\cos(\beta)\\ \left(\overline{P_1J}\right)^2 &=1+\left(\overline{P_1K_2}\right)^2-2\overline{P_1K_2}\cos(\alpha-\beta)\\ \end{aligned}

This gives a system of equations with three unknowns: $x$, $\overline{P_1K_2}$, and $\overline{P_1J}$. You could use algebra to solve for $x$ as follows.

The second and third equations can be used to eliminate $x$ and $\overline{P_1J}$ from the first, leaving:

$$2r^2+2\left(\overline{P_1K_2}\right)^2-2r\overline{P_1K_2}\left(\cos(\beta)+\cos(\alpha-\beta)\right)\\+2\sqrt{\left(r^2+\left(\overline{P_1K_2}\right)^2-2r\overline{P_1K_2}\cos(\beta)\right)\left(r^2+\left(\overline{P_1K_2}\right)^2-2r\overline{P_1K_2}\cos(\alpha-\beta)\right)}\\=2r^2(1-\cos(\alpha))$$

After moving the terms not under the radical to the left and squaring both sides, this equation is quartic in $\overline{P_1K_2}$. That means that you could solve for $\overline{P_1K_2}$ using Cardano's quartic solution method (or maybe something simpler depending on the exact values of $r$, $\alpha$, and $\beta$.) From there, you would know $x$ using the second equation from the system above.

• So I need to know P1-K2 first, and then I can use the second equation from the top, to calculate the X length. X is really the only thing I need to know. I'm sorry but I have no idea about Cardano's quartic solution. Could you edit the answer to include the final equation to solve P1-K2? I propably don't have the skills to make it into 'P1-K2 = "equation"' form on my own. About the values: α is always lesser than 360 degrees. β is always lesser than α. r is always greater than zero. – W0lfw00ds May 7 '14 at 7:57
• Solving a quartic polynomial exactly is better done as a process rather than with a formula, like the quadratic formula. If you did write down the formula for the general solution to a quartic equation, it would take quite a lot of space. – alex.jordan May 7 '14 at 17:26
• The space is not a problem. I need to use the formula in software programming, and make a copy of it, so I can use to count the X in realtime. But I found another way around. I'll mark this as the answer. – W0lfw00ds May 8 '14 at 4:53