use of com.revolsys.geometry.util.Stopwatch in project com.revolsys.open by revolsys.
the class PointInAreaPerfTester method run.
/**
* @return true if all point locations were computed correctly
*/
public boolean run() {
final Stopwatch sw = new Stopwatch();
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 Location loc = this.pia1.locate(pt);
this.locationCount[loc.getIndex()]++;
}
}
// System.out.println("Test completed in " + sw.getTimeString());
printStats();
return true;
}
use of com.revolsys.geometry.util.Stopwatch in project com.revolsys.open by revolsys.
the class SimpleRectangleIntersector method run.
public void run(final boolean useSegInt, final boolean useSideInt) {
if (useSegInt) {
// System.out.println("Using Segment Intersector");
}
if (useSideInt) {
// System.out.println("Using Side Intersector");
}
// System.out.println("# pts: " + this.pts.length);
final RectangleLineIntersector rectSegIntersector = new RectangleLineIntersector(this.rectEnv);
final SimpleRectangleIntersector rectSideIntersector = new SimpleRectangleIntersector(this.rectEnv);
final Stopwatch sw = new Stopwatch();
for (int i = 0; i < this.pts.length; i++) {
for (int j = 0; j < this.pts.length; j++) {
if (i == j) {
continue;
}
boolean segResult = false;
if (useSegInt) {
segResult = rectSegIntersector.intersects(this.pts[i], this.pts[j]);
}
boolean sideResult = false;
if (useSideInt) {
sideResult = rectSideIntersector.intersects(this.pts[i], this.pts[j]);
}
if (useSegInt && useSideInt) {
if (segResult != sideResult) {
throw new IllegalStateException("Seg and Side values do not match");
}
}
}
}
// System.out.println("Finished in " + sw.getTimeString());
// System.out.println();
}
use of com.revolsys.geometry.util.Stopwatch in project com.revolsys.open by revolsys.
the class PreparedLineIntersectsPerfTest method test.
public void test(final Geometry g, final List lines) {
// System.out.println("AOI # pts: " + g.getVertexCount() + " # lines: "
// + lines.size() + " # pts in line: " + NUM_LINE_PTS);
final Stopwatch sw = new Stopwatch();
int count = 0;
for (int i = 0; i < MAX_ITER; i++) {
// count = testPrepGeomNotCached(g, lines);
count = testPrepGeomCached(g, lines);
// count = testOriginal(g, lines);
}
// System.out.println("Count of intersections = " + count);
// System.out.println("Finished in " + sw.getTimeString());
}
use of com.revolsys.geometry.util.Stopwatch in project com.revolsys.open by revolsys.
the class QuadtreeCorrectTest method queryGrid.
void queryGrid(final int nGridCells, final double cellSize) {
final Stopwatch sw = new Stopwatch();
sw.start();
int gridSize = (int) Math.sqrt(nGridCells);
gridSize += 1;
final double extent = MAX_EXTENT - MIN_EXTENT;
final double gridInc = extent / gridSize;
for (int i = 0; i < gridSize; i++) {
for (int j = 0; j < gridSize; j++) {
final double x = MIN_EXTENT + gridInc * i;
final double y = MIN_EXTENT + gridInc * j;
final BoundingBox env = new BoundingBoxDoubleXY(x, y, x + cellSize, y + cellSize);
queryTest(env);
// queryTime(env);
}
}
// System.out.println("Time = " + sw.getTimeString());
}
use of com.revolsys.geometry.util.Stopwatch in project com.revolsys.open by revolsys.
the class FileBufferResultValidatorTest method runAll.
void runAll(final List geoms, final double dist) {
final Stopwatch sw = new Stopwatch();
// dist);
for (final Iterator i = geoms.iterator(); i.hasNext(); ) {
final Geometry g = (Geometry) i.next();
runBuffer(g, dist);
runBuffer(g.reverse(), dist);
System.out.print(".");
}
// System.out.println(" " + sw.getTimeString());
}
Aggregations