Skip to content

Instantly share code, notes, and snippets.

View MichaelStetner's full-sized avatar

Michael Stetner MichaelStetner

  • Massachusetts Institute of Technology
  • Cambridge, MA, USA
View GitHub Profile
@MaxBareiss
MaxBareiss / frechet.py
Last active July 7, 2023 13:36
Fréchet Distance in Python
# Euclidean distance.
def euc_dist(pt1,pt2):
return math.sqrt((pt2[0]-pt1[0])*(pt2[0]-pt1[0])+(pt2[1]-pt1[1])*(pt2[1]-pt1[1]))
def _c(ca,i,j,P,Q):
if ca[i,j] > -1:
return ca[i,j]
elif i == 0 and j == 0:
ca[i,j] = euc_dist(P[0],Q[0])
elif i > 0 and j == 0: