computeMaximumIterations static method
Computes the maximum number of iterations allowed. Uses a heuristic based on the size of the input geometry and the tolerance distance. A smaller tolerance distance allows more iterations. This is a rough heuristic, intended to prevent huge iterations for very thin geometries.
@param geom the input geometry @param toleranceDist the tolerance distance @return the maximum number of iterations allowed
Implementation
static int computeMaximumIterations(Geometry geom, double toleranceDist) {
double diam = geom.getEnvelopeInternal().getDiameter();
double ncells = diam / toleranceDist;
//-- Using log of ncells allows control over number of iterations
int factor = math.log(ncells).toInt();
if (factor < 1) factor = 1;
return 2000 + 2000 * factor;
}