API reference
Every public class, method, and event in @codexo/exojs. Generated from source.
classQuadtree
Generic recursive spatial index used by the engine's `InteractionManager` to accelerate per-frame hit-testing of scene nodes. Items are inserted with their axis-aligned bounding box; the tree automatically subdivides into four quadrants (NW/NE/SW/SE) when a node accumulates more than `maxItems` entries and the current depth is below `maxDepth`. Items that span multiple quadrants are kept at the current node rather than duplicated. The tree is persistent: `insert` and `remove` modify the tree in place without full rebuilds. Call `clear()` for bulk reset, or `destroy()` to release all memory including child rectangles.
import { Quadtree } from '@codexo/exojs' Generic recursive spatial index used by the engine's `InteractionManager` to accelerate per-frame hit-testing of scene nodes.
Items are inserted with their axis-aligned bounding box; the tree automatically subdivides into four quadrants (NW/NE/SW/SE) when a node accumulates more than `maxItems` entries and the current depth is below `maxDepth`. Items that span multiple quadrants are kept at the current node rather than duplicated.
The tree is persistent: `insert` and `remove` modify the tree in place without full rebuilds. Call `clear()` for bulk reset, or `destroy()` to release all memory including child rectangles.
new(bounds: Rectangle, maxItems: number, maxDepth: number, depth: number): Quadtree<T> clear(): void destroy(): void insert(item: QuadtreeItem<T>): void queryPoint(x: number, y: number, results: QuadtreeItem<T>[]): QuadtreeItem<T>[] queryRect(rect: Rectangle, results: QuadtreeItem<T>[]): QuadtreeItem<T>[] remove(item: QuadtreeItem<T>): boolean