Comments (8)
It's a pretty uncommon use case, but I'd like to make RBush support it too. Can you set up the most minimal test case that reproduces the problem so that I can look into fixing it faster?
from rbush.
hey @Pieter-Jan, any updates?
from rbush.
Hey @mourner thanks for taking interest in this issue!
I read some more about R-trees and realised that my problem is very hard to support by an R-tree. I was unable to create a "minimal" situation where this issue started occurring in Rbush but I did notice that jsts' strtree dynamically enlarges the number of children for the "nodes" when I feed the same data (this takes a lot of time). I am not sure what they do next because the performance is still beter than a complete search. This suprises me, because the bounding box of an infinitely long line is infinite as well.
To give you a perspective, I am trying to come up with a way to improve the performance of "snapping to objects" in a drawing tool (like powerpoint, ...) where there are >1000 objects.
from rbush.
@Pieter-Jan nice use case! I think the best way to approach this would be to have 2 separate 1D binary search trees — one for X axis and one for Y axis. Search for the nearest neighbor is trivial in such case, and you would just do 2 o(log N)
lookups that would be pretty much instant (even with a million objects) to find the snapping lines.
from rbush.
I think there might be an edge case when a bbox is infinite on only one side of one axis, i.e. { minx: 0, maxx: Infinity, miny: -10, maxy: 10 }
.
Granted, it's not what the initial query is about, but might be important to take into account when approaching similar problems.
from rbush.
Hey @mourner Yes that would be great! Unfortunately I realised recently that we should support snap lines in any direction so I am still looking for a better solution :).
from rbush.
@Pieter-Jan maybe you should still try the 1D BSP approach, but have a BSP for every unique angle value. It's unlikely that angles will vary too much on one scene.
from rbush.
I'm sure you can do away with a linear loop though. Doing a 1000 point to line distance calculations per frame is nothing for a modern browser.
from rbush.
Related Issues (20)
- Can you provide a browserify distribution? HOT 1
- How to limit the result count from the query? HOT 11
- how to search by id ? HOT 2
- tree.getById(id) how to get by id? HOT 2
- Why "RTree" is geographically even distribution while "RBush" is NOT? HOT 1
- About evenly geographic distribution when limit the result size HOT 2
- Invalid collision on maxX/Y (pixel-perfect collision false positive) HOT 3
- Does RBUSH supports to use Latitude and Longitude? HOT 5
- Hi i can't figure out how to use this library can anyone help? HOT 3
- Typescript attempts to use missing default constructor HOT 4
- How to search when usiong the extended class for points HOT 1
- is there any quick way to return the bounding box of tree itself? HOT 1
- Questions: Performance Remove + Moving item HOT 1
- Definition of "intersection" could be made more explicit in the readme HOT 2
- Returns all items when bounds provided to search contains center 0,0 HOT 3
- Support esm HOT 1
- search & collides support custom intersects & contains
- Balancing? HOT 1
- Unable to resolve dependency tree
- Performance benchmark vs other libraries 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 rbush.