Module

QuadTree

A QuadTree implementation in JavaScript, a 2d spatial subdivision algorithm.
See:

Classes

QuadTree

Methods

# inner clear()

Clears all nodes and children from the QuadTree

# inner insert(item)

Inserts an item into the QuadTree.
Parameters:
Name Type Description
item Object | Array The item or Array of items to be inserted into the QuadTree. The item should expose x, y properties that represents its position in 2D space.

# inner retrieve(item)

Retrieves all items / points in the same node as the specified item / point. If the specified item overlaps the bounds of a node, then all children in both nodes will be returned.
Parameters:
Name Type Description
item Object An object representing a 2D coordinate point (with x, y properties), or a shape with dimensions (x, y, width, height) properties.