Thread: Intersection between 2 circles

  1. #1
    Registered User
    Join Date
    Jan 2006

    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

  2. #2
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Out of scope
    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.
    Sent from my iPadŽ

  3. #3
    Super Moderater.
    Join Date
    Jan 2005
    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.

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

    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. #4
    Join Date
    Nov 2004
    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 subscribe to a feed

Similar Threads

  1. Help with finding the intersection of 2 strings
    By hay_man in forum C++ Programming
    Replies: 5
    Last Post: 09-30-2006, 06:30 PM
  2. about intersection in the vector....any idea?
    By peter_hii in forum C++ Programming
    Replies: 3
    Last Post: 09-22-2006, 12:00 AM
  3. how to compute set intersection efficiently?
    By George2 in forum C Programming
    Replies: 4
    Last Post: 06-02-2006, 09:06 AM
  4. intersecting circles (trilateration)
    By X PaYnE X in forum Windows Programming
    Replies: 3
    Last Post: 02-13-2005, 10:31 AM
  5. Array of circles
    By Chook in forum C Programming
    Replies: 1
    Last Post: 05-15-2003, 11:12 AM