Sopur's QuadTree library
This project was inspired by Timohausmann's "quadtree-js" and how slow it was
This library is extremely optimized to the point of being able to handle millions of inserts and retrieves in less than a second
Why I made this
A lot of the QuadTree's I found were so unbearably slow that I had to make my own
...
And one of my friends made a QuadTree in C++ that was (legit) 10x slower
So just to flex I'm making this public
How to use
Please look at the source for details, or just look below for examples
Basic example
const QuadTree = require("holy-quad-tree");
const qt = new QuadTree.QuadTree(
new QuadTree.Bound(100, 100),
10,
100
);
const Node1 = new QuadTree.Node(
10,
10,
20,
20,
"Test1"
);
const Node2 = new QuadTree.Node(
10,
10,
20,
20,
"Test2"
);
qt.insert(Node1);
qt.insert(Node2);
qt.retrieve(
new QuadTree.Node(
5,
5,
30,
30
)
);
qt.removeObject(Node2);
qt.retrieve(
new QuadTree.Node(
5,
5,
30,
30
)
);
qt.clear();