docs: public static void limitDistance(DenseMatrix64F p0, DenseMatrix64F pr, double min, double max)
      {
          double x0 = p0.data[0];
          double y0 = p0.data[1];
          double xr = pr.data[0];
          double yr = pr.data[1];
          double dx = xr-x0;
          double dy = yr-y0;
          double r = Math.sqrt(dx*dx+dy*dy);
          if (r < min || r > max)
          {
              if (r < min)
              {
                  r = min;
              }
              else
              {
                  r = max;
              }
              double m = dy/dx;
              if (Double.isInfinite(m))
              {
                  if (m > 0)
                  {
                      pr.data[1] = y0 +  r;
                  }
                  else
                  {
                      pr.data[1] = y0 -  r;
                  }
              }
              else
              {
                  double x = Math.sqrt((r*r)/(m*m+1));
                  double y = m*x;
                  pr.data[0] = x0 +  x;
                  pr.data[1] = y0 +  y;
              }
          }
      }