A QuadTree is a tree data structure that partitions a two-dimensional space into four quadrants or regions, allowing for efficient spatial indexing and querying.
import { QuadTree } from "collection-kit";
import { QuadTree } from "collection-kit";
const tree = new QuadTree(0, 0, 100, 100); // x, y, width, height
tree.insert({ x: 10, y: 20 });
tree.insert({ x: 50, y: 60 });
const points = tree.search(0, 0, 30, 30);
console.log("Points in region:", points);