use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.
the class RobustLineIntersectorTest method testIsProper2.
public void testIsProper2() {
this.i.computeIntersectionPoints(new PointDoubleXY(10, 30), new PointDoubleXY(10, 0), new PointDoubleXY(11, 90), new PointDoubleXY(10, 10));
assertTrue(this.i.hasIntersection());
assertEquals(1, this.i.getIntersectionCount());
assertTrue(!this.i.isProper());
}
use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.
the class EdgeGraphTest method testNode.
public void testNode() throws Exception {
final EdgeGraph graph = build("MULTILINESTRING((0 0, 1 0), (0 0, 0 1), (0 0, -1 0))");
checkEdgeRing(graph, new PointDoubleXY(0, 0), new Point[] { new PointDoubleXY(1, 0), new PointDoubleXY(0, 1), new PointDoubleXY(-1, 0) });
checkEdge(graph, new PointDoubleXY(0, 0), new PointDoubleXY(1, 0));
}
use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.
the class JTSFunctions method newS.
private static Geometry newS(final Geometry g) {
final GeometryFactory gf = FunctionsUtil.getFactoryOrDefault(g);
final double centreX = WIDTH - S_RADIUS;
final Point[] top = new Point[] { new PointDoubleXY(WIDTH, HEIGHT), new PointDoubleXY(centreX, HEIGHT) };
final Point[] bottom = new Point[] { new PointDoubleXY(centreX, 0), new PointDoubleXY(WIDTH - 2 * S_RADIUS, 0) };
final GeometricShapeFactory gsf = new GeometricShapeFactory(gf);
gsf.setCentre(new PointDoubleXY(centreX, HEIGHT - S_RADIUS));
gsf.setSize(2 * S_RADIUS);
gsf.setNumPoints(10);
final LineString arcTop = gsf.newArc(0.5 * Math.PI, Math.PI);
final GeometricShapeFactory gsf2 = new GeometricShapeFactory(gf);
gsf2.setCentre(new PointDoubleXY(centreX, S_RADIUS));
gsf2.setSize(2 * S_RADIUS);
gsf2.setNumPoints(10);
final LineString arcBottom = gsf2.newArc(1.5 * Math.PI, Math.PI).reverse();
final PointList coordList = new PointList();
coordList.add(top, false);
coordList.add(CoordinatesListUtil.getPointArray(arcTop), false, 1, arcTop.getVertexCount() - 1);
coordList.add(new PointDoubleXY(centreX, HEIGHT / 2));
coordList.add(CoordinatesListUtil.getPointArray(arcBottom), false, 1, arcBottom.getVertexCount() - 1);
coordList.add(bottom, false);
return gf.lineString(coordList.toPointArray());
}
use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.
the class PreparedPolygonIntersectsStressTest method run.
public void run(final int nPts) {
// Geometry poly = newCircle(new BaseLasPoint((double)0, 0), 100, nPts);
final Geometry poly = newSineStar(new PointDoubleXY(0, 0), 100, nPts);
// System.out.println(poly);
//
// System.out.println();
// System.out.println("Running with " + nPts + " points");
test(poly);
}
use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.
the class PolygonGenerator method newBox.
private static LinearRing newBox(final double x, final double dx, final double y, final double dy, final int npoints, final GeometryFactory gf) {
// figure out the number of points per side
final int ptsPerSide = npoints / 4;
int rPtsPerSide = npoints % 4;
final Point[] coords = new Point[npoints + 1];
// start
coords[0] = new PointDoubleXY(gf.makePrecise(0, x), gf.makePrecise(1, y));
final int cindex = 1;
for (int i = 0; i < 4; i++) {
// sides
final int npts = ptsPerSide + (rPtsPerSide-- > 0 ? 1 : 0);
if (i % 2 == 1) {
// odd vert
double cy = dy / npts;
if (i > 1) {
cy *= -1;
}
final double tx = coords[cindex - 1].getX();
final double sy = coords[cindex - 1].getY();
for (int j = 0; j < npts; j++) {
coords[cindex] = new PointDoubleXY(gf.makePrecise(0, tx), gf.makePrecise(1, sy + (j + 1) * cy));
}
} else {
// even horz
double cx = dx / npts;
if (i > 1) {
cx *= -1;
}
final double ty = coords[cindex - 1].getY();
final double sx = coords[cindex - 1].getX();
for (int j = 0; j < npts; j++) {
coords[cindex] = new PointDoubleXY(gf.makePrecise(0, sx + (j + 1) * cx), gf.makePrecise(1, ty));
}
}
}
// end
coords[npoints] = new PointDoubleXY(gf.makePrecise(0, x), gf.makePrecise(1, y));
return gf.linearRing(coords);
}
Aggregations