Skip to content

Commit f902b76

Browse files
committed
1 parent 2d4cea1 commit f902b76

File tree

1 file changed

+1
-80
lines changed

1 file changed

+1
-80
lines changed

README

+1-80
Original file line numberDiff line numberDiff line change
@@ -1,80 +1 @@
1-
h2. *RTree*
2-
3-
bq. *RTree* ( _[ Number *max_node_width* ]_ )
4-
5-
h3. Parameters:
6-
7-
bq. *max_node_width* : _optional_ : The maximum width of a node before a split is performed[1].
8-
9-
h3. Returns:
10-
11-
bq. An empty *RTree* object.
12-
13-
h3. Usage:
14-
15-
bq. Make a new RTree with a max node width of 10:
16-
@var myRTree = new RTree(10);@
17-
18-
19-
h2. *RTree.insert*
20-
21-
bq. *RTree.insert* ( Rectangle[2] *bounds*, Object *element* )
22-
23-
h3. Parameters:
24-
25-
bq. *bounds* : *required* : A minimally bounding box for *element*.
26-
*element* : *required* : An object to add to the R-Tree.
27-
28-
h3. Returns:
29-
30-
bq. Nothing.
31-
32-
h3. Usage:
33-
34-
bq. Insert a 10x10 object that starts at position 10x10:
35-
@myRTree.insert({x:10, y:10, w:10, h:10}, myObject);@
36-
37-
38-
h2. *RTree.remove*
39-
40-
bq. *RTree.remove* ( Rectangle[2] *area* _[, Object *element* ]_ )
41-
42-
h3. Parameters:
43-
44-
bq. *area* : *required* : An area to search within.
45-
*element* : _optional_ : An object to remove from the R-Tree. If no object is specified, *all* elements that touch *area* are deleted.
46-
47-
h3. Returns:
48-
49-
bq. The number of objects deleted from the R-Tree.
50-
51-
h3. Usage:
52-
53-
bq. Deletes all object that touch the 10x10 rectangle starting at position 10x10:
54-
@var myDelCount = myRTree.delete({x:10, y:10, w:10, h:10});@
55-
Delete only specific_object if it touches the 10x10 rectangle starting at position 10x10:
56-
@var myDelCount = myRTree.delete({x:10, y:10, w:10, h:10}, specific_object);@
57-
58-
59-
h2. *RTree.search*
60-
61-
bq. *RTree.search* ( Rectangle[2] *area* )
62-
63-
h3. Parameters:
64-
65-
bq. *area* : *required* : An area to search within.
66-
67-
h3. Returns:
68-
69-
bq. An array of objects that overlap or touch *area*.
70-
71-
h3. Usage:
72-
73-
bq. Search a 10x10 area that starts at position 10x10:
74-
@var myObjects = myRTree.search({x:10, y:10, w:10, h:10});@
75-
76-
h2. Notes
77-
78-
fn1. Default max node width is currently 6.
79-
80-
fn2. A _Rectangle_ is *any* object with public x, y, w, h properties. The object itself is not saved or used directly but copies are made of its x, y, w, h properties.
1+
Go to the Wiki or more information.

0 commit comments

Comments
 (0)