Skip to content

Instantly share code, notes, and snippets.

@Muazzeem
Created January 29, 2024 14:41
Show Gist options
  • Save Muazzeem/2f01b4cf9209ab99deed3217b6540683 to your computer and use it in GitHub Desktop.
Save Muazzeem/2f01b4cf9209ab99deed3217b6540683 to your computer and use it in GitHub Desktop.
def euclidean_distance(point1, point2):
x1, y1 = point1
x2, y2 = point2
return math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
def cal(c_cor, t_cor):
c = c_cor
c_xmid, cy_mid = (c[0][0] + c[2][0]) / 2, (c[0][1] + c[2][1]) / 2
return t_cor[0][1] <= cy_mid <= t_cor[3][1]
def compare(x, y):
distance1, distance2 = x[0], y[0]
if distance1 == distance2:
test_name1, test_name2 = x[1][1], y[1][1]
return test_name1.confidence - test_name2.confidence
return distance1 - distance2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment