I'm trying to use this answer to detect whether or not there is an intersection between two circles. The answer says: The above solution should work even for the "one circle inside the other" case.
However, when I try with the following input:
x0: 296
y0: 728
r0: 14
x1: 299
y1: 731
r1: 7
Which looks like this visually:
Then it doesn't seem to work. That is, the following equation fails:
(R0 - R1)^2 <= (x0 - x1)^2 + (y0 - y1)^2 <= (R0 + R1)^2
49 <= 18 <= 441
That is, the function would return false (they do not intersect), when clearly they are intersecting.
Am I doing something wrong, or is the formula not correct?