Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic aabb query to the lib #29

Closed
Fxlr8 opened this issue Jun 17, 2020 · 2 comments · Fixed by #33
Closed

Add basic aabb query to the lib #29

Fxlr8 opened this issue Jun 17, 2020 · 2 comments · Fixed by #33

Comments

@Fxlr8
Copy link

Fxlr8 commented Jun 17, 2020

Hi, It took me some time to find this examlple

// Find the nodes within the specified rectangle.
function search(quadtree, x0, y0, x3, y3) {
  quadtree.visit(function(node, x1, y1, x2, y2) {
    if (!node.length) {
      do {
        var d = node.data;
        d.scanned = true;
        d.selected = (d[0] >= x0) && (d[0] < x3) && (d[1] >= y0) && (d[1] < y3);
      } while (node = node.next);
    }
    return x1 >= x3 || y1 >= y3 || x2 < x0 || y2 < y0;
  });
}

Please add this method to the tree, or at least add it to the README

@mbostock
Copy link
Member

Related #18 (comment).

@Fil
Copy link
Member

Fil commented Jun 26, 2020

Is the code in https://observablehq.com/d/ff2450667f13132f readable? I tried to comment it in detail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants