docs: int clipLine(Point2D p0, Point2D p1, int lineExtension, double[] segParams,
  			double[] boundaryDistances) {
  		if (boundaryDistances != null) {
  			boundaryDistances[0] = -1.0;
  			boundaryDistances[1] = -1.0;
  		}
  
  		double[] tOld = new double[2];// LOCALREFCLASS1(ArrayOf(double), int,
  										// tOld, 2);
  		int modified = 0;
  
  		Point2D delta = new Point2D(p1.x - p0.x, p1.y - p0.y);
  
  		if (delta.x == 0.0 && delta.y == 0.0) // input line degenerates to a
  												// point
  		{
  			segParams[0] = 0.0;
  			segParams[1] = 0.0;
  			return contains(p0) ? 4 : 0;
  		}
  
  		segParams[0] = ((lineExtension & 1) != 0) ? NumberUtils.negativeInf()
  				: 0.0;
  		segParams[1] = ((lineExtension & 2) != 0) ? NumberUtils.positiveInf()
  				: 1.0;
  		tOld[0] = segParams[0];
  		tOld[1] = segParams[1];
  
  		if (clipLineAuxiliary(delta.x, xmin - p0.x, segParams)
  				&& clipLineAuxiliary(-delta.x, p0.x - xmax, segParams)
  				&& clipLineAuxiliary(delta.y, ymin - p0.y, segParams)
  				&& clipLineAuxiliary(-delta.y, p0.y - ymax, segParams)) {
  			if (segParams[1] < tOld[1]) {
  				p1.scaleAdd(segParams[1], delta, p0);
  				_snapToBoundary(p1); // needed for accuracy
  				modified |= 2;
  
  				if (boundaryDistances != null)
  					boundaryDistances[1] = _boundaryDistance(p1);
  			}
  			if (segParams[0] > tOld[0]) {
  				p0.scaleAdd(segParams[0], delta, p0);
  				_snapToBoundary(p0); // needed for accuracy
  				modified |= 1;
  
  				if (boundaryDistances != null)
  					boundaryDistances[0] = _boundaryDistance(p0);
  			}
  		}
  
  		return modified;
  	}