r_tree 1.0.4 r_tree: ^1.0.4 copied to clipboard
A recursive RTree library written in Dart.
RTree #
A recursive RTree library written in Dart.
"R-trees are tree data structures used for spatial access methods, i.e., for indexing multi-dimensional information such as geographical coordinates, rectangles or polygons." - http://en.wikipedia.org/wiki/R-tree
Benchmarks #
Run the benchmarks in the command line (Dart VM) using:
dart benchmark/benchmarks.dart
You can also run them in a browser using dart2js using pub serve benchmark
or pub build benchmark
and then serving them with your http server of choice. Click the run button and observe the output in the browser console.
API #
- RTree ( [ Number branch_factor ] )
Parameters: #
- branch_factor : optional : The maximum width of a node before a split is performed1.
Returns: #
- An empty RTree object.
RTree.insert #
- insert ( RTreeDatum2 item )
Parameters: #
- item : required : An item to insert into the tree.
RTree.remove #
- remove ( RTreeDatum2 item )
Parameters: #
- item : required : An item to remove from the RTree.
RTree.search #
- search ( Rectangle area )
Parameters: #
- area : required : An area to search within.
Returns: #
- An Iterable<RTreeDatum<E>> of objects that overlap area.
- Note: Rectangles that simply share a border are not considered to overlap.
Notes #
1 Default max node width is currently 16.
2 RTreeDatum is simply a way to bind a Rectangle to an Object.