docs: private static double getSqSegDist(Point point, Point p1, Point p2) {
      double horizontal = p1.longitude();
      double vertical = p1.latitude();
      double diffHorizontal = p2.longitude() - horizontal;
      double diffVertical = p2.latitude() - vertical;
  
      if (diffHorizontal != 0 || diffVertical != 0) {
        double total = ((point.longitude() - horizontal) * diffHorizontal + (point.latitude()
          - vertical) * diffVertical) / (diffHorizontal * diffHorizontal + diffVertical
          * diffVertical);
        if (total > 1) {
          horizontal = p2.longitude();
          vertical = p2.latitude();
  
        } else if (total > 0) {
          horizontal += diffHorizontal * total;
          vertical += diffVertical * total;
        }
      }
  
      diffHorizontal = point.longitude() - horizontal;
      diffVertical = point.latitude() - vertical;
  
      return diffHorizontal * diffHorizontal + diffVertical * diffVertical;
    }