rtree-3d

Travis CI
Maven Central

Note: this project is NOT under active development. See rtree-multi for an n-dimensional R-Tree.

Three dimensional R-Tree in java.

Status: pre-alpha

Progress is being made on this project. I've copied my rtree 2D implementation and beefed it up for 3D.

If the coordinates are normalized to the [0..1] range then the data structure doesn't favour one dimension over another. To favour time over position for instance just scale the time value down by a constant (experiment with your data!). Note also that if your entries are added to the R-tree in say ascending time order then the resultant R-tree may be affected negatively in terms of the efficiency of its structure. A useful strategy to avoid this is to shuffle the entries before adding. For example:

RTree<Object, Point> tree = 
  tree.add(
    entries
      .toList()
      .flatMapIterable(list -> {Collections.shuffle(list);return list}));

Visualization

Given the 38,377 data points of greek earthquakes (lat, long, time) from 1964 to 2000, the data is scanned to establish the ranges for each coordinate then normalized to a [0,1] range. The points are shuffled then added to an R-tree with minChildren=2 and maxChildren=4 using either the R* heuristics or standard R-tree heuristics. Visualization of the bounding boxes at nodes by method and depth is below.

Generated with this commit.

The plots below are generated from the same shuffle of data points.

Quadratic split R*-tree split

Commands to generate:

mvn test
cd src/test/r
./source.r

Images are generated in target directory (plot*.png).