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

findInCircle? #30

Closed
Fil opened this issue Jun 26, 2020 · 6 comments
Closed

findInCircle? #30

Fil opened this issue Jun 26, 2020 · 6 comments
Assignees

Comments

@Fil
Copy link
Member

Fil commented Jun 26, 2020

I have revised findAll (see the discussion in #18):
https://observablehq.com/d/ff2450667f13132f

also prepared a quadtree.findInPolygon() algorithm (which was fun!) (ping @gka)
https://observablehq.com/d/54a6e96b6630b0d9

I think both functions could be added to this module—however findInPolygon adds a dependency on a dedicated functions in d3.polygon (polygonIntersect, d3/d3-polygon#28), that doesn't yet exist, so don't expect it to land too soon (if at all).

Anyways it's already usable by copying the code, and it would be great to have tests and feedback.

@Fil Fil self-assigned this Jun 26, 2020
@Fil Fil changed the title findAll, findInPolygon findAll, findInPolygon? Jun 26, 2020
@curran
Copy link

curran commented Jun 26, 2020

This is very cool work!

@Fil Fil changed the title findAll, findInPolygon? findInCircle, findInPolygon? Jun 28, 2020
@Fil
Copy link
Member Author

Fil commented Jun 29, 2020

findInPolygon was very fun to write but unfortunately, in my tests, even with a million data points it's still faster (or about the same speed) to run the baseline algorithm for (const d of data) { polygonContains(d) } than to use a quadtree. findAll (now renamed findInCircle) is probably similar, but its code footprint is much smaller.

@Fil Fil changed the title findInCircle, findInPolygon? findInCircle? Jun 29, 2020
Fil added a commit that referenced this issue Jul 7, 2020
@Fil
Copy link
Member Author

Fil commented Feb 2, 2021

Published as an example of a visit https://observablehq.com/@d3/quadtree-findincircle

@curran
Copy link

curran commented Feb 2, 2021

I see #32 was closed without being merged. Why is that?

IMO the feature would be a useful addition to d3-quadtree.

@Fil
Copy link
Member Author

Fil commented Feb 2, 2021

I've closed #32 because I felt the code would be more useful as an example, rather than as another method added to the API. If people start using it en masse, it might change, but in the meantime what we probably need to do is to link to examples and show that quadtree.visit is not as intimidating as it might seem.

@curran
Copy link

curran commented Feb 2, 2021

Got it. Thanks!

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.

2 participants