API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classQuadtree

@codexo/exojs / math / stable

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.

0
props
6
methods
0
events
Import
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.

Constructors 1
new(bounds: Rectangle, maxItems: number, maxDepth: number, depth: number): Quadtree<T>
Methods 6
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
Source