use of com.revolsys.geometry.algorithm.locate.SimplePointInAreaLocator in project com.revolsys.open by revolsys.
the class PointInAreaStressTester method run.
/**
* @return true if all point locations were computed correctly
*/
public boolean run() {
final Stopwatch sw = new Stopwatch();
// default is to use the simple, non-indexed tester
if (this.pia2 == null) {
this.pia2 = new SimplePointInAreaLocator(this.area);
}
final int ptGridWidth = (int) Math.sqrt(this.numPts);
final BoundingBox areaEnv = this.area.getBoundingBox();
final double xStep = areaEnv.getWidth() / (ptGridWidth - 1);
final double yStep = areaEnv.getHeight() / (ptGridWidth - 1);
for (int i = 0; i < ptGridWidth; i++) {
for (int j = 0; j < ptGridWidth; j++) {
// compute test point
final double x = this.geomFactory.makePrecise(0, areaEnv.getMinX() + i * xStep);
final double y = this.geomFactory.makePrecise(1, areaEnv.getMinY() + j * yStep);
final Point pt = new PointDoubleXY(x, y);
final boolean isEqual = testPIA(pt);
if (!isEqual) {
return false;
}
}
}
// System.out.println("Test completed in " + sw.getTimeString());
printStats();
return true;
}
Aggregations