mirror of
https://github.com/boostorg/geometry.git
synced 2025-05-12 14:01:47 +00:00
rtree::box() renamed to rtree::envelope() index::box() renamed to index::envelope() some unneeded tests removed docs updated [SVN r82546]
260 lines
11 KiB
HTML
260 lines
11 KiB
HTML
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
|
<title>Introduction</title>
|
|
<link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
|
|
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
|
<link rel="home" href="../../index.html" title="Chapter 1. Geometry Index">
|
|
<link rel="up" href="../r_tree.html" title="R-tree">
|
|
<link rel="prev" href="../r_tree.html" title="R-tree">
|
|
<link rel="next" href="rtree_quickstart.html" title="Quick Start">
|
|
</head>
|
|
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
|
<table cellpadding="2" width="100%"><tr>
|
|
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="http://www.boost.org/doc/libs/release/boost.png"></td>
|
|
<td align="center"><a href="http://www.boost.org/doc/libs/release/index.html">Home</a></td>
|
|
<td align="center"><a href="http://www.boost.org/doc/libs/release/libs/libraries.htm">Libraries</a></td>
|
|
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
|
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
|
<td align="center"><a href="http://www.boost.org/doc/libs/release/more/index.htm">More</a></td>
|
|
</tr></table>
|
|
<hr>
|
|
<div class="spirit-nav">
|
|
<a accesskey="p" href="../r_tree.html"><img src="http://www.boost.org/doc/libs/release/doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../r_tree.html"><img src="http://www.boost.org/doc/libs/release/doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="http://www.boost.org/doc/libs/release/doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="rtree_quickstart.html"><img src="http://www.boost.org/doc/libs/release/doc/src/images/next.png" alt="Next"></a>
|
|
</div>
|
|
<div class="section">
|
|
<div class="titlepage"><div><div><h3 class="title">
|
|
<a name="geometry_index.r_tree.introduction"></a><a class="link" href="introduction.html" title="Introduction">Introduction</a>
|
|
</h3></div></div></div>
|
|
<p>
|
|
R-tree is a tree data structure used for spatial searching. It was proposed
|
|
by Antonin Guttman in 1984 <a href="#ftn.geometry_index.r_tree.introduction.f0" class="footnote"><sup class="footnote"><a name="geometry_index.r_tree.introduction.f0"></a>[1]</sup></a> as an expansion of B-tree for multi-dimensional data. It may
|
|
be used to store points or volumetric data in order to perform a spatial
|
|
query later. This query may return objects that are inside some area or are
|
|
close to some point in space <a href="#ftn.geometry_index.r_tree.introduction.f1" class="footnote"><sup class="footnote"><a name="geometry_index.r_tree.introduction.f1"></a>[2]</sup></a>.
|
|
</p>
|
|
<p>
|
|
The R-tree structure is presented on the image below. Each R-tree's node
|
|
store a box descring the space occupied by its children nodes. At the bottom
|
|
of the structure, there are leaf-nodes which contains values (geometric objects
|
|
representations).
|
|
</p>
|
|
<p>
|
|
<span class="inlinemediaobject"><img src="../../../images/rstar.png" alt="rstar"></span>
|
|
</p>
|
|
<p>
|
|
The number of maximum and mininimum node's elements must be specified by
|
|
the user. If the number of elements reaches it's maximum the new node is
|
|
created and elements are split between nodes. If the number of elements in
|
|
node is too small, the node is deleted and elements are reinserted into the
|
|
tree.
|
|
</p>
|
|
<p>
|
|
The R-tree is a self-balanced data structure. The key part of balancing algorithm
|
|
is node splitting algorithm <a href="#ftn.geometry_index.r_tree.introduction.f2" class="footnote"><sup class="footnote"><a name="geometry_index.r_tree.introduction.f2"></a>[3]</sup></a> <a href="#ftn.geometry_index.r_tree.introduction.f3" class="footnote"><sup class="footnote"><a name="geometry_index.r_tree.introduction.f3"></a>[4]</sup></a>. Each algorithm produces different splits so the internal structure
|
|
of a tree may be different for each one of them. In general more complex
|
|
algorithms analyses elements better and produces less overlapping nodes.
|
|
In the searching process less nodes must be traversed in order to find desired
|
|
obejcts. On the other hand more complex analysis takes more time. In general
|
|
faster inserting will result in slower searching and vice versa. Example
|
|
structures of trees created by use of three different algorithms and operations
|
|
time are presented below.
|
|
</p>
|
|
<div class="informaltable"><table class="table">
|
|
<colgroup>
|
|
<col>
|
|
<col>
|
|
<col>
|
|
<col>
|
|
</colgroup>
|
|
<thead><tr>
|
|
<th>
|
|
</th>
|
|
<th>
|
|
<p>
|
|
linear algorithm
|
|
</p>
|
|
</th>
|
|
<th>
|
|
<p>
|
|
quadratic algorithm
|
|
</p>
|
|
</th>
|
|
<th>
|
|
<p>
|
|
R*-tree
|
|
</p>
|
|
</th>
|
|
</tr></thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>
|
|
<p>
|
|
<span class="bold"><strong>Structure</strong></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="inlinemediaobject"><img src="../../../images/linear.png" alt="linear"></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="inlinemediaobject"><img src="../../../images/quadratic.png" alt="quadratic"></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
<span class="inlinemediaobject"><img src="../../../images/rstar.png" alt="rstar"></span>
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<p>
|
|
<span class="bold"><strong>1M Values inserts</strong></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
1.85s
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
3.10s
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
24.52s
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<p>
|
|
<span class="bold"><strong>1M spatial queries</strong></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
8.60s
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
2.74s
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
1.31s
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<p>
|
|
<span class="bold"><strong>100k knn queries</strong></span>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
3.49s
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
1.59s
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p>
|
|
0.84s
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table></div>
|
|
<h5>
|
|
<a name="geometry_index.r_tree.introduction.h0"></a>
|
|
<span class="phrase"><a name="geometry_index.r_tree.introduction.implementation_details"></a></span><a class="link" href="introduction.html#geometry_index.r_tree.introduction.implementation_details">Implementation
|
|
details</a>
|
|
</h5>
|
|
<p>
|
|
Key features of this implementation of the R-tree are:
|
|
</p>
|
|
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
|
<li class="listitem">
|
|
capable to store arbitrary Value type,
|
|
</li>
|
|
<li class="listitem">
|
|
capable to store Value type with no default constructor,
|
|
</li>
|
|
<li class="listitem">
|
|
three different creation algorithms - linear, quadratic or rstar,
|
|
</li>
|
|
<li class="listitem">
|
|
parameters (including maximal and minimal number of elements) may be
|
|
passed as compile- or run-time parameters - compile-time version is faster,
|
|
</li>
|
|
<li class="listitem">
|
|
advanced queries - e.g. search for 5 nearest values further than some
|
|
minimal distance and intersecting some region but not within the other
|
|
one.
|
|
</li>
|
|
</ul></div>
|
|
<h5>
|
|
<a name="geometry_index.r_tree.introduction.h1"></a>
|
|
<span class="phrase"><a name="geometry_index.r_tree.introduction.contributors"></a></span><a class="link" href="introduction.html#geometry_index.r_tree.introduction.contributors">Contributors</a>
|
|
</h5>
|
|
<p>
|
|
The spatial index was originally started by Federico J. Fernandez during
|
|
the Google-Of-Summer project 2008, mentored by Hartmut Kaiser.
|
|
</p>
|
|
<h5>
|
|
<a name="geometry_index.r_tree.introduction.h2"></a>
|
|
<span class="phrase"><a name="geometry_index.r_tree.introduction.spatial_thanks"></a></span><a class="link" href="introduction.html#geometry_index.r_tree.introduction.spatial_thanks">Spatial
|
|
thanks</a>
|
|
</h5>
|
|
<p>
|
|
I'd like to thank Barend Gehrels, Bruno Lalande, Lucanus J. Simonson for
|
|
their support and ideas, as well as the members of the Boost.Geometry mailing
|
|
list for their help.
|
|
</p>
|
|
<div class="footnotes">
|
|
<br><hr style="width:100; align:left;">
|
|
<div id="ftn.geometry_index.r_tree.introduction.f0" class="footnote"><p><a href="#geometry_index.r_tree.introduction.f0" class="para"><sup class="para">[1] </sup></a>
|
|
Guttman, A. (1984). <span class="emphasis"><em>R-Trees: A Dynamic Index Structure for Spatial
|
|
Searching</em></span>
|
|
</p></div>
|
|
<div id="ftn.geometry_index.r_tree.introduction.f1" class="footnote"><p><a href="#geometry_index.r_tree.introduction.f1" class="para"><sup class="para">[2] </sup></a>
|
|
Cheung, K.; Fu, A. (1998). <span class="emphasis"><em>Enhanced Nearest Neighbour Search
|
|
on the R-tree</em></span>
|
|
</p></div>
|
|
<div id="ftn.geometry_index.r_tree.introduction.f2" class="footnote"><p><a href="#geometry_index.r_tree.introduction.f2" class="para"><sup class="para">[3] </sup></a>
|
|
Greene, D. (1989). <span class="emphasis"><em>An implementation and performance analysis
|
|
of spatial data access methods</em></span>
|
|
</p></div>
|
|
<div id="ftn.geometry_index.r_tree.introduction.f3" class="footnote"><p><a href="#geometry_index.r_tree.introduction.f3" class="para"><sup class="para">[4] </sup></a>
|
|
Beckmann, N.; Kriegel, H. P.; Schneider, R.; Seeger, B. (1990). <span class="emphasis"><em>The
|
|
R*-tree: an efficient and robust access method for points and rectangles</em></span>
|
|
</p></div>
|
|
</div>
|
|
</div>
|
|
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
|
<td align="left"></td>
|
|
<td align="right"><div class="copyright-footer">Copyright © 2011-2013 Adam Wulkiewicz<p>
|
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
|
</p>
|
|
</div></td>
|
|
</tr></table>
|
|
<hr>
|
|
<div class="spirit-nav">
|
|
<a accesskey="p" href="../r_tree.html"><img src="http://www.boost.org/doc/libs/release/doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../r_tree.html"><img src="http://www.boost.org/doc/libs/release/doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="http://www.boost.org/doc/libs/release/doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="rtree_quickstart.html"><img src="http://www.boost.org/doc/libs/release/doc/src/images/next.png" alt="Next"></a>
|
|
</div>
|
|
</body>
|
|
</html>
|