Write a function called mostIntersecting which receives as parameters three arrays of type float, and an integer n; where n is the size of each array. The first two arrays are called X, and Y and contain the x and y coordinates respectively of the centers of n circles on the plane. The third array, called R, contains the radii of these circles. Your function should output the center and radius of the circle which intersects the most number of other circles in the array. This function must call another function “intersects” which accepts two circles and returns true if they intersect and false otherwise. You must implement both functions.Finally, implement the driver program (main program) that tests the function mostIntersecting.
Kindly help me out in writing this,I am left with a very few time and getting nothing to solve it.

3 Years
Discussion Span
Last Post by David_50

What problem are you actually having? Do you know how to find if two circles on a plane intersect? I don't think you will find anyone on here that is willing to do your work for you. To find out if two circles intersect you can see if the difference of their radii is less then or equal to the distance the circles are apart. That would be:

R1 - R0 <= sqrt((x1-x0)^2 + (y1-y0)^2) 

You could also square both side to not have a call to sqrt and it would be:

(R1-R0)^2 <= (x1-x0)^2 + (y1-y0)^2

Edited by NathanOliver


All circles are in the same 2 dimensional plane. Intersection is that there exists one, two or more points where the two circles intersect. if circle 1 is 1, 2, 25 and circle 2 is 3, 4, 24 then intersection is when x and y are the radius of each away from the center of each. Now, that seems too hard, so to make life simpler, we might look at the line from center 1 to center 2. If they intersect, the line must be less than the sum of the 2 radii in length. (x1-x2)^2 + (y1-y2)^2 <= (r1+r2)^2 How simple!

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.