MCPcopy Create free account
hub / github.com/MolinDeng/Princeton-algs4 / main

Method main

LabEnv/05Lab/KdTreeVisualizer.java:18–39  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

16public class KdTreeVisualizer {
17
18 public static void main(String[] args) {
19 RectHV rect = new RectHV(0.0, 0.0, 1.0, 1.0);
20 StdDraw.enableDoubleBuffering();
21 KdTree kdtree = new KdTree();
22 while (true) {
23 if (StdDraw.isMousePressed()) {
24 double x = StdDraw.mouseX();
25 double y = StdDraw.mouseY();
26 StdOut.printf("%8.6f %8.6f\n", x, y);
27 Point2D p = new Point2D(x, y);
28 if (rect.contains(p)) {
29 StdOut.printf("%8.6f %8.6f\n", x, y);
30 kdtree.insert(p);
31 StdDraw.clear();
32 kdtree.draw();
33 StdDraw.show();
34 }
35 }
36 StdDraw.pause(20);
37 }
38
39 }
40}

Callers

nothing calls this directly

Calls 3

insertMethod · 0.95
drawMethod · 0.95
containsMethod · 0.45

Tested by

no test coverage detected