Search in sources :

Example 46 with Geometry

use of com.revolsys.geometry.model.Geometry 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);
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) PointDoubleXY(com.revolsys.geometry.model.impl.PointDoubleXY)

Example 47 with Geometry

use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.

the class PreparedPolygonIntersectsStressTest method newSineStar.

Geometry newSineStar(final Point origin, final double size, final int nPts) {
    final SineStarFactory gsf = new SineStarFactory();
    gsf.setCentre(origin);
    gsf.setSize(size);
    gsf.setNumPoints(nPts);
    gsf.setArmLengthRatio(0.1);
    gsf.setNumArms(20);
    final Geometry poly = gsf.newSineStar();
    return poly;
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) SineStarFactory(com.revolsys.geometry.model.util.SineStarFactory)

Example 48 with Geometry

use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.

the class PreparedPolygonIntersectsStressTest method newCircle.

Geometry newCircle(final Point origin, final double size, final int nPts) {
    final GeometricShapeFactory gsf = new GeometricShapeFactory();
    gsf.setCentre(origin);
    gsf.setSize(size);
    gsf.setNumPoints(nPts);
    final Geometry circle = gsf.newCircle();
    // Geometry g = gRect.getExteriorRing();
    return circle;
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) GeometricShapeFactory(com.revolsys.geometry.util.GeometricShapeFactory)

Example 49 with Geometry

use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.

the class StressTestHarness method newTestCircle.

Geometry newTestCircle(final Point base, final double size, final int nPts) {
    final GeometricShapeFactory gsf = new GeometricShapeFactory();
    gsf.setCentre(base);
    gsf.setSize(size);
    gsf.setNumPoints(nPts);
    final Geometry circle = gsf.newCircle();
    // System.out.println(circle);
    return circle;
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) GeometricShapeFactory(com.revolsys.geometry.util.GeometricShapeFactory)

Example 50 with Geometry

use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.

the class TriangleFunctions method circumcentre.

public static Geometry circumcentre(final Geometry geometry) {
    return geometry.applyGeometry((final Geometry part) -> {
        final Point[] pts = trianglePts(part);
        final Point cc = Triangles.circumcentre(pts[0], pts[1], pts[2]);
        final GeometryFactory geomFact = FunctionsUtil.getFactoryOrDefault(part);
        return geomFact.point(cc);
    });
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) GeometryFactory(com.revolsys.geometry.model.GeometryFactory) Point(com.revolsys.geometry.model.Point)

Aggregations

Geometry (com.revolsys.geometry.model.Geometry)488 Point (com.revolsys.geometry.model.Point)140 LineString (com.revolsys.geometry.model.LineString)87 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)75 ArrayList (java.util.ArrayList)70 BoundingBox (com.revolsys.geometry.model.BoundingBox)39 PointDoubleXY (com.revolsys.geometry.model.impl.PointDoubleXY)39 Polygon (com.revolsys.geometry.model.Polygon)34 List (java.util.List)33 Record (com.revolsys.record.Record)32 Iterator (java.util.Iterator)20 RecordDefinition (com.revolsys.record.schema.RecordDefinition)18 LinearRing (com.revolsys.geometry.model.LinearRing)16 Vertex (com.revolsys.geometry.model.vertex.Vertex)16 LayerRecord (com.revolsys.swing.map.layer.record.LayerRecord)14 LineSegment (com.revolsys.geometry.model.segment.LineSegment)13 GeometricShapeFactory (com.revolsys.geometry.util.GeometricShapeFactory)13 FieldDefinition (com.revolsys.record.schema.FieldDefinition)12 DataType (com.revolsys.datatype.DataType)10 IOException (java.io.IOException)10