use of com.revolsys.geometry.model.impl.PointDoubleXY 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;
}
use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.
the class WKBTest method testBigPolygon.
public void testBigPolygon() throws IOException, ParseException {
final GeometricShapeFactory shapeFactory = new GeometricShapeFactory(this.geomFactory);
shapeFactory.setBase(new PointDoubleXY(0, 0));
shapeFactory.setSize(1000);
shapeFactory.setNumPoints(1000);
final Geometry geom = shapeFactory.newRectangle();
runWKBTest(geom, 2, false);
}
use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.
the class WKTReaderTest method testReadLargeNumbers.
public void testReadLargeNumbers() throws Exception {
final GeometryFactory geometryFactory = GeometryFactory.fixed2d(0, 1E9, 1E9);
final WKTReader reader = new WKTReader(geometryFactory);
final Geometry point1 = reader.read("POINT(123456789.01234567890 10)");
final Point point2 = geometryFactory.point(new PointDoubleXY(123456789.01234567890, 10));
assertEquals(point1.getPoint().getX(), point2.getPoint().getX(), 1E-7);
assertEquals(point1.getPoint().getY(), point2.getPoint().getY(), 1E-7);
}
use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.
the class MiscellaneousTest2 method testCoordinateHash.
public void testCoordinateHash() {
doTestCoordinateHash(true, new PointDoubleXY(1, 2), new PointDoubleXY(1, 2));
doTestCoordinateHash(false, new PointDoubleXY(1, 2), new PointDoubleXY(3, 4));
doTestCoordinateHash(false, new PointDoubleXY(1, 2), new PointDoubleXY(1, 4));
doTestCoordinateHash(false, new PointDoubleXY(1, 2), new PointDoubleXY(3, 2));
doTestCoordinateHash(false, new PointDoubleXY(1, 2), new PointDoubleXY(2, 1));
}
use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.
the class MiscellaneousTest2 method testDirectedEdgeComparator.
public void testDirectedEdgeComparator() {
final DirectedEdge d1 = new DirectedEdge(new Node(0, 0), new Node(10, 10), new PointDoubleXY(10, 10), true);
final DirectedEdge d2 = new DirectedEdge(new Node(0, 0), new Node(20, 20), new PointDoubleXY(20, 20), false);
assertEquals(0, d2.compareTo(d1));
}
Aggregations