docs: public boolean clip(Line2D.Float line) {
  
          double p1x = line.getX1();
          double p1y = line.getY1();
          double p2x = line.getX2();
          double p2y = line.getY2();
  
          double qx = 0d;
          double qy = 0d;
  
          boolean vertical = p1x == p2x;
  
          double slope = vertical 
              ? 0d
              : (p2y-p1y)/(p2x-p1x);
  
          int c1 = regionCode(p1x, p1y);
          int c2 = regionCode(p2x, p2y);
  
          while (c1 != INSIDE || c2 != INSIDE) {
  
              if ((c1 & c2) != INSIDE)
                  return false;
  
              int c = c1 == INSIDE ? c2 : c1;
  
              if ((c & LEFT) != INSIDE) {
                  qx = xMin;
                  qy = (Utils.feq(qx, p1x) ? 0 : qx-p1x)*slope + p1y;
              }
              else if ((c & RIGHT) != INSIDE) {
                  qx = xMax;
                  qy = (Utils.feq(qx, p1x) ? 0 : qx-p1x)*slope + p1y;
              }
              else if ((c & BOTTOM) != INSIDE) {
                  qy = yMin;
                  qx = vertical
                      ? p1x
                      : (Utils.feq(qy, p1y) ? 0 : qy-p1y)/slope + p1x;
              }
              else if ((c & TOP) != INSIDE) {
                  qy = yMax;
                  qx = vertical
                      ? p1x
                      : (Utils.feq(qy, p1y) ? 0 : qy-p1y)/slope + p1x;
              }
  
              if (c == c1) {
                  p1x = qx;
                  p1y = qy;
                  c1  = regionCode(p1x, p1y);
              }
              else {
                  p2x = qx;
                  p2y = qy;
                  c2 = regionCode(p2x, p2y);
              }
          }
          line.setLine(p1x, p1y, p2x, p2y);
          return true;
      }