Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[pal] Bring back refined upstream version of superliminal rtree index
Turns out this index is MUCH (magnitudes) faster for use in pal. So
grab an updated version of the upstream library and place in external libs,
and use this for indices in pal.

(we should probably investigate whether this is faster for snapping and
other index use too!)
  • Loading branch information
nyalldawson committed Dec 15, 2019
1 parent 7464290 commit da5cd52
Show file tree
Hide file tree
Showing 22 changed files with 2,352 additions and 27 deletions.
Empty file added external/rtree/.Rhistory
Empty file.
26 changes: 26 additions & 0 deletions external/rtree/CMakeLists.txt
@@ -0,0 +1,26 @@
# CMake version check
cmake_minimum_required(VERSION 3.10.0)

# Check build directory
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
message(FATAL_ERROR "Do not build in-source. Please remove CMakeCache.txt and the CMakeFiles/ directory. Then build out-of-source.")
endif()

# RTree project
project(RTree
VERSION 0.1.0)

# Project build options
option(RTREE_BUILD_TESTS "Build test programs" OFF)

# RTree as header only library
add_library(RTree INTERFACE)
target_include_directories(RTree
INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
target_compile_features(RTree
INTERFACE cxx_std_11)

# Tests
if (RTREE_BUILD_TESTS)
add_subdirectory(tests)
endif()
56 changes: 56 additions & 0 deletions external/rtree/CMakeSettings.json
@@ -0,0 +1,56 @@
{
"configurations": [
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [
"msvc_x64_x64"
],
"buildRoot": "${projectDir}\\build\\${name}",
"installRoot": "${projectDir}\\install\\${name}",
"cmakeCommandArgs": "-Wno-dev -DRTREE_BUILD_TESTS=ON",
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
},
{
"name": "x64-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"inheritEnvironments": [
"msvc_x64_x64"
],
"buildRoot": "${projectDir}\\build\\${name}",
"installRoot": "${projectDir}\\install\\${name}",
"cmakeCommandArgs": "-Wno-dev -DRTREE_BUILD_TESTS=ON",
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
},
{
"name": "x86-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [
"msvc_x86"
],
"buildRoot": "${projectDir}\\build\\${name}",
"installRoot": "${projectDir}\\install\\${name}",
"cmakeCommandArgs": "-Wno-dev -DRTREE_BUILD_TESTS=ON",
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
},
{
"name": "x86-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"inheritEnvironments": [
"msvc_x86"
],
"buildRoot": "${projectDir}\\build\\${name}",
"installRoot": "${projectDir}\\install\\${name}",
"cmakeCommandArgs": "-Wno-dev -DRTREE_BUILD_TESTS=ON",
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
}
]
}
84 changes: 84 additions & 0 deletions external/rtree/README.md
@@ -0,0 +1,84 @@
# R-Trees: A Dynamic Index Structure for Spatial Searching

## Description

A C++ templated version of [this](http://www.superliminal.com/sources/sources.htm)
RTree algorithm.
The code it now generally compatible with the STL and Boost C++ libraries.

## Usage

```cpp
#include <RTree.h>

// ...

RTree<Foo*, double, 3> tree;
double min[3] = {0., 0., 0.};
double max[3] = {1., 1., 1.};
Foo* bar = new Foo();
tree.Insert(min, max, bar);
```
Provides search in and iteration over the tree. For examples see
[Test.cpp](https://github.com/nushoin/RTree/blob/master/Test.cpp)
## Testing
Run `make` to build and `make test` to run the tests. The RTree itself is
a single header file and can be included without compiling.
## Authors
- 1983 Original algorithm and test code by Antonin Guttman and Michael Stonebraker, UC Berkely
- 1994 ANCI C ported from original test code by Melinda Green - melinda@superliminal.com
- 1995 Sphere volume fix for degeneracy problem submitted by Paul Brook
- 2004 Templated C++ port by Greg Douglas
- 2011 Modified the container to support more data types, by Yariv Barkan
- 2017 Modified Search to take C++11 function to allow lambdas and added const qualifier, by Gero Mueller
## License
Original code was taken from http://www.superliminal.com/sources/sources.htm
and is stored as git revision 0. This revision is entirely free for all
uses. Enjoy!
Due to restrictions on public domain in certain jurisdictions, code
contributed by Yariv Barkan is released in these jurisdictions under the
BSD, MIT or the GPL - you may choose one or more, whichever that suits you
best.
In jurisdictions where public domain property is recognized, the user of
this software may choose to accept it either 1) as public domain, 2) under
the conditions of the BSD, MIT or GPL or 3) any combination of public
domain and one or more of these licenses.
Thanks [Baptiste Lepilleur](http://jsoncpp.sourceforge.net/LICENSE) for the
licensing idea.
## Recent Change Log
### 31 Jan 2018
- Added copy constructor
- Callback function is now `std::function`
### 05 Apr 2014
- Added tests
### 02 Sep 2011
- Modified the container to support more data types. The code it now generally
compatible with the STL and Boost C++ libraries.
### 05 Jan 2010
- Fixed Iterator GetFirst() - Previous fix was not incomplete
### 03 Dec 2009
- Added Iteartor GetBounds()
- Added Iterator usage to simple test
- Fixed Iterator GetFirst() - Thanks Mathew Riek
- Minor updates for MSVC 2005/08 compilers

0 comments on commit da5cd52

Please sign in to comment.