Let $C$ be a circle with center $(c_x,c_y)$ and radius $r$

Let $s$ be a segment that starts in $(c_x,c_y)$ and ends in a point $(x, y)$ outside $C$

How can I find the point $P=(p_x,p_y)$ where $s$ intersects $C$ ?

I thought about writing the line equation from $(c_x,c_y)$ and $(x, y)$, than find the intersection of $s$ and $C$, and from the $2$ results, apply some filter to get the result I expect, but I wonder if there is a way more straightforward than that.


1 Answer 1


As the segment starts in the centre of the circle, let $$d=\sqrt{(x-c_x)^2+(y-c_y)^2}>r$$ Your point is $$P=(c_x,c_y)+\frac{r}{d}(x-c_x,y-c_y)$$ You can see this is the point on the segment at distance $r$ from the centre.

  • $\begingroup$ that was a smart trick with vectors, exactly what I was search for, thanks! $\endgroup$
    – Daniel
    Jan 26, 2018 at 7:20
  • $\begingroup$ Happy this helps :) $\endgroup$
    – N74
    Jan 26, 2018 at 20:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .