docs: public double calcNormalizedEdgeDistanceNew(double r_lat_deg, double r_lon_deg,
                                                  double a_lat_deg, double a_lon_deg,
                                                  double b_lat_deg, double b_lon_deg, boolean reduceToSegment) {
          double shrinkFactor = calcShrinkFactor(a_lat_deg, b_lat_deg);
  
          double a_lat = a_lat_deg;
          double a_lon = a_lon_deg * shrinkFactor;
  
          double b_lat = b_lat_deg;
          double b_lon = b_lon_deg * shrinkFactor;
  
          double r_lat = r_lat_deg;
          double r_lon = r_lon_deg * shrinkFactor;
  
          double delta_lon = b_lon - a_lon;
          double delta_lat = b_lat - a_lat;
  
          if (delta_lat == 0)
              // special case: horizontal edge
              return calcNormalizedDist(a_lat_deg, r_lon_deg, r_lat_deg, r_lon_deg);
  
          if (delta_lon == 0)
              // special case: vertical edge        
              return calcNormalizedDist(r_lat_deg, a_lon_deg, r_lat_deg, r_lon_deg);
  
          double norm = delta_lon * delta_lon + delta_lat * delta_lat;
          double factor = ((r_lon - a_lon) * delta_lon + (r_lat - a_lat) * delta_lat) / norm;
  
          // make new calculation compatible to old
          if (reduceToSegment) {
              if (factor > 1)
                  factor = 1;
              else if (factor < 0)
                  factor = 0;
          }
          // x,y is projection of r onto segment a-b
          double c_lon = a_lon + factor * delta_lon;
          double c_lat = a_lat + factor * delta_lat;
          return calcNormalizedDist(c_lat, c_lon / shrinkFactor, r_lat_deg, r_lon_deg);
      }