Search in sources :

Example 1 with Stopwatch

use of com.revolsys.geometry.util.Stopwatch in project com.revolsys.open by revolsys.

the class BinTreeCorrectTest 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++) {
        final double x = MIN_EXTENT + gridInc * i;
        final Interval interval = new Interval(x, x + cellSize);
        queryTest(interval);
    // queryTime(env);
    }
// System.out.println("Time = " + sw.getTimeString());
}
Also used : Stopwatch(com.revolsys.geometry.util.Stopwatch) Interval(com.revolsys.geometry.index.bintree.Interval)

Example 2 with Stopwatch

use of com.revolsys.geometry.util.Stopwatch in project com.revolsys.open by revolsys.

the class IndexTester method testAll.

public IndexResult testAll(final List items) {
    final IndexResult result = new IndexResult(this.index.toString());
    System.out.print(this.index.toString() + "           ");
    System.gc();
    final Stopwatch sw = new Stopwatch();
    sw.start();
    loadGrid(items);
    final String loadTime = sw.getTimeString();
    result.loadMilliseconds = sw.getTime();
    System.gc();
    sw.start();
    // runQueries();
    runSelfQuery(items);
    final String queryTime = sw.getTimeString();
    result.queryMilliseconds = sw.getTime();
    // + queryTime);
    return result;
}
Also used : Stopwatch(com.revolsys.geometry.util.Stopwatch)

Example 3 with Stopwatch

use of com.revolsys.geometry.util.Stopwatch in project com.revolsys.open by revolsys.

the class TestPerfDistanceGeomPair method test.

public void test(final Geometry[] geom) {
    final Stopwatch sw = new Stopwatch();
    final double dist = 0.0;
    final double dist2 = 0.0;
    for (int i = 0; i < MAX_ITER; i++) {
        // dist = geom[0].distance(geom[1]);
        // dist = SortedBoundsFacetDistance.distance(g1, g2);
        // dist2 = BranchAndBoundFacetDistance.distance(geom[0], geom[1]);
        // if (dist != dist2) System.out.println("distance discrepancy found!");
        computeDistanceToAllPoints(geom);
    }
    if (!this.verbose) {
    // System.out.println(sw.getTimeString());
    }
    if (this.verbose) {
    // System.out.println("Finished in " + sw.getTimeString());
    // System.out.println(" (Distance = " + dist + ")");
    }
}
Also used : Stopwatch(com.revolsys.geometry.util.Stopwatch) Point(com.revolsys.geometry.model.Point)

Example 4 with Stopwatch

use of com.revolsys.geometry.util.Stopwatch in project com.revolsys.open by revolsys.

the class DelaunayRobustTest method run.

public void run(final int nPts) {
    // System.out.println("Base offset: " + BASE_OFFSET);
    final List<Point> pts = randomPointsInGrid(nPts, BASE_OFFSET, BASE_OFFSET);
    // System.out.println("# pts: " + pts.size());
    final Stopwatch sw = new Stopwatch();
    final QuadEdgeDelaunayTinBuilder builder = new QuadEdgeDelaunayTinBuilder(GEOMETRY_FACTORY);
    builder.insertVertices(pts);
    // Geometry g = builder.getEdges(geomFact);
    // don't actually form output geometry, to save time and memory
    builder.getSubdivision();
// System.out.println(" -- Time: " + sw.getTimeString() + " Mem: "
// + Memory.usedTotalString());
// System.out.println(g);
}
Also used : QuadEdgeDelaunayTinBuilder(com.revolsys.elevation.tin.quadedge.QuadEdgeDelaunayTinBuilder) Stopwatch(com.revolsys.geometry.util.Stopwatch) Point(com.revolsys.geometry.model.Point)

Example 5 with Stopwatch

use of com.revolsys.geometry.util.Stopwatch in project com.revolsys.open by revolsys.

the class InCirclePerf method runDDSelf2.

public double runDDSelf2(final int nIter) {
    final Stopwatch sw = new Stopwatch();
    for (int i = 0; i < nIter; i++) {
        TriPredicate.isInCircleDD3(this.pa, this.pb, this.pc, this.pp);
    }
    sw.stop();
    // + sw.getTimeString());
    return sw.getTime() / (double) nIter;
}
Also used : Stopwatch(com.revolsys.geometry.util.Stopwatch) Point(com.revolsys.geometry.model.Point)

Aggregations

Stopwatch (com.revolsys.geometry.util.Stopwatch)30 Point (com.revolsys.geometry.model.Point)14 Geometry (com.revolsys.geometry.model.Geometry)6 QuadEdgeDelaunayTinBuilder (com.revolsys.elevation.tin.quadedge.QuadEdgeDelaunayTinBuilder)3 DD (com.revolsys.geometry.math.DD)3 BoundingBox (com.revolsys.geometry.model.BoundingBox)3 PointDoubleXY (com.revolsys.geometry.model.impl.PointDoubleXY)2 Iterator (java.util.Iterator)2 RectangleLineIntersector (com.revolsys.geometry.algorithm.RectangleLineIntersector)1 PointOnGeometryLocator (com.revolsys.geometry.algorithm.locate.PointOnGeometryLocator)1 SimplePointInAreaLocator (com.revolsys.geometry.algorithm.locate.SimplePointInAreaLocator)1 Interval (com.revolsys.geometry.index.bintree.Interval)1 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)1 Location (com.revolsys.geometry.model.Location)1 BoundingBoxDoubleXY (com.revolsys.geometry.model.impl.BoundingBoxDoubleXY)1 SineStarFactory (com.revolsys.geometry.model.util.SineStarFactory)1 Constructor (java.lang.reflect.Constructor)1 Method (java.lang.reflect.Method)1 BigDecimal (java.math.BigDecimal)1 ArrayList (java.util.ArrayList)1