diff --git a/utils.py b/utils.py index f9cd4e6..cc1814a 100644 --- a/utils.py +++ b/utils.py @@ -1,5 +1,13 @@ import sys +import math + +def x( point ): + return point[0] + +def y( point ): + return point[1] + def LOG( *args ): """Print something on stderr and flush""" @@ -38,3 +46,7 @@ def tour(lst): for a,b in zip(lst, lst[1:] + [lst[0]]): yield (a,b) + +def euclidian_distance( ci, cj, graph = None): + return math.sqrt( float(ci[0] - cj[0])**2 + float(ci[1] - cj[1])**2 ) +