@Test @Ignore public void visualize() { int N = 50; Set<RectHV> input = generateRect(N); for (RectHV rect : input) rect.draw(); StdDraw.enableDoubleBuffering(); IntervalSearchTree<Double, RectHV> invST = new IntervalST<>(); Map<RectHV, Set<RectHV>> res = RectangleIntersection.findAllIntersection(input, invST); boolean find = false; while (true) { if (StdDraw.isMousePressed()) { if (find) { StdDraw.clear(); StdDraw.setPenColor(Color.black); for (RectHV rect : input) rect.draw(); } find = false; double x = StdDraw.mouseX(); double y = StdDraw.mouseY(); for (RectHV rect : input) { if (Math.abs(rect.xmin() - x) < 0.02 && Math.abs(rect.ymin() - y) < 0.02) { System.out.println(rect); find = true; StdDraw.setPenColor(Color.red); rect.draw(); StdDraw.setPenColor(Color.blue); for (RectHV intersect : res.get(rect)) intersect.draw(); StdDraw.show(); StdDraw.pause(50); break; } } } if (StdDraw.isKeyPressed(KeyEvent.VK_ENTER)) { if (invST instanceof IntervalST) { System.out.println("use exp"); invST = new IntervalSTExp<>(); } else { System.out.println("use test"); invST = new IntervalST<>(); } res = RectangleIntersection.findAllIntersection(input, invST); } } }
public static Map<RectHV, Set<RectHV>> findAllIntersection(Set<RectHV> input) { return findAllIntersection(input, new IntervalST<>()); }
RectangleIntersection { public static Map<RectHV, Set<RectHV>> findAllIntersection(Set<RectHV> input) { return findAllIntersection(input, new IntervalST<>()); } }
RectangleIntersection { public static Map<RectHV, Set<RectHV>> findAllIntersection(Set<RectHV> input) { return findAllIntersection(input, new IntervalST<>()); }  }
RectangleIntersection { public static Map<RectHV, Set<RectHV>> findAllIntersection(Set<RectHV> input) { return findAllIntersection(input, new IntervalST<>()); }  static Map<RectHV, Set<RectHV>> findAllIntersection(Set<RectHV> input); static Map<RectHV, Set<RectHV>> findAllIntersection(Set<RectHV> input,
                                                               IntervalSearchTree<Double, RectHV> intervalST); }
RectangleIntersection { public static Map<RectHV, Set<RectHV>> findAllIntersection(Set<RectHV> input) { return findAllIntersection(input, new IntervalST<>()); }  static Map<RectHV, Set<RectHV>> findAllIntersection(Set<RectHV> input); static Map<RectHV, Set<RectHV>> findAllIntersection(Set<RectHV> input,
                                                               IntervalSearchTree<Double, RectHV> intervalST);  }