Comments (3)
Hey, again sorry for the late response, didn't see the issues here.
This may be intended use and a misunderstanding. Some example code would be awesome.
What I understood you tried to achieve something like this? http://jsfiddle.net/ua9203zb/2/
It has a 4000x4000 area with 4x4 possible quadtrees, limited by the max_levels of 2.
The top left 1000x1000 is constantly retrieved and those objects are highlighted in white.
(Draw functions are scaled down by 10)
from quadtree-js.
Yes, your setup is right and this screenshot shows, what I find unexpected with it:
http://s27.postimg.org/63s8wzt4z/Quadtree.png
But if I remember right, it just occures with non-point Items. It is totally fine, when you just use point-dimensional items
I modified your example a bit: http://jsfiddle.net/zwcckn5s/
All retrieved tiles are drawn in blue when you query for the upper left corner (0, 0, 1000, 1000)
from quadtree-js.
I did some updates on the code and came across this post one again.
Like I said in the other issue months ago, the screenshot shows intended behaviour since the Quadtree only narrows down the objects of possible collision.
The problem in your example is the dimensions of the objects, they are 1000x1000 units, aligned in a grid. Same grid as the Quadtree, I don't see the actual point in this? They cannot fit into one exact subnode, since they are same size. This is where the screenshot effect comes in: all objects touching a shared border with the retrieve area are possible candidates.
When you debug myTree in the given example, you see that all objects belong to the master node, the Quadtree itself.
I reduced the objects dimensions by 2 units, this way it works http://jsfiddle.net/zwcckn5s/1/
When you debug there, objects are stored in subnodes, the way it should be.
There are new examples and docs, maybe check them out.
from quadtree-js.
Related Issues (17)
- how to build quadtree? HOT 2
- Rounding sub quad bounds HOT 1
- update elements? HOT 3
- Best method to check all players against all players in the quadtree? HOT 2
- TypeError: t is Undefined HOT 4
- Adding support for more primitives checks HOT 9
- retrieving node from object HOT 2
- Adding a licence file HOT 1
- It just doesn't work? HOT 3
- is the width and height from the center or from a corner? HOT 3
- Modify and remove objects from quad-tree HOT 3
- Infinite loop issue HOT 5
- hello,i'm chinese,My English is very terrible.I want to how to use this quadtreejs in nodejs HOT 2
- retrieval of object out side the node HOT 6
- This visualization looks good, but there are too many objects on parent node HOT 3
- Quad Tree should only store objects on leaf nodes HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quadtree-js.