QuadTree
QuadTree copied to clipboard
Delete, Delete in range and Move implemented
#8 Added Delete, Delete in Range and Move a point(or a rectangle/circle). It's pretty simple and maybe not optimized. Hope it helps someone that just like me need it for a game or something like that.
This looks really good! Would it be possible to write a test or two for these changes?
Hey! I've gotten upgraded permissions to the repository so I'm trying to do some clean up! Any interest in getting this up to date?
Of course! What can I do?
Great! Step 1 is merging with main and fixing conflicts.
After that, I think we left it with two comments that need addressing and missing some tests.
Are there any parts of this you want me to tackle?
I've been thinking about this a lot and I think this approach needs some tweaks. Since the QuadTree isn't providing the IDs, I'm skeptical about relying on IDs for deleting points. Also based on this usage guide for a different implementation of QuadTrees, QuadTrees are more useful to be snapshots and not live systems.
Here's what I propose (and will implement with help from your great code above):
- deleteFromRange(range): as you've done so.
- filter(fn): takes a function and returns a new QuadTree built with all true points inserted. This allows for a lot of reuse of what we have and will return a tree with no empty quads or subdivisions.
- clear(): as requested in #9.
Incorporated into #62, now merged.