Skip to content

Instantly share code, notes, and snippets.

@minorsecond
Created March 24, 2016 12:50
Show Gist options
  • Save minorsecond/ca29afa68a693fb3612f to your computer and use it in GitHub Desktop.
Save minorsecond/ca29afa68a693fb3612f to your computer and use it in GitHub Desktop.
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