Last active
August 29, 2015 14:06
-
-
Save SZanlongo/81ee457df555b0a56721 to your computer and use it in GitHub Desktop.
Check if two circles overlap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Check if two circles overlap | |
def is_overlap(circle1, circle2): | |
distance = ((circle1.x - circle2.x) ** 2 + (circle1.y - circle2.y) ** 2) ** 0.5 | |
return distance < circle1.r + circle2.r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment