new QuadTree()
Effectively store positional and sized objects. Each tree has a position and
size, as well as up to 4 child nodes (other trees) and an array of entries.
- Source:
Members
-
entities :Array.<{spatial: Spatial}>
-
Type:
- Array.<{spatial: Spatial}>
- Source:
-
nodes :Array.<QuadTree>
-
Type:
- Array.<QuadTree>
- Source:
-
pool
-
Pool that is used for all internal quad trees. Only root node has one, all others have a refence.
- Source:
Methods
-
clear()
-
Empty the tree recursively.
- Source:
-
insert(entity)
-
Add an entity to the tree
Parameters:
Name Type Description entity
Object - Source:
-
queryArea(position, hwidth, out__objects) → {Array.<{spatial: Spatial}>}
-
Get all tree entries that are interesected by a rectangle defined with position and hwidth.
Parameters:
Name Type Argument Description position
Vec2 hwidth
Vec2 out__objects
Array.<{spatial: Spatial}>= <optional>
Return objects. - Source:
Returns:
The out__objects parameter (filled up now)- Type
- Array.<{spatial: Spatial}>
-
remove(param)
-
Remove an entity from this tree.
Parameters:
Name Type Description param
Object - Source: