double distance(double x1, double y1, double x2, double y2) { var a = x1 - x2; var b = y1 - y2; return sqrt(pow(a, 2) + pow(b, 2)); }