num distance(Vector vec)

Source

num distance(Vector vec) {
  num xd = x - vec.x;
  num yd = y - vec.y;
  return sqrt(xd * xd + yd * yd);
}