Given a pair of circle, Find 2 points on the perimeter of circle(one on each Circle) such that the Euclidean distance is K? Given Centre and Radius.

256 Views Asked by At

We are given a pair of circles in 2D. We have the centre point of both the circles in 2D and its radius. We have to find 2 points P1, P2 such that P1 is on the perimeter of circle A and P2 is on the perimeter of circle B and the distance between them is K.

I came up with an idea of constructing a triangle between C1, P1 and C2 where C1 is centre point of Circle 1, P1 is point on Circle 1 and C2 is centre point of circle 2. But it didn't work.

1

There are 1 best solutions below

0
On

I guess this is a problem from live contest . But still I'll give you some hints.

Try to find Minimum and Maximum distance for 3 cases:

  1. Disjoint Circles
  2. Intersecting Circles
  3. One circle Inside another circle

Now all Integer Points in the range [min,max] are points of the circle , so just check the Euclidean distance for each pair in the range and count such points simultaneously.