A little patience, please: I'm incredibly old, it's a long time since I did basic algebra so I'm a little confused.

I have a line y = mx+c
and a circle (x-h)*(x-h)+(y-k)*(y-k) = r*r

I've expanded the circle: x*x-2*x*h+h*h+y*y-2*y*k+k*k = r*r

and substituted mx+c for y: x*x-2*x*h+h*h+(m*x+c)*(m*x+c)-2*(m*x+c)*k+k*k = r*r

expanding out: x*x-2*x*h+h*h+m*x*m*x+2*m*x*c+c*c-2*m*x*k+2*c*k+k*k = r*r

Now I want to get all x's on the one side so I can evaluate x:
x*x-2*x*h+m*x*m*x+2*m*x*c-2*m*x*k = r*r-h*h-c*c-2*c*k-k*k

I can refine it a wee bit further:
x*(x-2h+m*m*x+2*m*c-2*m*k) = r*r-h*h-c*c-2*c*k-k*k

But that's as far as I can go...

Edited by davecoventry

5 Years
Discussion Span
Last Post by Momerath

I suppose it is.

I just asked in the 'Computer Science' forum because I couldn't find a maths forum here. (or are you suggesting that my question has no relevance to 'Computer Science'?)

Yes, I've looked at that Wiki. I can't say it actually helped.


Why did it not help?
If you solve your quadratic equation you will get two expressions in m and c, x1 and x2. That is if your line crosses the circle at two points. Put x1 and x2 in y = mx + c to calculate y1 and y2. Et voila! Your two coordinate points of intersection are (x1,y1) and (x2,y2)
Or from Google(many many hits): Click Here


Your examples all show a highly simplified version of what I'm trying to do. And, frankly I find it insulting that you should presume that I haven't googled myself.

As you arrogantly point out "(x - 2)2 + (- x - 1/2 + 3)2 = 4" is not particularly difficult to solve.

My issue is trying to solve

x*(x-2h+m*m*x+2*m*c-2*m*k) = r*r-h*h-c*c-2*c*k-k*k

As far as I can see, your only purpose in responding to my post seems to be to reaffirm your own understanding of the mathematics involved while summultaneously demeaning mine (no difficult task as it is admittedly meagre).

I rather wish you hadn't bothered.

Edited by davecoventry


x*(x-2h+m*m*x+2*m*c-2*m*k) = r*r-h*h-c*c-2*c*k-k*k

If you distribute the x on the left side you get

Combining like terms gets you (and bringing the right side over to the left)
(mm+1)x^2+(2mc-2h-2mk)x + h^2+c^2+2ck+k^2-r^2 = 0

Since m, c, h, k and r are all constants, you can substitute
a = mm+1
b = 2mc-2h-2mk
c = h^2+c^2+2ck+k^2-r^2

Which gives you
ax^2+bx+c = 0

Solve the quadratic and you are done.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.