# Thread: Circle - line intersection point

1. ## Circle - line intersection point

Hello,
I have a circle with radius "r" , centre (x1, y1). I have a straight line with starting point (x2, y2) end point (x3, y3). I want to know whether this line intersects with the circle? If yes what is/are the intersection points?

Can I find out the same even for rectangle? and some irregular shape??

With regards,

2. Originally Posted by watashi
Hello,
I have a circle with radius "r" , centre (x1, y1). I have a straight line with starting point (x2, y2) end point (x3, y3). I want to know whether this line intersects with the point? If yes what is/are the intersection points?

Can I find out the same even for rectangle? and some irregular shape??

With regards,
Hi, watashi,

I assume the word "point" in red above is supposed to be "circle."

We can write the equation for the circle and equation for the line, and now we are solving a system of two equations in two variables, where one equation is quadratic and the other linear.

For example, a unit circle centered at the origin, whose equation is $\displaystyle x^2+y^2=1$, and the points $\displaystyle (-1,-2)$ and $\displaystyle (1,2)$ defining the line $\displaystyle y=2x$.

$\displaystyle x^2+y^2=1$

$\displaystyle y=2x$

Substitute the value of $\displaystyle y$ into the first equation to get

$\displaystyle x^2+(2x)^2=1$

Now we have a quadratic equation in one variable, and we can solve for $\displaystyle x$.

The reasoning for rectangles or other shapes is similar, except that we might not have a tidy equation to work with. Depending on the circumstances, we might elect to use approximation techniques instead.