code: private static double squaredDistance(FinderPattern a, FinderPattern b) {
      double x = a.getX() - b.getX();
      double y = a.getY() - b.getY();
      return x * x + y * y;
    }
docs: Get square of distance between a and b.