Search in sources :

Example 11 with BoundingBoxDoubleXY

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

the class TriangulatedIrregularNetwork method getTriangles.

default List<Triangle> getTriangles(final double x, final double y) {
    final List<Triangle> triangles = new ArrayList<>();
    final Predicate<Triangle> filter = triangle -> triangle.containsPoint(x, y);
    final BoundingBox boundingBox = new BoundingBoxDoubleXY(x, y);
    forEachTriangle(boundingBox, filter, triangles::add);
    return triangles;
}
Also used : BoundingBoxDoubleXY(com.revolsys.geometry.model.impl.BoundingBoxDoubleXY) LineSegment(com.revolsys.geometry.model.segment.LineSegment) Predicate(java.util.function.Predicate) IoFactory(com.revolsys.io.IoFactory) LineString(com.revolsys.geometry.model.LineString) ArrayList(java.util.ArrayList) PointDoubleXYZ(com.revolsys.geometry.model.impl.PointDoubleXYZ) Consumer(java.util.function.Consumer) IoFactoryRegistry(com.revolsys.io.IoFactoryRegistry) List(java.util.List) ScaledIntegerTriangulatedIrregularNetwork(com.revolsys.elevation.tin.compactbinary.ScaledIntegerTriangulatedIrregularNetwork) Resource(com.revolsys.spring.resource.Resource) GeometryFactoryProxy(com.revolsys.geometry.model.GeometryFactoryProxy) Triangle(com.revolsys.geometry.model.Triangle) LineSegmentDoubleGF(com.revolsys.geometry.model.segment.LineSegmentDoubleGF) Predicates(com.revolsys.predicate.Predicates) MapEx(com.revolsys.collection.map.MapEx) AsciiTin(com.revolsys.elevation.tin.tin.AsciiTin) GeometryFactory(com.revolsys.geometry.model.GeometryFactory) Lists(com.revolsys.collection.list.Lists) Geometry(com.revolsys.geometry.model.Geometry) BoundingBox(com.revolsys.geometry.model.BoundingBox) Point(com.revolsys.geometry.model.Point) BoundingBox(com.revolsys.geometry.model.BoundingBox) Triangle(com.revolsys.geometry.model.Triangle) ArrayList(java.util.ArrayList) BoundingBoxDoubleXY(com.revolsys.geometry.model.impl.BoundingBoxDoubleXY)

Example 12 with BoundingBoxDoubleXY

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

the class NodeQuadTree method getBoundingBox.

@Override
public BoundingBox getBoundingBox(final Node<T> node) {
    if (node == null) {
        return BoundingBox.empty();
    } else {
        final double x = node.getX();
        final double y = node.getY();
        final BoundingBox envelope = new BoundingBoxDoubleXY(x, y, x, y);
        return envelope;
    }
}
Also used : BoundingBox(com.revolsys.geometry.model.BoundingBox) BoundingBoxDoubleXY(com.revolsys.geometry.model.impl.BoundingBoxDoubleXY)

Example 13 with BoundingBoxDoubleXY

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

the class PointQuadTree method findWithinDistance.

public List<T> findWithinDistance(final Point point, final double maxDistance) {
    final double x = point.getX();
    final double y = point.getY();
    BoundingBox envelope = new BoundingBoxDoubleXY(x, y);
    envelope = envelope.expand(maxDistance);
    final List<T> results = new ArrayList<>();
    if (this.root != null) {
        this.root.findWithin(results, x, y, maxDistance, envelope);
    }
    return results;
}
Also used : BoundingBox(com.revolsys.geometry.model.BoundingBox) ArrayList(java.util.ArrayList) BoundingBoxDoubleXY(com.revolsys.geometry.model.impl.BoundingBoxDoubleXY)

Example 14 with BoundingBoxDoubleXY

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

the class MonotoneChain method getEnvelope.

public BoundingBox getEnvelope() {
    if (this.env == null) {
        final double x1 = this.points.getX(this.start);
        final double y1 = this.points.getY(this.start);
        final double x2 = this.points.getX(this.end);
        final double y2 = this.points.getY(this.end);
        this.env = new BoundingBoxDoubleXY(x1, y1, x2, y2);
    }
    return this.env;
}
Also used : BoundingBoxDoubleXY(com.revolsys.geometry.model.impl.BoundingBoxDoubleXY)

Example 15 with BoundingBoxDoubleXY

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

the class RectangleIntersectsPerfTest method newRectangles.

/**
 * Creates a set of rectangular Polygons which
 * cover the given envelope.
 * The rectangles
 * At least nRect rectangles are created.
 *
 * @param env
 * @param nRect
 * @param rectSize
 * @return
 */
List<Geometry> newRectangles(final BoundingBox env, final int nRect, final double rectSize) {
    final int nSide = 1 + (int) Math.sqrt(nRect);
    final double dx = env.getWidth() / nSide;
    final double dy = env.getHeight() / nSide;
    final List<Geometry> rectList = new ArrayList<>();
    for (int i = 0; i < nSide; i++) {
        for (int j = 0; j < nSide; j++) {
            final double baseX = env.getMinX() + i * dx;
            final double baseY = env.getMinY() + j * dy;
            final BoundingBox envRect = new BoundingBoxDoubleXY(baseX, baseY, baseX + dx, baseY + dy);
            final Geometry rect = envRect.toGeometry();
            rectList.add(rect);
        }
    }
    return rectList;
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) BoundingBox(com.revolsys.geometry.model.BoundingBox) ArrayList(java.util.ArrayList) BoundingBoxDoubleXY(com.revolsys.geometry.model.impl.BoundingBoxDoubleXY) Point(com.revolsys.geometry.model.Point)

Aggregations

BoundingBoxDoubleXY (com.revolsys.geometry.model.impl.BoundingBoxDoubleXY)26 BoundingBox (com.revolsys.geometry.model.BoundingBox)18 ArrayList (java.util.ArrayList)7 List (java.util.List)6 Point (com.revolsys.geometry.model.Point)5 Geometry (com.revolsys.geometry.model.Geometry)4 StrTree (com.revolsys.geometry.index.strtree.StrTree)3 KdNode (com.revolsys.geometry.index.kdtree.KdNode)2 KdTree (com.revolsys.geometry.index.kdtree.KdTree)2 LineString (com.revolsys.geometry.model.LineString)2 PointDoubleXY (com.revolsys.geometry.model.impl.PointDoubleXY)2 Iterator (java.util.Iterator)2 Lists (com.revolsys.collection.list.Lists)1 MapEx (com.revolsys.collection.map.MapEx)1 ScaledIntegerTriangulatedIrregularNetwork (com.revolsys.elevation.tin.compactbinary.ScaledIntegerTriangulatedIrregularNetwork)1 AsciiTin (com.revolsys.elevation.tin.tin.AsciiTin)1 RayCrossingCounter (com.revolsys.geometry.algorithm.RayCrossingCounter)1 Area (com.revolsys.geometry.cs.Area)1 Authority (com.revolsys.geometry.cs.Authority)1 ParameterValueString (com.revolsys.geometry.cs.ParameterValueString)1