I\'m trying to check if a circle is contained within another circle. I\'m not sure if the math behind it is the problem or if its my if statement because I keep getting
CODE ACCORDING TO THE IMAGE IN THE ACCEPTED ANSWER (without getters, as it's more readable):
import math
def contains(self, circle):
d = math.sqrt(
(circle.center[0] - self.center[0]) ** 2 +
(circle.center[1] - self.center[1]) ** 2)
return self.radius > (d + circle.radius)
I used it, and it works. In the following plot, you can see how the circles completely contained in the red big one are painted in green, and the others in black: