interface Rectangle {
x: number;
y: number;
width: number;
height: number;
}
const rectBounds = ({ x, y, width, height }: Rectangle) =>
[x, y, x + width, r.y + height];
const qt = ennetree<Rectangle>([0,0,1000,1000], rectBounds);
// Add a rectangle
qt.insert({ x: 20, y: 20, width: 50, height: 50 });
// Collect items
const results = qt.collect([0, 0, 100, 100]);
const qt = ennetree<Rectangle>(
[0,0,1000,1000],
rectBounds,
{
maxDepth: 4,
maxChildren: 50
}
);
const qt = ennetree<DOMRect>(
[0, 0, 1000, 1000],
({ left, top, right, bottom }) => [left, top, right, bottom],
);
Create an ennetree for a given area.