. Imagine two disks on the xy plane. Each disk is represented by three numbers (the radius, the x coordinate of the center and the y coordinate of the center). All values for this problem are real numbers. Your task is to determine if the two disks intersect.


closed as off-topic by David Richerby, vonbrand, Rick Decker, Tom van der Zanden, lPlant Sep 28 '15 at 16:41

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not appear to be about computer science, within the scope defined in the help center." – David Richerby, vonbrand, Rick Decker, Tom van der Zanden, lPlant
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ What have you tried? What research have you done? What approaches have you considered? We expect you to make a significant effort to research your problem before asking, and to tell us in the question research you've done. $\endgroup$ – D.W. Sep 28 '15 at 3:56
  • 1
    $\begingroup$ This seems to be a problem purely of plane geometry. What computational aspect are you looking for? $\endgroup$ – David Richerby Sep 28 '15 at 6:14
  • $\begingroup$ What does a comparison of (1) the distance between the two centers and (2) the sum of the two radii tell you? Drawing some pictures might help. $\endgroup$ – Rick Decker Sep 28 '15 at 13:59

I am not sure if I should answer such a question, but here we go:

Let the first disk be $D_1 = \langle R_1, (x_1, y_1)\rangle$ and the second disk be $D_2 = \langle R_2, (x_2, y_2)\rangle$, where $R_1$ and $R_2$ is the radius of the first and second disk respectively, as well as $(x_1, y_1)$ and $(x_2, y_2)$ is the center of the first and second disk respectively. Further, let $d$ be the distance of the two centers; that is, $$d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}.$$ Then, the two disks intersect if $$d \leq R_1 + R_2$$ and do not intersect otherwise.

Note that if $d = R_1 + R_2$, then the two disks have only one point in common.


Not the answer you're looking for? Browse other questions tagged or ask your own question.