-
Notifications
You must be signed in to change notification settings - Fork 32
API Reference
RTree ( [Number max_node_width )
max_node_width : optional : The maximum width of a node before a split is forced. Defaults to 6.
A new and empty RTree object.
Make a new RTree with a max node width of 10:
var myRTree = new RTree(10);
area_to_search : required : An area to search within.
The number of objects that overlap or touch area_to_search.
Search a 10×10 area that starts at position 10×10:
var myCount = myRTree.count({x:10, y:10, w:10, h:10});
area_to_search : required : An area to search within.
An array of objects that overlap or touch area_to_search.
Search a 10×10 area that starts at position 10×10:
var myObjects = myRTree.search({x:10, y:10, w:10, h:10});
bounding_box : required : A minimally bounding box for object_to_insert.
object_to_insert : required : An object to add to the R-Tree.
Nothing.
Insert a 10×10 object that starts at position 10×10:
myRTree.insert({x:10, y:10, w:10, h:10}, myObject);
area_to_search : required : An area to search within.
object_to_remove : optional : An object to remove from the R-Tree. If no object is specified, all objects touching area_to_search are deleted.
The number of objects deleted from the R-Tree.
Deletes all object that touch the 10×10 rectangle starting at position 10×10:
var myDelCount = myRTree.delete({x:10, y:10, w:10, h:10});
Delete only specific_object if it touches the 10×10 rectangle starting at position 10×10:
var myDelCount = myRTree.delete({x:10, y:10, w:10, h:10}, specific_object);