Search in sources :

Example 56 with PointDoubleXY

use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.

the class TestPerfDistanceLinesPoints method newLine.

Geometry newLine(final double extent, final int nSegs) {
    final Point[] pts = new Point[] { new PointDoubleXY(0, 0), new PointDoubleXY(0, extent), new PointDoubleXY(extent, extent), new PointDoubleXY(extent, 0) };
    final Geometry outline = geomFact.lineString(pts);
    final double inc = extent / nSegs;
    return Densifier.densify(outline, inc);
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) Point(com.revolsys.geometry.model.Point) PointDoubleXY(com.revolsys.geometry.model.impl.PointDoubleXY)

Example 57 with PointDoubleXY

use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.

the class DelaunayRobustTest method randomPointsInGrid.

List<Point> randomPointsInGrid(final int nPts, final double basex, final double basey) {
    final List<Point> pts = new ArrayList<>();
    final int nSide = (int) Math.sqrt(nPts) + 1;
    for (int i = 0; i < nSide; i++) {
        for (int j = 0; j < nSide; j++) {
            final double x = basex + i * SIDE_LEN + SIDE_LEN * Math.random();
            final double y = basey + j * SIDE_LEN + SIDE_LEN * Math.random();
            pts.add(new PointDoubleXY(x, y));
        }
    }
    return pts;
}
Also used : ArrayList(java.util.ArrayList) Point(com.revolsys.geometry.model.Point) PointDoubleXY(com.revolsys.geometry.model.impl.PointDoubleXY) Point(com.revolsys.geometry.model.Point)

Example 58 with PointDoubleXY

use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.

the class TestDataBuilder method newTestGeoms.

public List newTestGeoms(final BoundingBox env, final int nItems, final double size, final int nPts) {
    final int nCells = (int) Math.sqrt(nItems);
    final List geoms = new ArrayList();
    final double width = env.getWidth();
    final double xInc = width / nCells;
    final double yInc = width / nCells;
    for (int i = 0; i < nCells; i++) {
        for (int j = 0; j < nCells; j++) {
            final Point base = new PointDoubleXY(env.getMinX() + i * xInc, env.getMinY() + j * yInc);
            final Geometry line = newLine(base, size, nPts);
            geoms.add(line);
        }
    }
    return geoms;
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) Point(com.revolsys.geometry.model.Point) PointDoubleXY(com.revolsys.geometry.model.impl.PointDoubleXY) Point(com.revolsys.geometry.model.Point)

Example 59 with PointDoubleXY

use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.

the class IsSimpleTest method test3TouchAtEndpoint.

/**
 * 3 LineStrings touching at an endpoint.
 *
 * @throws Exception
 */
public void test3TouchAtEndpoint() throws Exception {
    final String a = "MULTILINESTRING ((0 1, 1 1, 2 1),   (0 0, 1 0, 2 1),  (0 2, 1 2, 2 1))";
    // rings are simple under all rules
    runIsSimpleTest(a, true, new PointDoubleXY(2, 1));
}
Also used : PointDoubleXY(com.revolsys.geometry.model.impl.PointDoubleXY)

Example 60 with PointDoubleXY

use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.

the class IsSimpleTest method testMultiLineStringWithRingTouchAtEndpoint.

public void testMultiLineStringWithRingTouchAtEndpoint() throws Exception {
    final String a = "MULTILINESTRING ((100 100, 20 20, 200 20, 100 100), (100 200, 100 100))";
    // under Mod-2, the ring has no boundary, so the line intersects the
    // interior ==> not simple
    runIsSimpleTest(a, false, new PointDoubleXY(100, 100));
}
Also used : PointDoubleXY(com.revolsys.geometry.model.impl.PointDoubleXY)

Aggregations

PointDoubleXY (com.revolsys.geometry.model.impl.PointDoubleXY)138 Point (com.revolsys.geometry.model.Point)91 Geometry (com.revolsys.geometry.model.Geometry)36 ArrayList (java.util.ArrayList)19 BoundingBox (com.revolsys.geometry.model.BoundingBox)10 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)10 List (java.util.List)9 LineString (com.revolsys.geometry.model.LineString)8 Polygon (com.revolsys.geometry.model.Polygon)6 RobustLineIntersector (com.revolsys.geometry.algorithm.RobustLineIntersector)5 LengthIndexedLine (com.revolsys.geometry.linearref.LengthIndexedLine)5 LinearLocation (com.revolsys.geometry.linearref.LinearLocation)5 LocationIndexedLine (com.revolsys.geometry.linearref.LocationIndexedLine)5 LineSegmentDouble (com.revolsys.geometry.model.segment.LineSegmentDouble)5 PointDoubleXYZ (com.revolsys.geometry.model.impl.PointDoubleXYZ)4 LineSegment (com.revolsys.geometry.model.segment.LineSegment)4 AffineTransformation (com.revolsys.geometry.model.util.AffineTransformation)4 GeometricShapeFactory (com.revolsys.geometry.util.GeometricShapeFactory)4 Vertex (com.revolsys.geometry.model.vertex.Vertex)3 KdNode (com.revolsys.geometry.index.kdtree.KdNode)2