Separating two overlapping circles by shifting along one axis

527 Views Asked by At

I have two 2D disks, $(C_1, r_1)$ (blue) and $(C_2, r_2)$ (red), where the blue disk somehow overlaps the red disk (the figure below shows one example). I’m interested in finding the positive distance along the $y$ axis the blue disk needs to be moved so that it touches but does not overlap the red disk. If I move the blue disk radially outward from the red disk then it’s trivial to figure out how far to move in order to avoid overlap; but in my case, where I only want to move the blue disk in the positive $y$ direction, the general formula (for any configuration of the two disks, assuming there is any overlap) seems more difficult. Could someone provide some insight on what a general formula for this would be, if it's feasible?

enter image description here

3

There are 3 best solutions below

2
On BEST ANSWER

Find the point(s) on the vertical line through the center of the blue disk that are at a distance equal to the sum of the two disks’ radii from the red disk’s center. That’s where the center of the blue disk should be for it to be tangent to the red. Looks like a job for the Pythagorean theorem.

0
On

Just to codify @amd 's answer, the formula appears to just require combining the Pythagorean theorem with the $y$-offset of the two circles:

$dy = \sqrt{(r_2-r_1)^2 - (x_2-x_1)^2} - (y_1-y_2)$

where $C_1 = (x_1,y_1)$ and $C_2=(x_2,y_2)$.

0
On

Shift the green circle upwards until increasing distance between circle centers just equals

$$(C_1 C_2) =(r_1+r_2).$$