rtree
An R-tree for spatial lookups. Insert bounding boxes, query by bounding box, etc.
add(obj) function
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) function
Remove an object from the tree. Must match the same rect as used when adding.
obj: The object to remove.
Returns: None
query(rect) function
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 accessor
(read only)
Indicates how many items are stored in the rtree.
Returns: Integer count of items in the tree.
forEach(callback) function
Call a function for every item in the rtree.
callback: A function called with no arguments, or possibly (item).
Returns: None
has(obj) function
Return true if the specified object is in the tree, false otherwise.
obj: The object to check.
Returns: True if found, else false.
values() function
Return an array of all items currently in the rtree.
Returns: Array of all stored objects.