Created
March 24, 2016 12:50
-
-
Save minorsecond/ca29afa68a693fb3612f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def euclidian(a, b): | |
""" | |
Calculate distance between points on 2d surface | |
:param a: a list of coordinates for point a | |
:param b: a list of coordinates for point b | |
:return: distance in whichever unit is provided to the function | |
""" | |
x1 = a[0] | |
y1 = a[1] | |
x2 = b[0] | |
y2 = b[1] | |
a = np.array((x1, y1)) | |
b = np.array((x2, y2)) | |
dist = np.linalg.norm(a - b) | |
return dist |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment