use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.
the class PerturbedGridPolygonBuilder method buildGrid.
private Geometry buildGrid() {
final LineString[] lines = new LineString[this.numLines * 2];
int index = 0;
for (int i = 0; i < this.numLines; i++) {
final Point p0 = new PointDoubleXY(getRandOrdinate(), 0);
final Point p1 = new PointDoubleXY(getRandOrdinate(), this.gridWidth);
final LineString line = this.geomFactory.lineString(new Point[] { p0, p1 });
lines[index++] = line;
}
for (int i = 0; i < this.numLines; i++) {
final Point p0 = new PointDoubleXY(0, getRandOrdinate());
final Point p1 = new PointDoubleXY(this.gridWidth, getRandOrdinate());
final LineString line = this.geomFactory.lineString(new Point[] { p0, p1 });
lines[index++] = line;
}
final Lineal ml = this.geomFactory.lineal(lines);
final Geometry grid = ml.buffer(this.lineWidth);
// System.out.println(grid);
return grid;
}
use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.
the class RobustLineIntersectorTest method testA.
public void testA() {
final Point p1 = new PointDoubleXY(-123456789, -40);
final Point p2 = new PointDoubleXY(381039468754763d, 123456789);
final GeometryFactory geometryFactory = GeometryFactory.DEFAULT_3D;
final LineString l = geometryFactory.lineString(new Point[] { p1, p2 });
final Point p = geometryFactory.point(0.0, 0.0);
assertEquals(false, l.intersects(p));
assertEquals(false, geometryFactory.lineString(p1, p2).isOnLine(p));
assertEquals(-1, CGAlgorithmsDD.orientationIndex(p1, p2, p));
}
use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.
the class RobustLineIntersectorTest method testCollinear1.
public void testCollinear1() {
final RobustLineIntersector i = new RobustLineIntersector();
final Point p1 = new PointDoubleXY(10, 10);
final Point p2 = new PointDoubleXY(20, 10);
final Point q1 = new PointDoubleXY(22, 10);
final Point q2 = new PointDoubleXY(30, 10);
i.computeIntersectionPoints(p1, p2, q1, q2);
assertEquals(LineIntersector.NO_INTERSECTION, i.getIntersectionCount());
assertTrue(!i.isProper());
assertTrue(!i.hasIntersection());
}
use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.
the class RobustLineIntersectorTest method testEndpointIntersection.
public void testEndpointIntersection() {
this.i.computeIntersectionPoints(new PointDoubleXY(100, 100), new PointDoubleXY(10, 100), new PointDoubleXY(100, 10), new PointDoubleXY(100, 100));
assertTrue(this.i.hasIntersection());
assertEquals(1, this.i.getIntersectionCount());
}
use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.
the class RobustLineIntersectorTest method testEndpointIntersection2.
public void testEndpointIntersection2() {
this.i.computeIntersectionPoints(new PointDoubleXY(190, 50), new PointDoubleXY(120, 100), new PointDoubleXY(120, 100), new PointDoubleXY(50, 150));
assertTrue(this.i.hasIntersection());
assertEquals(1, this.i.getIntersectionCount());
assertEquals(new PointDoubleXY(120, 100), this.i.getIntersection(1));
}
Aggregations