[Math] Find angle(s) of intersection between circle and line segment on circle

geometry

I have a circle (given a center and radius) and a line segment (given a coordinate for both points). The line segment passes through the circle and intersects with the circle in one or two points (one if the segment is tangential or if it ends inside the circle).

How can I find the angle or the two angles where the line segment intersects the circle, relative to the top of the circle?

Please provide an example. Unrelated to the diagram below, a set of points to use in an example are as follows: circle radius $1.5$ with center $(3, 4)$. Line segment from $(3, 3)$ to $(6, 7)$.

If it's easier, it's acceptable to find both points by treating the line segment as a line and ignoring a tangential intersection

I am trying to find the angle shown as ?° in the diagram below. The answer in this case is 57°

Best Answer

Set the center of the circle to be $\left(0,0\right)$. Then the set of points on the circle are those such that $x^2+y^2=r^2$ and the set of points on the line segment are solutions to $y=mx+b$ from some $m$ and $b$ (these are easily found given the two endpoints of the line segment). Substituting, we have \begin{equation} x^2+(mx+b)^2=r^2\Longleftrightarrow (m^2+1)x^2+2mbx+(b^2-r^2)=0 \end{equation} Then this is just a quadratic you can solve with the quadratic formula giving you $x$, and you can get $y$ by $y=mx+b$. However, this gives you two solutions; you must pick the right one (find which is between the two endpoint). Fortunately finding the angle after this is pretty easy: it's just simple trigonometry. If $(x,y)$ is the solution, $\tan^{-1}\left(\frac{y}{x}\right)$ gives you the angles measure counterclockwise from the $x$-axis. You asked for the angle from the $y$-axis, which is then $\frac{\pi}{2}-\tan^{-1}\left(\frac{y}{x}\right).$

A worked example

I'll work out the example you have given. We have radius $r=\frac{3}{2}$, center $\left(3,4\right)$ and a line segment from $(3,3)$ to $(6,7)$. First we'll move the center to $(0,0)$. We do this by subtracting $(3,4)$ from each point. This gives us the center (as desired) of $(0,0)$, and a line segment from $(0,-1)$ to $(3,3)$. Then the line between the two points is $y=\frac{4}{3}x-1$. The equation for the circle is $x^2+y^2=\frac{9}{4}$. Substituting the equation for the line in, we have \begin{equation} x^2+\left(\frac{4}{3}x-1\right)^2=\frac{25}{9}x^2-\frac{8}{3}x+1=\frac{9}{4} \end{equation} which gives the quadratic \begin{equation} \frac{25}{9}x^2-\frac{8}{3}x-\frac{5}{4}=100x^2-96x-45=0 \end{equation} Then the quadratic equation gives $x=\frac{96\pm \sqrt{96^2+4\cdot 100\cdot 45}}{200}=-0.345,1.305$. We're going to want the solution with positive $x$, so $x=1.305$. Then $y=\frac{4}{3}(1.305)-1=0.740$. To find the desired angles, we merely take $90-\tan^{-1}\left(\frac{0.740}{1.305}\right)=90-29.56=60.44$. I'm not sure what the discrepancy between my answer and the one you provided is; it could be rounding errors, but it is more likely I just made a calculation error somewhere (please do point it out if you see it).

I know it seems like a lot, but the technique is relatively straight forward, the calculation is just some hard work. I hope this answer has shed some light on the process for you.

Related Question