# Thread: Intersection between 2 circles

1. ## Intersection between 2 circles

I am writting a C++ program in Visual Basics 6.0 that solves the intersection of two circles.
I have this formula

If I do my arithmatics correctly then
X = ( -a^2 - b^2 + R1^2 - R2^2 - 2y(-b2+b1) ) / 2(-a2 + a1)

The problem is that I don't know Y so how could I solve for X?
or do I take equation X and plug it into the original equation and solve for Y?
But if I solve for Y then I have 2 answers and then do I plug it back in to the original equation and get X?

or there is another way to do this?

Help is appreciated
Thanks. 2. First off, how well do you know how to program, because programming something to solve an equation isn't easy. You should have a good knowledge of advanced data structures.

Secondly, make an attempt, post it, and we'll help you from there. 3. There are, I'm not sure if you already knew this, three possible cases.

Two circles may intersect in two imaginary points, a single degenerate point, or two distinct points.

http://mathworld.wolfram.com/Circle-...ersection.html

Assuming you restrict your examples to the last case only- you could use the procedure outlined in the above link to help you get
started.

I'm not entirely sure, but it looks as if you have to set up two simultaneous equations to solve for x and y. These could be two matrices by which a method of guassian elimination could be used to solve for x and y?

The square function adds greater complexity though and I assume you will need to use the quadratic formula to obtain a solution.

The automatic rearranging of your formulae would be the most difficult since it requires a heuristic type solution. Like Sly said you will have to read up on datastructures if you intend to go that far. 4. I am writting a C++ program in Visual Basics 6.0 that solves the intersection of two circles.
That is the real problem You say you will get 2 answers. Usually it's quite easy to eliminate one of them using some logic (for example it may be a complex or negative number). Popular pages Recent additions 