Search in sources :

Example 51 with PointDoubleXY

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

the class CreateRandomShapeFunctions method haltonPointsWithBases.

public static Geometry haltonPointsWithBases(final Geometry g, final int nPts, final int basei, final int basej) {
    final BoundingBox env = FunctionsUtil.getEnvelopeOrDefault(g);
    final Point[] pts = new Point[nPts];
    final double baseX = env.getMinX();
    final double baseY = env.getMinY();
    int i = 0;
    while (i < nPts) {
        final double x = baseX + env.getWidth() * haltonOrdinate(i + 1, basei);
        final double y = baseY + env.getHeight() * haltonOrdinate(i + 1, basej);
        final Point p = new PointDoubleXY(x, y);
        if (!env.covers(p)) {
            continue;
        }
        pts[i++] = p;
    }
    return FunctionsUtil.getFactoryOrDefault(g).punctual(pts);
}
Also used : BoundingBox(com.revolsys.geometry.model.BoundingBox) Point(com.revolsys.geometry.model.Point) PointDoubleXY(com.revolsys.geometry.model.impl.PointDoubleXY) Point(com.revolsys.geometry.model.Point)

Example 52 with PointDoubleXY

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

the class AffineTransformationFunctions method transformByBaseline.

public static Geometry transformByBaseline(final Geometry g, final Geometry destBaseline) {
    final BoundingBox env = g.getBoundingBox();
    final Point src0 = new PointDoubleXY(env.getMinX(), env.getMinY());
    final Point src1 = new PointDoubleXY(env.getMaxX(), env.getMinY());
    final Point[] destPts = CoordinatesListUtil.getPointArray(destBaseline);
    final Point dest0 = destPts[0];
    final Point dest1 = destPts[1];
    final AffineTransformation trans = AffineTransformationFactory.newFromBaseLines(src0, src1, dest0, dest1);
    return trans.transform(g);
}
Also used : BoundingBox(com.revolsys.geometry.model.BoundingBox) AffineTransformation(com.revolsys.geometry.model.util.AffineTransformation) Point(com.revolsys.geometry.model.Point) PointDoubleXY(com.revolsys.geometry.model.impl.PointDoubleXY)

Example 53 with PointDoubleXY

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

the class TestPerfDistanceGeomPair method newSineStars.

Geometry[] newSineStars(final int nPts) {
    final SineStarFactory gsf = new SineStarFactory();
    gsf.setCentre(new PointDoubleXY(0, 0));
    gsf.setSize(100);
    gsf.setNumPoints(nPts);
    final Geometry g = gsf.newSineStar().getBoundary();
    gsf.setCentre(new PointDoubleXY(0, this.separationDist));
    final Geometry g2 = gsf.newSineStar().getBoundary();
    return new Geometry[] { g, g2 };
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) SineStarFactory(com.revolsys.geometry.model.util.SineStarFactory) PointDoubleXY(com.revolsys.geometry.model.impl.PointDoubleXY)

Example 54 with PointDoubleXY

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

the class TestPerfDistanceLinesPoints method newPoints.

Geometry[] newPoints(final BoundingBox extent, final int nPtsSide) {
    final Geometry[] pts = new Geometry[nPtsSide * nPtsSide];
    int index = 0;
    final double xinc = extent.getWidth() / nPtsSide;
    final double yinc = extent.getHeight() / nPtsSide;
    for (int i = 0; i < nPtsSide; i++) {
        for (int j = 0; j < nPtsSide; j++) {
            pts[index++] = geomFact.point(new PointDoubleXY(extent.getMinX() + i * xinc, extent.getMinY() + j * yinc));
        }
    }
    return pts;
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) PointDoubleXY(com.revolsys.geometry.model.impl.PointDoubleXY) Point(com.revolsys.geometry.model.Point)

Example 55 with PointDoubleXY

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

the class TestPerfDistanceLinesPoints method newDiagonalLine.

Geometry newDiagonalLine(final double extent, final int nSegs) {
    final Point[] pts = new Point[nSegs + 1];
    pts[0] = new PointDoubleXY(0, 0);
    final double inc = extent / nSegs;
    for (int i = 1; i <= nSegs; i++) {
        final double ord = i * inc;
        pts[i] = new PointDoubleXY(ord, ord);
    }
    return geomFact.lineString(pts);
}
Also used : Point(com.revolsys.geometry.model.Point) PointDoubleXY(com.revolsys.geometry.model.impl.PointDoubleXY) Point(com.revolsys.geometry.model.Point)

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