Skip to content

Instantly share code, notes, and snippets.

@Bryukh
Created September 3, 2013 04:16
Show Gist options
  • Save Bryukh/6419675 to your computer and use it in GitHub Desktop.
Save Bryukh/6419675 to your computer and use it in GitHub Desktop.
#A is FromPoint B is ToPoint, [x, y] is a hit point
if min(x, xa) <= xb <= max(x, xa) and min(y, ya) <= yb <= max(y, ya):
return True
elif min(xa, xb) <= x <= max(xb, xa) and min(yb, ya) <= y <= max(yb, ya):
return True
else:
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment