public static Point2D.Double pointBetween(Point2D.Double p, Point2D.Double p2, double pos) {

    Point2D.Double n =
        new Point2D.Double(
            p.getX() * (1 - pos) + p2.getX() * (pos), p.getY() * (1 - pos) + p2.getY() * (pos));

    return n;
  }
  public static int closest(Point2D.Double[] BTS, Point2D.Double p) {

    double[] dist = new double[BTS.length];
    int min = 0;
    for (int i = 0; i < BTS.length; i++) {
      dist[i] = distanceSq(BTS[i].getX(), BTS[i].getY(), p.getX(), p.getY());
      if (dist[i] < dist[min]) min = i;
    }
    // System.out.println(dist[min] + " " + min);

    return min;
  }