(RectHV rect)
| 100 | |
| 101 | // all points that are inside the rectangle (or on the boundary) |
| 102 | public Iterable<Point2D> range(RectHV rect) { |
| 103 | if (rect == null) throw new IllegalArgumentException(); |
| 104 | ArrayList<Point2D> arrayList = new ArrayList<>(); |
| 105 | if (!isEmpty()) range(root, rect, arrayList); |
| 106 | return arrayList; |
| 107 | } |
| 108 | |
| 109 | private void range(Node nd, RectHV rect, ArrayList<Point2D> arrayList) { |
| 110 | if (rect.contains(nd.p)) arrayList.add(nd.p); |