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

Extent is broken? #44

Open
nemosmithasf opened this issue Apr 29, 2022 · 2 comments
Open

Extent is broken? #44

nemosmithasf opened this issue Apr 29, 2022 · 2 comments

Comments

@nemosmithasf
Copy link

nemosmithasf commented Apr 29, 2022

If a tree has the extent [[1,1],[5,5]], calling tree.extent( tree.extent() ) returns a tree with the extent [[1,1], [9,9]]

@Fil
Copy link
Member

Fil commented Apr 29, 2022

A point that is on the upper limit (of x or of y) belongs to the quad that is above it.

d3.quadtree([[0, 0]]).cover(0.99999999, 0).extent() // [[0,0],[1,1]]  
d3.quadtree([[0, 0]]).cover(1, 0).extent() // [[0,0],[2,2]]

but now that you're pointing at this, is this sentence correct?
x0 and y0 are the inclusive lower bounds and x1 and y1 are the inclusive upper bounds”
https://github.com/d3/d3-quadtree#quadtree_extent ; shouldn't it be "exclusive" for the upper bounds?

@nemosmithasf
Copy link
Author

That's what I assumed, but isn't it count-intuitive for tree.extent( tree.extent() ) to return a different result?

The main problem is that it makes serializing/unserializing the quadtree very awkward, because there's no other way to set the extent that doesn't reach into private properties (e.g. _x0, _y0)

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

No branches or pull requests

2 participants