Class: Quadtree

Quadtree(boundary, capacity)

Class representing a quadtree.

This implementation is adapted from CodingTrain/QuadTree, which is licensed under an MIT License.

Constructor

new Quadtree(boundary, capacity)

Create a quadtree.

Parameters:
Name Type Description
boundary AABB

The bounding box of the quadtree.

capacity number

The number of points that can be inserted into Quadtree without subdividing.

Source:
See:

Classes

Quadtree

Methods

insert(point)

Add a point into this quadtree.

Parameters:
Name Type Description
point Vector
Source:

query(range) → {Array.<Vector>}

Check for points in a given range and return them in an array.

Parameters:
Name Type Description
range AABB

The bounding box of the query.

Source:
Returns:
Type
Array.<Vector>

show(plot)

For each boundary of this quadtree and all it's children, create Lines from those rectangles and add them to a Plot.

Parameters:
Name Type Description
plot Plot
Source: