code: private int getClosestCorner(final long pX0, final long pY0, final long pX1, final long pY1) {
          double min = Double.MAX_VALUE;
          int corner = 0;
          for (int i = 0 ; i < cornerX.length ; i ++) {
              final double distance = Distance.getSquaredDistanceToSegment(
                      cornerX[i], cornerY[i],
                      pX0, pY0, pX1, pY1);
              if (min > distance) {
                  min = distance;
                  corner = i;
              }
          }
          return corner;
      }
docs: Gets the clip area corner which is the closest to the given segment
  @since 6.0.0
  We have a clip area and we have a segment with no intersection with this clip area.
  The question is: how do we clip this segment?
  If we only clip both segment ends, we may end up with a (min,min) x (max,max)
  clip approximation that displays a backslash on the screen.
  The idea is to compute the clip area corner which is the closest to the segment,
  and to use it as a clip step.
  Which will do something like:
  (min,min)[first segment point] x (min,max)[closest corner] x (max,max)[second segment point]
  or
  (min,min)[first segment point] x (max,min)[closest corner] x (max,max)[second segment point]