# rtree

An R-tree for spatial lookups. Insert bounding boxes, query by bounding box, etc.


### add(obj) <sub>function</sub>

Insert an object that has a 'rect' property {x, y, w, h} into the tree.



**obj**: The object to add (must have rectAtom).


**Returns**: None


### delete(obj) <sub>function</sub>

Remove an object from the tree. Must match the same rect as used when adding.



**obj**: The object to remove.


**Returns**: None


### query(rect) <sub>function</sub>

Return an array of objects whose bounding boxes intersect the given rect.



**rect**: {x, y, w, h} bounding region to query.


**Returns**: Array of objects that overlap that region.


### size <sub>accessor</sub>

(read only)

Indicates how many items are stored in the rtree.



**Returns**: Integer count of items in the tree.


### forEach(callback) <sub>function</sub>

Call a function for every item in the rtree.



**callback**: A function called with no arguments, or possibly (item).


**Returns**: None


### has(obj) <sub>function</sub>

Return true if the specified object is in the tree, false otherwise.



**obj**: The object to check.


**Returns**: True if found, else false.


### values() <sub>function</sub>

Return an array of all items currently in the rtree.



**Returns**: Array of all stored objects.

