+ public List<IG2DNode> intersectingNodes(Rectangle2D rect, List<IG2DNode> result) {
+ final Tree tree = getSpatialDecomposition();
+ if (rect == null || tree.bounds == null || containedBy(tree.bounds, rect)) {
+ IG2DNode[] nodes = getSortedNodes();
+ for (IG2DNode node : nodes) {
+ if (node.validate()) {
+ result.add(node);
+ }
+ }
+ } else {
+ tree.rtree.intersects(toRectangle(rect), value -> {
+ //System.out.println("exec: " + value);
+ IG2DNode node = tree.toNodes.get(value);
+ //System.out.println(" node: " + node);
+ if (node == null || !node.validate())
+ return true;
+
+ result.add(node);
+ return true;
+ });
+ }
+ Collections.sort(result, G2DParentNode.G2DNODE_Z_COMPARATOR);
+ return result;
+ }
+