Skip to content

Instantly share code, notes, and snippets.

@SZanlongo
Last active August 29, 2015 14:06
Show Gist options
  • Save SZanlongo/81ee457df555b0a56721 to your computer and use it in GitHub Desktop.
Save SZanlongo/81ee457df555b0a56721 to your computer and use it in GitHub Desktop.
Check if two circles overlap
# 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