Intersection between segment and circle with a segment endpoint at center

128 Views Asked by At

I have a line segment with known endpoints, and one of the endpoints of the line segment is the center of a circle. The circle has a known radius R. How should I find the intersection between the line segment and the circle?

review edit

enter image description here

1

There are 1 best solutions below

3
On

Let $R$ be the ray from $(cx,xy)$ through $(dx,dy)$, and let $C$ be the circle centered at $(cx,xy)$ with radius $r$.

A general point on the ray $R$ can be expressed as $(x,y)$, where $$ \begin{cases} x=cx+t(dx-cx)\\[4pt] y=cy+t(dy-cy)\\[4pt] \end{cases} $$ where the parameter $t$ can be any nonnegative real number.

Using the distance formula, if $(x,y)$ is the point where $R$ intersects $C$, then $$\Bigl(\bigl(cx+t(dx-cx)\bigr)- cx\Bigr)^2 + \Bigl(\bigl(cy+t(dy-cy)\bigr) - cy\Bigr)^2=r^2$$ Solving for $t$, with the restriction $t\ge 0$, yields $$t=\frac{r}{\sqrt{(dx-cx)^2+(dy-cy)^2}}$$ To get the corresponding point $(x,y)$, substitute the above result for $t$ in the parametric equations for $x,y$.