Search in sources :

Example 26 with PointDoubleXY

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

the class ConvexHullTest method testAllIdenticalPoints.

public void testAllIdenticalPoints() throws Exception {
    final List<Point> points = new ArrayList<>();
    for (int i = 0; i < 100; i++) {
        points.add(new PointDoubleXY(0.0, 0));
    }
    final Geometry actualGeometry = ConvexHull.convexHull(this.geometryFactory, points);
    final Geometry expectedGeometry = this.geometryFactory.geometry("POINT(0 0)");
    assertTrue(expectedGeometry.equals(2, actualGeometry));
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) ArrayList(java.util.ArrayList) Point(com.revolsys.geometry.model.Point) PointDoubleXY(com.revolsys.geometry.model.impl.PointDoubleXY) Point(com.revolsys.geometry.model.Point)

Example 27 with PointDoubleXY

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

the class AffineTransformationBuilderTest method run.

void run(final double p0x, final double p0y, final double p1x, final double p1y, final double p2x, final double p2y, final double pp0x, final double pp0y, final double pp1x, final double pp1y, final double pp2x, final double pp2y) {
    final Point p0 = new PointDoubleXY(p0x, p0y);
    final Point p1 = new PointDoubleXY(p1x, p1y);
    final Point p2 = new PointDoubleXY(p2x, p2y);
    final Point pp0 = new PointDoubleXY(pp0x, pp0y);
    final Point pp1 = new PointDoubleXY(pp1x, pp1y);
    final Point pp2 = new PointDoubleXY(pp2x, pp2y);
    final AffineTransformationBuilder atb = new AffineTransformationBuilder(p0, p1, p2, pp0, pp1, pp2);
    final AffineTransformation trans = atb.getTransformation();
    assertEqualPoint(pp0, trans.transform(p0));
    assertEqualPoint(pp1, trans.transform(p1));
    assertEqualPoint(pp2, trans.transform(p2));
}
Also used : AffineTransformation(com.revolsys.geometry.model.util.AffineTransformation) AffineTransformationBuilder(com.revolsys.geometry.model.util.AffineTransformationBuilder) Point(com.revolsys.geometry.model.Point) PointDoubleXY(com.revolsys.geometry.model.impl.PointDoubleXY)

Example 28 with PointDoubleXY

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

the class AffineTransformationBuilderTest method runSingular.

void runSingular(final double p0x, final double p0y, final double p1x, final double p1y, final double p2x, final double p2y, final double pp0x, final double pp0y, final double pp1x, final double pp1y, final double pp2x, final double pp2y) {
    final Point p0 = new PointDoubleXY(p0x, p0y);
    final Point p1 = new PointDoubleXY(p1x, p1y);
    final Point p2 = new PointDoubleXY(p2x, p2y);
    final Point pp0 = new PointDoubleXY(pp0x, pp0y);
    final Point pp1 = new PointDoubleXY(pp1x, pp1y);
    final Point pp2 = new PointDoubleXY(pp2x, pp2y);
    final AffineTransformationBuilder atb = new AffineTransformationBuilder(p0, p1, p2, pp0, pp1, pp2);
    final AffineTransformation trans = atb.getTransformation();
    assertEquals(trans, null);
}
Also used : AffineTransformation(com.revolsys.geometry.model.util.AffineTransformation) AffineTransformationBuilder(com.revolsys.geometry.model.util.AffineTransformationBuilder) Point(com.revolsys.geometry.model.Point) PointDoubleXY(com.revolsys.geometry.model.impl.PointDoubleXY)

Example 29 with PointDoubleXY

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

the class LineSegmentTest method checkOffset.

void checkOffset(final double x0, final double y0, final double x1, final double y1, final double segFrac, final double offset, final double expectedX, final double expectedY) {
    final LineSegment seg = new LineSegmentDouble(2, x0, y0, x1, y1);
    final Point p = seg.pointAlongOffset(segFrac, offset);
    assertTrue(equalsTolerance(new PointDoubleXY(expectedX, expectedY), p, 0.000001));
}
Also used : LineSegmentDouble(com.revolsys.geometry.model.segment.LineSegmentDouble) Point(com.revolsys.geometry.model.Point) PointDoubleXY(com.revolsys.geometry.model.impl.PointDoubleXY) LineSegment(com.revolsys.geometry.model.segment.LineSegment)

Example 30 with PointDoubleXY

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

the class LineSegmentTest method testProjectionFactor.

public void testProjectionFactor() {
    // zero-length line
    final LineSegment seg = new LineSegmentDouble(2, 10, 0, 10, 0);
    assertTrue(Double.isNaN(seg.projectionFactor(new PointDoubleXY(11.0, 0))));
    final LineSegment seg2 = new LineSegmentDouble(2, 10, 0, 20, 0);
    assertTrue(seg2.projectionFactor(new PointDoubleXY(11.0, 0)) == 0.1);
}
Also used : LineSegmentDouble(com.revolsys.geometry.model.segment.LineSegmentDouble) PointDoubleXY(com.revolsys.geometry.model.impl.PointDoubleXY) LineSegment(com.revolsys.geometry.model.segment.LineSegment)

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