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;
}
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;
}
}
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;
}
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;
}
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;
}
Aggregations