docs: static int addPointsToArray(Point2D p0In, Point2D p1In,
  			Point2D[] pointsArray, int idx, Envelope2D fullRange2D,
  			boolean clockwise, double densifyDist)// PointerOfArrayOf(Point2D)
  													// pointsArray, int idx,
  													// Envelope2D fullRange2D,
  													// boolean clockwise, double
  													// densifyDist)
  	{
  		Point2D p0 = new Point2D();
  		p0.setCoords(p0In);
  		Point2D p1 = new Point2D();
  		p1.setCoords(p1In);
  		fullRange2D._snapToBoundary(p0);
  		fullRange2D._snapToBoundary(p1);
  		// //_ASSERT((p0.x == fullRange2D.xmin || p0.x == fullRange2D.xmax) &&
  		// (p1.x == fullRange2D.xmin || p1.x == fullRange2D.xmax));
  		double boundDist0 = fullRange2D._boundaryDistance(p0);
  		double boundDist1 = fullRange2D._boundaryDistance(p1);
  		if (boundDist1 == 0.0)
  			boundDist1 = fullRange2D.getLength();
  
  		if ((p0.x == p1.x || p0.y == p1.y
  				&& (p0.y == fullRange2D.ymin || p0.y == fullRange2D.ymax))
  				&& (boundDist1 > boundDist0) == clockwise) {
  			Point2D delta = new Point2D();
  			delta.setCoords(p1.x - p0.x, p1.y - p0.y);
  			if (densifyDist != 0)// if (densifyDist)
  			{
  				long cPoints = (long) (delta._norm(0) / densifyDist);
  				if (cPoints > 0) // if (cPoints)
  				{
  					delta.scale(1.0 / (cPoints + 1));
  					for (long i = 0; i < cPoints; i++) {
  						p0.add(delta);
  						pointsArray[idx++].setCoords(p0.x, p0.y);// ARRAYELEMENT(pointsArray,
  																	// idx++).setCoords(p0.x,
  																	// p0.y);
  					}
  				}
  			}
  		} else {
  			int side0 = fullRange2D._envelopeSide(p0);
  			int side1 = fullRange2D._envelopeSide(p1);
  			// create up to four corner points; the order depends on boolean
  			// clockwise
  			Point2D corner;
  			int deltaSide = clockwise ? 1 : 3; // 3 is equivalent to -1
  			do {
  				side0 = (side0 + deltaSide) & 3;
  				corner = fullRange2D.queryCorner(side0);
  				if (densifyDist != 0)// if (densifyDist)
  				{
  					idx = addPointsToArray(p0, corner, pointsArray, idx,
  							fullRange2D, clockwise, densifyDist);
  				}
  				pointsArray[idx++].setCoords(corner.x, corner.y);// ARRAYELEMENT(pointsArray,
  																	// idx++).setCoords(corner.x,
  																	// corner.y);
  				p0 = corner;
  			} while ((side0 & 3) != side1);
  
  			if (densifyDist != 0)// if (densifyDist)
  				idx = addPointsToArray(p0, p1, pointsArray, idx, fullRange2D,
  						clockwise, densifyDist);
  		}
  
  		return idx;
  	}